Example #1
0
 public function testServices()
 {
     $workingDir = __DIR__ . '/02';
     $factory = new ContainerFactory();
     $factory->setWorkingDirectory($workingDir);
     $factory->addConfig(__DIR__ . '/02/config.neon');
     $factory->addConfig(__DIR__ . '/02/config2.neon');
     $cont = new Container();
     $cont->addService('myService', new \StdClass());
     $cont->setParameter('myContainerKey', 'myContainerValue');
     $factory->addContainerToMerge($cont);
     $container = $factory->create();
     $this->assertTrue($container->hasService('myservice'));
     $this->assertFalse($container->hasService('myArrayWhichDoesNotExists'));
     $this->assertInstanceOf('DateTime', $container->getService('myservice'));
     $this->assertEquals(date('Y-m-d', strtotime('+ 1 day')), $container->getService('myservice')->format('Y-m-d'));
 }