Пример #1
0
 public function testCache()
 {
     $app = $this->app;
     $app->setup(function () use($app) {
         $app->parameter("testparam", "value");
         $app->addService("app.service", "AppService", ["@kernel.container", "%testparam", "teststring"]);
     });
     $storage = new \FabysCore\Component\Cache\Storage\FileStorage(__DIR__ . "/tests_tmp");
     $app = new Application($storage);
     $app->setup(function () use($app) {
         $app->parameter("testparam", "value");
         $app->parameter("testparam2", "v");
         $app->addService("app.service", "AppService", ["@kernel.container", "%testparam", "teststring"]);
         $app->addService("app.service2", "AppService", ["@kernel.container", "%testparam", "teststring"]);
     });
     $container = $app->getContainer();
     $this->assertFalse($container->has("app.service2"));
     $this->assertTrue($container->has("app.service"));
     $this->assertEmpty($app->parameter("testparam2"));
     $this->assertEquals("value", $app->parameter("testparam"));
 }