KernelTest.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Tests\Component\HttpKernel;
  11. use Symfony\Component\HttpKernel\Kernel;
  12. use Symfony\Component\HttpKernel\Bundle\BundleInterface;
  13. use Symfony\Component\HttpKernel\Bundle\Bundle;
  14. use Symfony\Component\HttpKernel\HttpKernelInterface;
  15. use Symfony\Component\HttpFoundation\Request;
  16. use Symfony\Component\Config\Loader\LoaderInterface;
  17. class KernelTest extends \PHPUnit_Framework_TestCase
  18. {
  19. public function testConstructor()
  20. {
  21. $env = 'test_env';
  22. $debug = true;
  23. $kernel = new KernelForTest($env, $debug);
  24. $this->assertEquals($env, $kernel->getEnvironment());
  25. $this->assertEquals($debug, $kernel->isDebug());
  26. $this->assertFalse($kernel->isBooted());
  27. $this->assertLessThanOrEqual(microtime(true), $kernel->getStartTime());
  28. $this->assertNull($kernel->getContainer());
  29. }
  30. public function testClone()
  31. {
  32. $env = 'test_env';
  33. $debug = true;
  34. $kernel = new KernelForTest($env, $debug);
  35. $clone = clone $kernel;
  36. $this->assertEquals($env, $clone->getEnvironment());
  37. $this->assertEquals($debug, $clone->isDebug());
  38. $this->assertFalse($clone->isBooted());
  39. $this->assertLessThanOrEqual(microtime(true), $clone->getStartTime());
  40. $this->assertNull($clone->getContainer());
  41. }
  42. public function testBootInitializesBundlesAndContainer()
  43. {
  44. $kernel = $this->getMockBuilder('Symfony\Tests\Component\HttpKernel\KernelForTest')
  45. ->disableOriginalConstructor()
  46. ->setMethods(array('initializeBundles', 'initializeContainer', 'getBundles'))
  47. ->getMock();
  48. $kernel->expects($this->once())
  49. ->method('initializeBundles');
  50. $kernel->expects($this->once())
  51. ->method('initializeContainer');
  52. $kernel->expects($this->once())
  53. ->method('getBundles')
  54. ->will($this->returnValue(array()));
  55. $kernel->boot();
  56. }
  57. public function testBootSetsTheContainerToTheBundles()
  58. {
  59. $bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\Bundle')
  60. ->disableOriginalConstructor()
  61. ->getMock();
  62. $bundle->expects($this->once())
  63. ->method('setContainer');
  64. $kernel = $this->getMockBuilder('Symfony\Tests\Component\HttpKernel\KernelForTest')
  65. ->disableOriginalConstructor()
  66. ->setMethods(array('initializeBundles', 'initializeContainer', 'getBundles'))
  67. ->getMock();
  68. $kernel->expects($this->once())
  69. ->method('getBundles')
  70. ->will($this->returnValue(array($bundle)));
  71. $kernel->boot();
  72. }
  73. public function testBootSetsTheBootedFlagToTrue()
  74. {
  75. $kernel = $this->getMockBuilder('Symfony\Tests\Component\HttpKernel\KernelForTest')
  76. ->disableOriginalConstructor()
  77. ->setMethods(array('initializeBundles', 'initializeContainer', 'getBundles'))
  78. ->getMock();
  79. $kernel->expects($this->once())
  80. ->method('getBundles')
  81. ->will($this->returnValue(array()));
  82. $kernel->boot();
  83. $this->assertTrue($kernel->isBooted());
  84. }
  85. public function testBootKernelSeveralTimesOnlyInitializesBundlesOnce()
  86. {
  87. $kernel = $this->getMockBuilder('Symfony\Tests\Component\HttpKernel\KernelForTest')
  88. ->disableOriginalConstructor()
  89. ->setMethods(array('initializeBundles', 'initializeContainer', 'getBundles'))
  90. ->getMock();
  91. $kernel->expects($this->once())
  92. ->method('getBundles')
  93. ->will($this->returnValue(array()));
  94. $kernel->boot();
  95. $kernel->boot();
  96. }
  97. public function testShutdownCallsShutdownOnAllBundles()
  98. {
  99. $bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\Bundle')
  100. ->disableOriginalConstructor()
  101. ->getMock();
  102. $bundle->expects($this->once())
  103. ->method('shutdown');
  104. $kernel = $this->getMockBuilder('Symfony\Tests\Component\HttpKernel\KernelForTest')
  105. ->disableOriginalConstructor()
  106. ->setMethods(array('getBundles'))
  107. ->getMock();
  108. $kernel->expects($this->once())
  109. ->method('getBundles')
  110. ->will($this->returnValue(array($bundle)));
  111. $kernel->shutdown();
  112. }
  113. public function testShutdownGivesNullContainerToAllBundles()
  114. {
  115. $bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\Bundle')
  116. ->disableOriginalConstructor()
  117. ->getMock();
  118. $bundle->expects($this->once())
  119. ->method('setContainer')
  120. ->with(null);
  121. $kernel = $this->getMockBuilder('Symfony\Tests\Component\HttpKernel\KernelForTest')
  122. ->disableOriginalConstructor()
  123. ->setMethods(array('getBundles'))
  124. ->getMock();
  125. $kernel->expects($this->once())
  126. ->method('getBundles')
  127. ->will($this->returnValue(array($bundle)));
  128. $kernel->shutdown();
  129. }
  130. public function testHandleCallsHandleOnHttpKernel()
  131. {
  132. $type = HttpKernelInterface::MASTER_REQUEST;
  133. $catch = true;
  134. $request = new Request();
  135. $httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernel')
  136. ->disableOriginalConstructor()
  137. ->getMock();
  138. $httpKernelMock
  139. ->expects($this->once())
  140. ->method('handle')
  141. ->with($request, $type, $catch);
  142. $kernel = $this->getMockBuilder('Symfony\Tests\Component\HttpKernel\KernelForTest')
  143. ->disableOriginalConstructor()
  144. ->setMethods(array('getHttpKernel'))
  145. ->getMock();
  146. $kernel->expects($this->once())
  147. ->method('getHttpKernel')
  148. ->will($this->returnValue($httpKernelMock));
  149. $kernel->handle($request, $type, $catch);
  150. }
  151. public function testHandleBootsTheKernel()
  152. {
  153. $type = HttpKernelInterface::MASTER_REQUEST;
  154. $catch = true;
  155. $request = new Request();
  156. $httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernel')
  157. ->disableOriginalConstructor()
  158. ->getMock();
  159. $kernel = $this->getMockBuilder('Symfony\Tests\Component\HttpKernel\KernelForTest')
  160. ->disableOriginalConstructor()
  161. ->setMethods(array('getHttpKernel', 'boot'))
  162. ->getMock();
  163. $kernel->expects($this->once())
  164. ->method('getHttpKernel')
  165. ->will($this->returnValue($httpKernelMock));
  166. $kernel->expects($this->once())
  167. ->method('boot');
  168. // required as this value is initialized
  169. // in the kernel constructor, which we don't call
  170. $kernel->setIsBooted(false);
  171. $kernel->handle($request, $type, $catch);
  172. }
  173. public function testStripComments()
  174. {
  175. if (!function_exists('token_get_all')) {
  176. $this->markTestSkipped();
  177. return;
  178. }
  179. $source = <<<EOF
  180. <?php
  181. /**
  182. * some class comments to strip
  183. */
  184. class TestClass
  185. {
  186. /**
  187. * some method comments to strip
  188. */
  189. public function doStuff()
  190. {
  191. // inline comment
  192. }
  193. }
  194. EOF;
  195. $expected = <<<EOF
  196. <?php
  197. class TestClass
  198. {
  199. public function doStuff()
  200. {
  201. }
  202. }
  203. EOF;
  204. $this->assertEquals($expected, Kernel::stripComments($source));
  205. }
  206. public function testIsClassInActiveBundleFalse()
  207. {
  208. $kernel = $this->getKernelMockForIsClassInActiveBundleTest();
  209. $this->assertFalse($kernel->isClassInActiveBundle('Not\In\Active\Bundle'));
  210. }
  211. public function testIsClassInActiveBundleFalseNoNamespace()
  212. {
  213. $kernel = $this->getKernelMockForIsClassInActiveBundleTest();
  214. $this->assertFalse($kernel->isClassInActiveBundle('NotNamespacedClass'));
  215. }
  216. public function testIsClassInActiveBundleTrue()
  217. {
  218. $kernel = $this->getKernelMockForIsClassInActiveBundleTest();
  219. $this->assertTrue($kernel->isClassInActiveBundle(__NAMESPACE__.'\FooBarBundle\SomeClass'));
  220. }
  221. protected function getKernelMockForIsClassInActiveBundleTest()
  222. {
  223. $bundle = new FooBarBundle();
  224. $kernel = $this->getMockBuilder('Symfony\Tests\Component\HttpKernel\KernelForTest')
  225. ->disableOriginalConstructor()
  226. ->setMethods(array('getBundles'))
  227. ->getMock();
  228. $kernel->expects($this->once())
  229. ->method('getBundles')
  230. ->will($this->returnValue(array($bundle)));
  231. return $kernel;
  232. }
  233. public function testGetRootDir()
  234. {
  235. $kernel = new KernelForTest('test', true);
  236. $this->assertEquals(__DIR__, $kernel->getRootDir());
  237. }
  238. public function testGetName()
  239. {
  240. $kernel = new KernelForTest('test', true);
  241. $this->assertEquals('HttpKernel', $kernel->getName());
  242. }
  243. public function testSerialize()
  244. {
  245. $env = 'test_env';
  246. $debug = true;
  247. $kernel = new KernelForTest($env, $debug);
  248. $expected = serialize(array($env, $debug));
  249. $this->assertEquals($expected, $kernel->serialize());
  250. }
  251. /**
  252. * @expectedException \InvalidArgumentException
  253. */
  254. public function testLocateResourceThrowsExceptionWhenNameIsNotValid()
  255. {
  256. $this->getKernelForInvalidLocateResource()->locateResource('Foo');
  257. }
  258. /**
  259. * @expectedException \RuntimeException
  260. */
  261. public function testLocateResourceThrowsExceptionWhenNameIsUnsafe()
  262. {
  263. $this->getKernelForInvalidLocateResource()->locateResource('@Foo/../bar');
  264. }
  265. /**
  266. * @expectedException \InvalidArgumentException
  267. */
  268. public function testLocateResourceThrowsExceptionWhenBundleDoesNotExist()
  269. {
  270. $this->getKernelForInvalidLocateResource()->locateResource('@Foo/config/routing.xml');
  271. }
  272. public function testLocateResourceReturnsTheFirstThatMatches()
  273. {
  274. $kernel = $this->getKernel();
  275. $kernel
  276. ->expects($this->once())
  277. ->method('getBundle')
  278. ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1'))))
  279. ;
  280. $this->assertEquals(__DIR__.'/Fixtures/Bundle1Bundle/foo.txt', $kernel->locateResource('@Bundle1/foo.txt'));
  281. }
  282. public function testLocateResourceReturnsTheFirstThatMatchesWithParent()
  283. {
  284. $parent = $this->getBundle(__DIR__.'/Fixtures/Bundle1', null, 'ParentAA');
  285. $child = $this->getBundle(__DIR__.'/Fixtures/Bundle2', 'ParentAA', 'ChildAA');
  286. $kernel = $this->getKernel();
  287. $kernel
  288. ->expects($this->any())
  289. ->method('getBundle')
  290. ->will($this->returnValue(array($child, $parent)))
  291. ;
  292. $this->assertEquals(__DIR__.'/Fixtures/Bundle2Bundle/foo.txt', $kernel->locateResource('@ParentAA/foo.txt'));
  293. $this->assertEquals(__DIR__.'/Fixtures/Bundle1Bundle/bar.txt', $kernel->locateResource('@ParentAA/bar.txt'));
  294. }
  295. public function testLocateResourceReturnsTheAllMatches()
  296. {
  297. $kernel = $this->getKernel();
  298. $kernel
  299. ->expects($this->once())
  300. ->method('getBundle')
  301. ->will($this->returnValue(array(
  302. $this->getBundle(__DIR__.'/Fixtures/Bundle1'),
  303. $this->getBundle(__DIR__.'/Fixtures/Bundle2')
  304. )))
  305. ;
  306. $this->assertEquals(array(
  307. __DIR__.'/Fixtures/Bundle1Bundle/foo.txt',
  308. __DIR__.'/Fixtures/Bundle2Bundle/foo.txt'),
  309. $kernel->locateResource('@Bundle2/foo.txt', null, false));
  310. }
  311. public function testLocateResourceReturnsAllMatchesBis()
  312. {
  313. $kernel = $this->getKernel();
  314. $kernel
  315. ->expects($this->once())
  316. ->method('getBundle')
  317. ->will($this->returnValue(array(
  318. $this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'),
  319. $this->getBundle(__DIR__.'/foobar')
  320. )))
  321. ;
  322. $this->assertEquals(
  323. array(__DIR__.'/Fixtures/Bundle1Bundle/foo.txt'),
  324. $kernel->locateResource('@Bundle1/foo.txt', null, false)
  325. );
  326. }
  327. public function testLocateResourceIgnoresDirOnNonResource()
  328. {
  329. $kernel = $this->getKernel();
  330. $kernel
  331. ->expects($this->once())
  332. ->method('getBundle')
  333. ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1'))))
  334. ;
  335. $this->assertEquals(
  336. __DIR__.'/Fixtures/Bundle1Bundle/foo.txt',
  337. $kernel->locateResource('@Bundle1/foo.txt', __DIR__.'/Fixtures')
  338. );
  339. }
  340. public function testLocateResourceReturnsTheDirOneForResources()
  341. {
  342. $kernel = $this->getKernel();
  343. $kernel
  344. ->expects($this->once())
  345. ->method('getBundle')
  346. ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'Foo'))))
  347. ;
  348. $this->assertEquals(
  349. __DIR__.'/Fixtures/Resources/FooBundle/foo.txt',
  350. $kernel->locateResource('@Foo/Resources/foo.txt', __DIR__.'/Fixtures/Resources')
  351. );
  352. }
  353. public function testLocateResourceReturnsTheDirOneForResourcesAndBundleOnes()
  354. {
  355. $kernel = $this->getKernel();
  356. $kernel
  357. ->expects($this->once())
  358. ->method('getBundle')
  359. ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1'))))
  360. ;
  361. $this->assertEquals(array(
  362. __DIR__.'/Fixtures/Resources/Bundle1Bundle/foo.txt',
  363. __DIR__.'/Fixtures/Bundle1Bundle/Resources/foo.txt'),
  364. $kernel->locateResource('@Bundle1/Resources/foo.txt', __DIR__.'/Fixtures/Resources', false)
  365. );
  366. }
  367. public function testLocateResourceOnDirectories()
  368. {
  369. $kernel = $this->getKernel();
  370. $kernel
  371. ->expects($this->exactly(2))
  372. ->method('getBundle')
  373. ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'Foo'))))
  374. ;
  375. $this->assertEquals(
  376. __DIR__.'/Fixtures/Resources/FooBundle/',
  377. $kernel->locateResource('@Foo/Resources/', __DIR__.'/Fixtures/Resources')
  378. );
  379. $this->assertEquals(
  380. __DIR__.'/Fixtures/Resources/FooBundle',
  381. $kernel->locateResource('@Foo/Resources', __DIR__.'/Fixtures/Resources')
  382. );
  383. $kernel
  384. ->expects($this->any())
  385. ->method('getBundle')
  386. ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1'))))
  387. ;
  388. $this->assertEquals(
  389. __DIR__.'/Fixtures/Bundle1Bundle/Resources/',
  390. $kernel->locateResource('@Bundle1/Resources/')
  391. );
  392. $this->assertEquals(
  393. __DIR__.'/Fixtures/Bundle1Bundle/Resources',
  394. $kernel->locateResource('@Bundle1/Resources')
  395. );
  396. }
  397. public function testInitializeBundles()
  398. {
  399. $parent = $this->getBundle(null, null, 'ParentABundle');
  400. $child = $this->getBundle(null, 'ParentABundle', 'ChildABundle');
  401. $kernel = $this->getKernel();
  402. $kernel
  403. ->expects($this->once())
  404. ->method('registerBundles')
  405. ->will($this->returnValue(array($parent, $child)))
  406. ;
  407. $kernel->initializeBundles();
  408. $map = $kernel->getBundleMap();
  409. $this->assertEquals(array($child, $parent), $map['ParentABundle']);
  410. }
  411. public function testInitializeBundlesSupportInheritanceCascade()
  412. {
  413. $grandparent = $this->getBundle(null, null, 'GrandParentBBundle');
  414. $parent = $this->getBundle(null, 'GrandParentBBundle', 'ParentBBundle');
  415. $child = $this->getBundle(null, 'ParentBBundle', 'ChildBBundle');
  416. $kernel = $this->getKernel();
  417. $kernel
  418. ->expects($this->once())
  419. ->method('registerBundles')
  420. ->will($this->returnValue(array($grandparent, $parent, $child)))
  421. ;
  422. $kernel->initializeBundles();
  423. $map = $kernel->getBundleMap();
  424. $this->assertEquals(array($child, $parent, $grandparent), $map['GrandParentBBundle']);
  425. $this->assertEquals(array($child, $parent), $map['ParentBBundle']);
  426. $this->assertEquals(array($child), $map['ChildBBundle']);
  427. }
  428. /**
  429. * @expectedException \LogicException
  430. */
  431. public function testInitializeBundlesThrowsExceptionWhenAParentDoesNotExists()
  432. {
  433. $child = $this->getBundle(null, 'FooBar', 'ChildCBundle');
  434. $kernel = $this->getKernel();
  435. $kernel
  436. ->expects($this->once())
  437. ->method('registerBundles')
  438. ->will($this->returnValue(array($child)))
  439. ;
  440. $kernel->initializeBundles();
  441. }
  442. public function testInitializeBundlesSupportsArbitraryBundleRegistrationOrder()
  443. {
  444. $grandparent = $this->getBundle(null, null, 'GrandParentCCundle');
  445. $parent = $this->getBundle(null, 'GrandParentCCundle', 'ParentCCundle');
  446. $child = $this->getBundle(null, 'ParentCCundle', 'ChildCCundle');
  447. $kernel = $this->getKernel();
  448. $kernel
  449. ->expects($this->once())
  450. ->method('registerBundles')
  451. ->will($this->returnValue(array($parent, $grandparent, $child)))
  452. ;
  453. $kernel->initializeBundles();
  454. $map = $kernel->getBundleMap();
  455. $this->assertEquals(array($child, $parent, $grandparent), $map['GrandParentCCundle']);
  456. $this->assertEquals(array($child, $parent), $map['ParentCCundle']);
  457. $this->assertEquals(array($child), $map['ChildCCundle']);
  458. }
  459. /**
  460. * @expectedException \LogicException
  461. */
  462. public function testInitializeBundlesThrowsExceptionWhenABundleIsDirectlyExtendedByTwoBundles()
  463. {
  464. $parent = $this->getBundle(null, null, 'ParentCBundle');
  465. $child1 = $this->getBundle(null, 'ParentCBundle', 'ChildC1Bundle');
  466. $child2 = $this->getBundle(null, 'ParentCBundle', 'ChildC2Bundle');
  467. $kernel = $this->getKernel();
  468. $kernel
  469. ->expects($this->once())
  470. ->method('registerBundles')
  471. ->will($this->returnValue(array($parent, $child1, $child2)))
  472. ;
  473. $kernel->initializeBundles();
  474. }
  475. /**
  476. * @expectedException \LogicException
  477. */
  478. public function testInitializeBundleThrowsExceptionWhenRegisteringTwoBundlesWithTheSameName()
  479. {
  480. $fooBundle = $this->getBundle(null, null, 'FooBundle', 'DuplicateName');
  481. $barBundle = $this->getBundle(null, null, 'BarBundle', 'DuplicateName');
  482. $kernel = $this->getKernel();
  483. $kernel
  484. ->expects($this->once())
  485. ->method('registerBundles')
  486. ->will($this->returnValue(array($fooBundle, $barBundle)))
  487. ;
  488. $kernel->initializeBundles();
  489. }
  490. protected function getBundle($dir = null, $parent = null, $className = null, $bundleName = null)
  491. {
  492. $bundle = $this
  493. ->getMockBuilder('Symfony\Tests\Component\HttpKernel\BundleForTest')
  494. ->setMethods(array('getPath', 'getParent', 'getName'))
  495. ->disableOriginalConstructor()
  496. ;
  497. if ($className) {
  498. $bundle->setMockClassName($className);
  499. }
  500. $bundle = $bundle->getMockForAbstractClass();
  501. $bundle
  502. ->expects($this->any())
  503. ->method('getName')
  504. ->will($this->returnValue(is_null($bundleName) ? get_class($bundle) : $bundleName))
  505. ;
  506. $bundle
  507. ->expects($this->any())
  508. ->method('getPath')
  509. ->will($this->returnValue(strtr($dir, '\\', '/')))
  510. ;
  511. $bundle
  512. ->expects($this->any())
  513. ->method('getParent')
  514. ->will($this->returnValue($parent))
  515. ;
  516. return $bundle;
  517. }
  518. protected function getKernel()
  519. {
  520. return $this
  521. ->getMockBuilder('Symfony\Tests\Component\HttpKernel\KernelForTest')
  522. ->setMethods(array('getBundle', 'registerBundles'))
  523. ->disableOriginalConstructor()
  524. ->getMock()
  525. ;
  526. }
  527. protected function getKernelForInvalidLocateResource()
  528. {
  529. return $this
  530. ->getMockBuilder('Symfony\Component\HttpKernel\Kernel')
  531. ->disableOriginalConstructor()
  532. ->getMockForAbstractClass()
  533. ;
  534. }
  535. }
  536. class KernelForTest extends Kernel
  537. {
  538. public function getBundleMap()
  539. {
  540. return $this->bundleMap;
  541. }
  542. public function registerBundles()
  543. {
  544. }
  545. public function registerBundleDirs()
  546. {
  547. }
  548. public function registerContainerConfiguration(LoaderInterface $loader)
  549. {
  550. }
  551. public function initializeBundles()
  552. {
  553. parent::initializeBundles();
  554. }
  555. public function isBooted()
  556. {
  557. return $this->booted;
  558. }
  559. public function setIsBooted($value)
  560. {
  561. $this->booted = (bool) $value;
  562. }
  563. }
  564. abstract class BundleForTest implements BundleInterface
  565. {
  566. // We can not extend Symfony\Component\HttpKernel\Bundle\Bundle as we want to mock getName() which is final
  567. }
  568. class FooBarBundle extends Bundle
  569. {
  570. // We need a full namespaced bundle instance to test isClassInActiveBundle
  571. }