mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-03 13:40:00 +09:00
update to laravel 5.7 and try getting autologin saved
This commit is contained in:
367
vendor/symfony/http-kernel/Tests/KernelTest.php
vendored
367
vendor/symfony/http-kernel/Tests/KernelTest.php
vendored
@@ -16,16 +16,15 @@ use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
||||
use Symfony\Component\HttpKernel\Config\EnvParametersResource;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\ResettableServicePass;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest;
|
||||
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\ResettableServicePass;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForOverrideName;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelWithoutBundles;
|
||||
use Symfony\Component\HttpKernel\Tests\Fixtures\ResettableService;
|
||||
|
||||
@@ -75,7 +74,7 @@ class KernelTest extends TestCase
|
||||
$kernel = new CustomProjectDirKernel();
|
||||
$kernel->boot();
|
||||
|
||||
$containerDir = __DIR__.'/Fixtures/cache/custom/'.substr(get_class($kernel->getContainer()), 0, 16);
|
||||
$containerDir = __DIR__.'/Fixtures/cache/custom/'.substr(\get_class($kernel->getContainer()), 0, 16);
|
||||
$this->assertTrue(unlink(__DIR__.'/Fixtures/cache/custom/FixturesCustomDebugProjectContainer.php.meta'));
|
||||
$this->assertFileExists($containerDir);
|
||||
$this->assertFileNotExists($containerDir.'.legacy');
|
||||
@@ -124,20 +123,6 @@ class KernelTest extends TestCase
|
||||
$this->assertTrue($kernel->isBooted());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testClassCacheIsLoaded()
|
||||
{
|
||||
$kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'doLoadClassCache'));
|
||||
$kernel->loadClassCache('name', '.extension');
|
||||
$kernel->expects($this->once())
|
||||
->method('doLoadClassCache')
|
||||
->with('name', '.extension');
|
||||
|
||||
$kernel->boot();
|
||||
}
|
||||
|
||||
public function testClassCacheIsNotLoadedByDefault()
|
||||
{
|
||||
$kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'doLoadClassCache'));
|
||||
@@ -147,53 +132,6 @@ class KernelTest extends TestCase
|
||||
$kernel->boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testClassCacheIsNotLoadedWhenKernelIsNotBooted()
|
||||
{
|
||||
$kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'doLoadClassCache'));
|
||||
$kernel->loadClassCache();
|
||||
$kernel->expects($this->never())
|
||||
->method('doLoadClassCache');
|
||||
}
|
||||
|
||||
public function testEnvParametersResourceIsAdded()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('getContainerBuilder', 'prepareContainer', 'getCacheDir', 'getLogDir'))
|
||||
->getMock();
|
||||
$kernel->expects($this->any())
|
||||
->method('getContainerBuilder')
|
||||
->will($this->returnValue($container));
|
||||
$kernel->expects($this->any())
|
||||
->method('prepareContainer')
|
||||
->will($this->returnValue(null));
|
||||
$kernel->expects($this->any())
|
||||
->method('getCacheDir')
|
||||
->will($this->returnValue(sys_get_temp_dir()));
|
||||
$kernel->expects($this->any())
|
||||
->method('getLogDir')
|
||||
->will($this->returnValue(sys_get_temp_dir()));
|
||||
|
||||
$reflection = new \ReflectionClass(get_class($kernel));
|
||||
$method = $reflection->getMethod('buildContainer');
|
||||
$method->setAccessible(true);
|
||||
$method->invoke($kernel);
|
||||
|
||||
$found = false;
|
||||
foreach ($container->getResources() as $resource) {
|
||||
if ($resource instanceof EnvParametersResource) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertTrue($found);
|
||||
}
|
||||
|
||||
public function testBootKernelSeveralTimesOnlyInitializesBundlesOnce()
|
||||
{
|
||||
$kernel = $this->getKernel(array('initializeBundles', 'initializeContainer'));
|
||||
@@ -349,7 +287,7 @@ EOF;
|
||||
|
||||
// Heredocs are preserved, making the output mixing Unix and Windows line
|
||||
// endings, switching to "\n" everywhere on Windows to avoid failure.
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$expected = str_replace("\r\n", "\n", $expected);
|
||||
$output = str_replace("\r\n", "\n", $output);
|
||||
}
|
||||
@@ -361,7 +299,7 @@ EOF;
|
||||
{
|
||||
$kernel = new KernelForTest('test', true);
|
||||
|
||||
$this->assertEquals(__DIR__.DIRECTORY_SEPARATOR.'Fixtures', realpath($kernel->getRootDir()));
|
||||
$this->assertEquals(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures', realpath($kernel->getRootDir()));
|
||||
}
|
||||
|
||||
public function testGetName()
|
||||
@@ -421,7 +359,7 @@ EOF;
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('getBundle')
|
||||
->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'))))
|
||||
->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')))
|
||||
;
|
||||
|
||||
$kernel->locateResource('@Bundle1Bundle/config/routing.xml');
|
||||
@@ -433,80 +371,19 @@ EOF;
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('getBundle')
|
||||
->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'))))
|
||||
->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')))
|
||||
;
|
||||
|
||||
$this->assertEquals(__DIR__.'/Fixtures/Bundle1Bundle/foo.txt', $kernel->locateResource('@Bundle1Bundle/foo.txt'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLocateResourceReturnsTheFirstThatMatchesWithParent()
|
||||
{
|
||||
$parent = $this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle');
|
||||
$child = $this->getBundle(__DIR__.'/Fixtures/Bundle2Bundle');
|
||||
|
||||
$kernel = $this->getKernel(array('getBundle'));
|
||||
$kernel
|
||||
->expects($this->exactly(2))
|
||||
->method('getBundle')
|
||||
->will($this->returnValue(array($child, $parent)))
|
||||
;
|
||||
|
||||
$this->assertEquals(__DIR__.'/Fixtures/Bundle2Bundle/foo.txt', $kernel->locateResource('@ParentAABundle/foo.txt'));
|
||||
$this->assertEquals(__DIR__.'/Fixtures/Bundle1Bundle/bar.txt', $kernel->locateResource('@ParentAABundle/bar.txt'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLocateResourceReturnsAllMatches()
|
||||
{
|
||||
$parent = $this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle');
|
||||
$child = $this->getBundle(__DIR__.'/Fixtures/Bundle2Bundle');
|
||||
|
||||
$kernel = $this->getKernel(array('getBundle'));
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('getBundle')
|
||||
->will($this->returnValue(array($child, $parent)))
|
||||
;
|
||||
|
||||
$this->assertEquals(array(
|
||||
__DIR__.'/Fixtures/Bundle2Bundle/foo.txt',
|
||||
__DIR__.'/Fixtures/Bundle1Bundle/foo.txt', ),
|
||||
$kernel->locateResource('@Bundle1Bundle/foo.txt', null, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLocateResourceReturnsAllMatchesBis()
|
||||
{
|
||||
$kernel = $this->getKernel(array('getBundle'));
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('getBundle')
|
||||
->will($this->returnValue(array(
|
||||
$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'),
|
||||
$this->getBundle(__DIR__.'/Foobar'),
|
||||
)))
|
||||
;
|
||||
|
||||
$this->assertEquals(
|
||||
array(__DIR__.'/Fixtures/Bundle1Bundle/foo.txt'),
|
||||
$kernel->locateResource('@Bundle1Bundle/foo.txt', null, false)
|
||||
);
|
||||
}
|
||||
|
||||
public function testLocateResourceIgnoresDirOnNonResource()
|
||||
{
|
||||
$kernel = $this->getKernel(array('getBundle'));
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('getBundle')
|
||||
->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'))))
|
||||
->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')))
|
||||
;
|
||||
|
||||
$this->assertEquals(
|
||||
@@ -521,7 +398,7 @@ EOF;
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('getBundle')
|
||||
->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle'))))
|
||||
->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')))
|
||||
;
|
||||
|
||||
$this->assertEquals(
|
||||
@@ -530,73 +407,13 @@ EOF;
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLocateResourceReturnsTheDirOneForResourcesAndBundleOnes()
|
||||
{
|
||||
$kernel = $this->getKernel(array('getBundle'));
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('getBundle')
|
||||
->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle'))))
|
||||
;
|
||||
|
||||
$this->assertEquals(array(
|
||||
__DIR__.'/Fixtures/Resources/Bundle1Bundle/foo.txt',
|
||||
__DIR__.'/Fixtures/Bundle1Bundle/Resources/foo.txt', ),
|
||||
$kernel->locateResource('@Bundle1Bundle/Resources/foo.txt', __DIR__.'/Fixtures/Resources', false)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLocateResourceOverrideBundleAndResourcesFolders()
|
||||
{
|
||||
$parent = $this->getBundle(__DIR__.'/Fixtures/BaseBundle', null, 'BaseBundle', 'BaseBundle');
|
||||
$child = $this->getBundle(__DIR__.'/Fixtures/ChildBundle', 'ParentBundle', 'ChildBundle', 'ChildBundle');
|
||||
|
||||
$kernel = $this->getKernel(array('getBundle'));
|
||||
$kernel
|
||||
->expects($this->exactly(4))
|
||||
->method('getBundle')
|
||||
->will($this->returnValue(array($child, $parent)))
|
||||
;
|
||||
|
||||
$this->assertEquals(array(
|
||||
__DIR__.'/Fixtures/Resources/ChildBundle/foo.txt',
|
||||
__DIR__.'/Fixtures/ChildBundle/Resources/foo.txt',
|
||||
__DIR__.'/Fixtures/BaseBundle/Resources/foo.txt',
|
||||
),
|
||||
$kernel->locateResource('@BaseBundle/Resources/foo.txt', __DIR__.'/Fixtures/Resources', false)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
__DIR__.'/Fixtures/Resources/ChildBundle/foo.txt',
|
||||
$kernel->locateResource('@BaseBundle/Resources/foo.txt', __DIR__.'/Fixtures/Resources')
|
||||
);
|
||||
|
||||
try {
|
||||
$kernel->locateResource('@BaseBundle/Resources/hide.txt', __DIR__.'/Fixtures/Resources', false);
|
||||
$this->fail('Hidden resources should raise an exception when returning an array of matching paths');
|
||||
} catch (\RuntimeException $e) {
|
||||
}
|
||||
|
||||
try {
|
||||
$kernel->locateResource('@BaseBundle/Resources/hide.txt', __DIR__.'/Fixtures/Resources', true);
|
||||
$this->fail('Hidden resources should raise an exception when returning the first matching path');
|
||||
} catch (\RuntimeException $e) {
|
||||
}
|
||||
}
|
||||
|
||||
public function testLocateResourceOnDirectories()
|
||||
{
|
||||
$kernel = $this->getKernel(array('getBundle'));
|
||||
$kernel
|
||||
->expects($this->exactly(2))
|
||||
->method('getBundle')
|
||||
->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle'))))
|
||||
->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')))
|
||||
;
|
||||
|
||||
$this->assertEquals(
|
||||
@@ -612,7 +429,7 @@ EOF;
|
||||
$kernel
|
||||
->expects($this->exactly(2))
|
||||
->method('getBundle')
|
||||
->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle'))))
|
||||
->will($this->returnValue($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle')))
|
||||
;
|
||||
|
||||
$this->assertEquals(
|
||||
@@ -626,103 +443,6 @@ EOF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testInitializeBundles()
|
||||
{
|
||||
$parent = $this->getBundle(null, null, 'ParentABundle');
|
||||
$child = $this->getBundle(null, 'ParentABundle', 'ChildABundle');
|
||||
|
||||
// use test kernel so we can access getBundleMap()
|
||||
$kernel = $this->getKernelForTest(array('registerBundles'));
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('registerBundles')
|
||||
->will($this->returnValue(array($parent, $child)))
|
||||
;
|
||||
$kernel->boot();
|
||||
|
||||
$map = $kernel->getBundleMap();
|
||||
$this->assertEquals(array($child, $parent), $map['ParentABundle']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testInitializeBundlesSupportInheritanceCascade()
|
||||
{
|
||||
$grandparent = $this->getBundle(null, null, 'GrandParentBBundle');
|
||||
$parent = $this->getBundle(null, 'GrandParentBBundle', 'ParentBBundle');
|
||||
$child = $this->getBundle(null, 'ParentBBundle', 'ChildBBundle');
|
||||
|
||||
// use test kernel so we can access getBundleMap()
|
||||
$kernel = $this->getKernelForTest(array('registerBundles'));
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('registerBundles')
|
||||
->will($this->returnValue(array($grandparent, $parent, $child)))
|
||||
;
|
||||
$kernel->boot();
|
||||
|
||||
$map = $kernel->getBundleMap();
|
||||
$this->assertEquals(array($child, $parent, $grandparent), $map['GrandParentBBundle']);
|
||||
$this->assertEquals(array($child, $parent), $map['ParentBBundle']);
|
||||
$this->assertEquals(array($child), $map['ChildBBundle']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage Bundle "ChildCBundle" extends bundle "FooBar", which is not registered.
|
||||
*/
|
||||
public function testInitializeBundlesThrowsExceptionWhenAParentDoesNotExists()
|
||||
{
|
||||
$child = $this->getBundle(null, 'FooBar', 'ChildCBundle');
|
||||
$kernel = $this->getKernel(array(), array($child));
|
||||
$kernel->boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testInitializeBundlesSupportsArbitraryBundleRegistrationOrder()
|
||||
{
|
||||
$grandparent = $this->getBundle(null, null, 'GrandParentCBundle');
|
||||
$parent = $this->getBundle(null, 'GrandParentCBundle', 'ParentCBundle');
|
||||
$child = $this->getBundle(null, 'ParentCBundle', 'ChildCBundle');
|
||||
|
||||
// use test kernel so we can access getBundleMap()
|
||||
$kernel = $this->getKernelForTest(array('registerBundles'));
|
||||
$kernel
|
||||
->expects($this->once())
|
||||
->method('registerBundles')
|
||||
->will($this->returnValue(array($parent, $grandparent, $child)))
|
||||
;
|
||||
$kernel->boot();
|
||||
|
||||
$map = $kernel->getBundleMap();
|
||||
$this->assertEquals(array($child, $parent, $grandparent), $map['GrandParentCBundle']);
|
||||
$this->assertEquals(array($child, $parent), $map['ParentCBundle']);
|
||||
$this->assertEquals(array($child), $map['ChildCBundle']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage Bundle "ParentCBundle" is directly extended by two bundles "ChildC2Bundle" and "ChildC1Bundle".
|
||||
*/
|
||||
public function testInitializeBundlesThrowsExceptionWhenABundleIsDirectlyExtendedByTwoBundles()
|
||||
{
|
||||
$parent = $this->getBundle(null, null, 'ParentCBundle');
|
||||
$child1 = $this->getBundle(null, 'ParentCBundle', 'ChildC1Bundle');
|
||||
$child2 = $this->getBundle(null, 'ParentCBundle', 'ChildC2Bundle');
|
||||
|
||||
$kernel = $this->getKernel(array(), array($parent, $child1, $child2));
|
||||
$kernel->boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage Trying to register two bundles with the same name "DuplicateName"
|
||||
*/
|
||||
@@ -735,19 +455,6 @@ EOF;
|
||||
$kernel->boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage Bundle "CircularRefBundle" can not extend itself.
|
||||
*/
|
||||
public function testInitializeBundleThrowsExceptionWhenABundleExtendsItself()
|
||||
{
|
||||
$circularRef = $this->getBundle(null, 'CircularRefBundle', 'CircularRefBundle');
|
||||
|
||||
$kernel = $this->getKernel(array(), array($circularRef));
|
||||
$kernel->boot();
|
||||
}
|
||||
|
||||
public function testTerminateReturnsSilentlyIfKernelIsNotBooted()
|
||||
{
|
||||
$kernel = $this->getKernel(array('getHttpKernel'));
|
||||
@@ -807,25 +514,6 @@ EOF;
|
||||
$this->assertEquals('_123', $kernel->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation The Symfony\Component\HttpKernel\Kernel::getEnvParameters() method is deprecated as of 3.3 and will be removed in 4.0. Use the %cenv()%c syntax to get the value of any environment variable from configuration files instead.
|
||||
* @expectedDeprecation The support of special environment variables that start with SYMFONY__ (such as "SYMFONY__FOO__BAR") is deprecated as of 3.3 and will be removed in 4.0. Use the %cenv()%c syntax instead to get the value of environment variables in configuration files.
|
||||
*/
|
||||
public function testSymfonyEnvironmentVariables()
|
||||
{
|
||||
$_SERVER['SYMFONY__FOO__BAR'] = 'baz';
|
||||
|
||||
$kernel = $this->getKernel();
|
||||
$method = new \ReflectionMethod($kernel, 'getEnvParameters');
|
||||
$method->setAccessible(true);
|
||||
|
||||
$envParameters = $method->invoke($kernel);
|
||||
$this->assertSame('baz', $envParameters['foo.bar']);
|
||||
|
||||
unset($_SERVER['SYMFONY__FOO__BAR']);
|
||||
}
|
||||
|
||||
public function testProjectDirExtension()
|
||||
{
|
||||
$kernel = new CustomProjectDirKernel();
|
||||
@@ -842,7 +530,7 @@ EOF;
|
||||
$kernel = new CustomProjectDirKernel();
|
||||
$kernel->boot();
|
||||
|
||||
$containerClass = get_class($kernel->getContainer());
|
||||
$containerClass = \get_class($kernel->getContainer());
|
||||
$containerFile = (new \ReflectionClass($kernel->getContainer()))->getFileName();
|
||||
unlink(__DIR__.'/Fixtures/cache/custom/FixturesCustomDebugProjectContainer.php.meta');
|
||||
|
||||
@@ -858,7 +546,7 @@ EOF;
|
||||
|
||||
$this->assertNotInstanceOf($containerClass, $kernel->getContainer());
|
||||
$this->assertFileExists($containerFile);
|
||||
$this->assertFileExists(dirname($containerFile).'.legacy');
|
||||
$this->assertFileExists(\dirname($containerFile).'.legacy');
|
||||
}
|
||||
|
||||
public function testKernelPass()
|
||||
@@ -901,6 +589,21 @@ EOF;
|
||||
$this->assertEquals(1, ResettableService::$counter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group time-sensitive
|
||||
*/
|
||||
public function testKernelStartTimeIsResetWhileBootingAlreadyBootedKernel()
|
||||
{
|
||||
$kernel = $this->getKernelForTest(array('initializeBundles'), true);
|
||||
$kernel->boot();
|
||||
$preReBoot = $kernel->getStartTime();
|
||||
|
||||
sleep(3600); //Intentionally large value to detect if ClockMock ever breaks
|
||||
$kernel->reboot(null);
|
||||
|
||||
$this->assertGreaterThan($preReBoot, $kernel->getStartTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mock for the BundleInterface.
|
||||
*
|
||||
@@ -923,7 +626,7 @@ EOF;
|
||||
$bundle
|
||||
->expects($this->any())
|
||||
->method('getName')
|
||||
->will($this->returnValue(null === $bundleName ? get_class($bundle) : $bundleName))
|
||||
->will($this->returnValue(null === $bundleName ? \get_class($bundle) : $bundleName))
|
||||
;
|
||||
|
||||
$bundle
|
||||
@@ -970,10 +673,10 @@ EOF;
|
||||
return $kernel;
|
||||
}
|
||||
|
||||
protected function getKernelForTest(array $methods = array())
|
||||
protected function getKernelForTest(array $methods = array(), $debug = false)
|
||||
{
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest')
|
||||
->setConstructorArgs(array('test', false))
|
||||
->setConstructorArgs(array('test', $debug))
|
||||
->setMethods($methods)
|
||||
->getMock();
|
||||
$p = new \ReflectionProperty($kernel, 'rootDir');
|
||||
|
||||
Reference in New Issue
Block a user