Ejemplo n.º 1
0
 function parseTemplate($file_name, $root_node)
 {
     if (!($source_file_path = $this->template_locator->locateSourceTemplate($file_name))) {
         throw new lmbMacroException('Template source file not found', array('file_name' => $file_name));
     }
     $parser = new lmbMacroParser($this->tree_builder, $this->tag_dictionary);
     $parser->parse($source_file_path, $root_node);
 }
Ejemplo n.º 2
0
 function testParse_raiseExceptionWhenFileNotExist()
 {
     $tree_builder = new MockMacroTreeBuilder();
     $tag_dictionary = new MockMacroTagDictionary();
     $parser = new lmbMacroParser($tree_builder, $tag_dictionary);
     $location = new lmbMacroSourceLocation($parent_file = 'caller', $line = 42);
     $parent_node = new lmbMacroNode($location);
     try {
         $parser->parse($not_existed_file = 'not_exist', $parent_node);
         $this->fail();
     } catch (lmbFileNotFoundException $e) {
         if ($this->pass()) {
             $this->assertIdentical($e->getFilePath(), $not_existed_file);
             $this->assertIdentical($e->getParam('parent_file'), $parent_file);
             $this->assertIdentical($e->getParam('parent_file_line'), $line);
         }
     }
 }