/** * Test loading the simple dynamic template with manifest. */ function testManifestLoad() { // $this->dump_files("testManifestLoad start"); $folder = DynamicTemplate::get()->filter("Name", "tmp-TemplateWithManifest")->First(); $manifest = $folder->getManifest(); $this->assertTrue(isset($manifest->actions['index']), "manifest has index action"); $this->assertEquals(count($manifest->actions), 1, "manifest has one action"); $this->assertTrue(isset($manifest->actions['index']['templates']), "manifest default action has templates"); $this->assertEquals(count($manifest->actions['index']['templates']), 1, "manifest default action has one template"); $this->assertTrue(strpos($manifest->actions['index']['templates'][0]['path'], 'test.ss') !== FALSE, "manifest default action has test.ss"); // Test manifest is cached. $m = unserialize($folder->ManifestCache); $this->assertTrue(is_object($m) && is_a($m, 'DynamicTemplateManifest'), "Cached manifest is a DynamicTemplateManifest"); $this->assertTrue(isset($m->actions["index"]), "Cached manifest has index"); }
/** * Determine if a template of this name already exists. */ protected static function template_exists($name) { return DynamicTemplate::get()->filter("Name", $name)->Count() > 0; }