Laravel 5.6 updates
Travis config update Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
324
vendor/symfony/http-kernel/Tests/KernelTest.php
vendored
324
vendor/symfony/http-kernel/Tests/KernelTest.php
vendored
@@ -19,7 +19,6 @@ use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
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\HttpKernelInterface;
|
||||
@@ -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'));
|
||||
@@ -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();
|
||||
|
Reference in New Issue
Block a user