55use BackupManager \Manager ;
66use BM \BackupManagerBundle \BMBackupManagerBundle ;
77use Nyholm \BundleTest \BaseBundleTestCase ;
8+ use Nyholm \BundleTest \CompilerPass \PublicServicePass ;
89
910class BundleInitializationTest extends BaseBundleTestCase
1011{
@@ -13,14 +14,20 @@ protected function getBundleClass()
1314 return BMBackupManagerBundle::class;
1415 }
1516
17+ protected function setUp ()
18+ {
19+ $ this ->addCompilerPass (new PublicServicePass ('|backup_manager.*| ' ));
20+ $ this ->addCompilerPass (new PublicServicePass ('|backup_manager| ' ));
21+ }
22+
23+
1624 public function testInitBundle ()
1725 {
1826 // Create a new Kernel
1927 $ kernel = $ this ->createKernel ();
2028
2129 // Add some configuration
2230 $ kernel ->addConfigFile (__DIR__ .'/config/minimal.yml ' );
23- $ kernel ->addConfigFile (__DIR__ .'/config/public_services.yml ' );
2431
2532 // Boot the kernel.
2633 $ this ->bootKernel ();
@@ -29,8 +36,22 @@ public function testInitBundle()
2936 $ container = $ this ->getContainer ();
3037
3138 // Test if you services exists
32- $ this ->assertTrue ($ container ->has ('test.backup_manager ' ));
33- $ service = $ container ->get ('test.backup_manager ' );
39+ $ this ->assertTrue ($ container ->has ('backup_manager ' ));
40+ $ service = $ container ->get ('backup_manager ' );
41+ $ this ->assertInstanceOf (Manager::class, $ service );
42+ }
43+
44+ public function testNoConfig ()
45+ {
46+ // Boot the kernel.
47+ $ this ->bootKernel ();
48+
49+ // Get the container
50+ $ container = $ this ->getContainer ();
51+
52+ // Test if you services exists
53+ $ this ->assertTrue ($ container ->has ('backup_manager ' ));
54+ $ service = $ container ->get ('backup_manager ' );
3455 $ this ->assertInstanceOf (Manager::class, $ service );
3556 }
3657
@@ -43,12 +64,11 @@ public function testNoDependencies()
4364
4465 // Add some configuration
4566 $ kernel ->addConfigFile (__DIR__ .'/config/rackspace.yml ' );
46- $ kernel ->addConfigFile (__DIR__ .'/config/public_services.yml ' );
4767
4868 // Boot the kernel.
4969 $ this ->bootKernel ();
5070
5171 // Get the container
5272 $ container = $ this ->getContainer ();
5373 }
54- }
74+ }
0 commit comments