public function testSave() { $dao = new Dao(); $path = dirname(__FILE__) . '/project'; $dao->setProjectPath($path); $this->assertSame($path . '/.phrekyll', $dao->getProjectPath()); $container = new Container($dao); $this->assertSame($dao, $container->getDao()); $container->set('bundle', 'test.me')->set('template', array(1, 2, 3)); @unlink($path . '/.phrekyll/.registry'); $this->assertFalse(file_exists($path . '/.phrekyll/.registry')); $container->save(); $this->assertTrue(file_exists($path . '/.phrekyll/.registry')); $this->assertSame(file_get_contents($path . '/registry.serialized'), file_get_contents($path . '/.phrekyll/.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')); }
public function testNoPathException() { $this->setExpectedException('RuntimeException', 'No project path provided'); $container = new Container(); $dao = new Dao($container); $dao->save(); }