|
12 | 12 | namespace Symfony\Component\HttpKernel\Tests\Bundle;
|
13 | 13 |
|
14 | 14 | use Symfony\Component\DependencyInjection\ContainerBuilder;
|
| 15 | +use Symfony\Component\HttpKernel\Bundle\Bundle; |
15 | 16 | use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionNotValidBundle\ExtensionNotValidBundle;
|
16 | 17 | use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\ExtensionPresentBundle;
|
17 | 18 | use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionAbsentBundle\ExtensionAbsentBundle;
|
@@ -66,4 +67,33 @@ public function testHttpKernelRegisterCommandsIgnoresCommandsThatAreRegisteredAs
|
66 | 67 | $bundle->setContainer($container);
|
67 | 68 | $bundle->registerCommands($application);
|
68 | 69 | }
|
| 70 | + |
| 71 | + public function testBundleNameIsGuessedFromClass() |
| 72 | + { |
| 73 | + $bundle = new GuessedNameBundle(); |
| 74 | + |
| 75 | + $this->assertSame('Symfony\Component\HttpKernel\Tests\Bundle', $bundle->getNamespace()); |
| 76 | + $this->assertSame('GuessedNameBundle', $bundle->getName()); |
| 77 | + } |
| 78 | + |
| 79 | + public function testBundleNameCanBeExplicitlyProvided() |
| 80 | + { |
| 81 | + $bundle = new NamedBundle(); |
| 82 | + |
| 83 | + $this->assertSame('ExplicitlyNamedBundle', $bundle->getName()); |
| 84 | + $this->assertSame('Symfony\Component\HttpKernel\Tests\Bundle', $bundle->getNamespace()); |
| 85 | + $this->assertSame('ExplicitlyNamedBundle', $bundle->getName()); |
| 86 | + } |
| 87 | +} |
| 88 | + |
| 89 | +class NamedBundle extends Bundle |
| 90 | +{ |
| 91 | + public function __construct() |
| 92 | + { |
| 93 | + $this->name = 'ExplicitlyNamedBundle'; |
| 94 | + } |
| 95 | +} |
| 96 | + |
| 97 | +class GuessedNameBundle extends Bundle |
| 98 | +{ |
69 | 99 | }
|
0 commit comments