Example #1
0
 function testAllowRegiserTagAliases()
 {
     WactCompiler::writeFile($file = WACT_CACHE_DIR . '/tag_extractor_file.tag.php', $context = 'whatever');
     $dictionary = new WactTagDictionary();
     $extractor = new WactTagInfoExtractor($dictionary, $file);
     $extractor->annotation('tag', 'my_tag, my_super_tag');
     $extractor->annotation('runat', 'server');
     $extractor->beginClass('MyStubExtractorTag', 'CompilerTag');
     $tag_info1 = $dictionary->getWactTagInfo('my_tag');
     $this->assertEqual($tag_info1->Runat, 'server');
     $tag_info2 = $dictionary->getWactTagInfo('my_super_tag');
     $this->assertEqual($tag_info2->Runat, 'server');
     unlink(WACT_CACHE_DIR . '/tag_extractor_file.tag.php');
 }
Example #2
0
 protected function _initializeDictionary($name, $dictionary_class, $type)
 {
     $dictionary = null;
     $cache_file = $this->config->getCacheDir() . "/{$dictionary_class}.cache";
     if (!$this->config->isForceScan() && file_exists($cache_file)) {
         $dictionary = unserialize(file_get_contents($cache_file));
         $this->dictionaries[$name] = $dictionary;
     }
     if (!is_object($dictionary)) {
         // For testing purposes
         if (isset($GLOBALS[$name . '_wact_dictionary'])) {
             $dictionary = $GLOBALS[$name . '_wact_dictionary'];
             $dictionary->setConfig($this->config);
         } else {
             $dictionary = new $dictionary_class($this->config);
         }
         $this->dictionaries[$name] = $dictionary;
         $dictionary->buildDictionary('.' . $type . '.php');
         WactCompiler::writeFile($cache_file, serialize($dictionary));
     }
     // For testing purposes
     $GLOBALS[$name . '_wact_dictionary'] = $dictionary;
     return $dictionary;
 }