Author: Victor Farazdagi
Inheritance: extends Base, implements Phrozn\Registry\Dao
コード例 #1
0
ファイル: ContainerTest.php プロジェクト: JamieS/phrozn
 public function testSave()
 {
     $dao = new Dao();
     $path = dirname(__FILE__) . '/project';
     $dao->setProjectPath($path);
     $this->assertSame($path . '/.phrozn', $dao->getProjectPath());
     $container = new Container($dao);
     $this->assertSame($dao, $container->getDao());
     $container->set('bundle', 'test.me')->set('template', array(1, 2, 3));
     @unlink($path . '/.phrozn/.registry');
     $this->assertFalse(file_exists($path . '/.phrozn/.registry'));
     $container->save();
     $this->assertTrue(file_exists($path . '/.phrozn/.registry'));
     $this->assertSame(file_get_contents($path . '/registry.serialized'), file_get_contents($path . '/.phrozn/.registry'));
     unset($container);
     $container = new Container($dao);
     $this->assertNull($container->get('bundle'));
     $this->assertNull($container->get('template'));
     $container->read();
     $this->assertSame('test.me', $container->get('bundle'));
     $this->assertSame(array(1, 2, 3), $container->get('template'));
 }
コード例 #2
0
ファイル: Service.php プロジェクト: JamieS/phrozn
 /**
  * Get registry container
  *
  * @return \Phrozn\Registry\Container
  */
 public function getRegistryContainer()
 {
     if (null === $this->registryContainer) {
         $dao = new RegistryDao();
         $dao->setProjectPath($this->getProjectPath())->setOutputFile('.bundles');
         $this->registryContainer = new RegistryContainer($dao);
         $this->registryContainer->read();
         //(re)read container values
     } else {
         // update project path
         $this->registryContainer->getDao()->setProjectPath($this->getProjectPath());
     }
     return $this->registryContainer;
 }
コード例 #3
0
ファイル: SerializedTest.php プロジェクト: JamieS/phrozn
 public function testNoPathException()
 {
     $this->setExpectedException('Exception', 'No project path provided');
     $container = new Container();
     $dao = new Dao($container);
     $dao->save();
 }