Esempio n. 1
0
 function extractItems($scandir, $extension)
 {
     $parser = new WactClassAnnotationParser();
     foreach (glob("{$scandir}/*{$extension}") as $file) {
         $extractor = $this->_createArtifactsExtractor($file);
         $parser->process($extractor, file_get_contents($file));
     }
 }
Esempio n. 2
0
    function testBaseFunctionality()
    {
        $fileContent = <<<EOD
<?php
//--------------------------------------------------------------------------------
// Copyright 2004 Procata, Inc.
// Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
//--------------------------------------------------------------------------------
/**
 * @package wact
 */
//-------------------------------------------------------------------------------

/**
 * Bla-bla-bla
 * @object Article
 * @see Article.html
 * @access protected
 */
class Article extends DomainObject {
    /*
    * @private
    * @column title
    */
     var \$Title;

    /*
    * @private
    * @column body
    */
     var \$Body;

    /*
    * @property-getter isNew
    */
     function getIsNew() {
         return (time() - \$this->get('Created') < 10 * 60 * 60 * 24);
     }
}
?>
EOD;
        $listener = new ListenerStub();
        $tokenizer = new WactClassAnnotationParser();
        $tokenizer->process($listener, $fileContent);
        $this->assertEqual($listener->history, array(array('annotation', 'package', 'wact'), array('annotation', 'object', 'Article'), array('annotation', 'see', 'Article.html'), array('annotation', 'access', 'protected'), array('beginClass', 'Article', 'DomainObject'), array('annotation', 'private', NULL), array('annotation', 'column', 'title'), array('property', 'Title', 'public'), array('annotation', 'private', NULL), array('annotation', 'column', 'body'), array('property', 'Body', 'public'), array('annotation', 'property-getter', 'isNew'), array('method', 'getIsNew'), array('endClass')));
    }
Esempio n. 3
0
    function testOnlyExistingMethodsOfListenerGetInvoked()
    {
        $source = <<<EOD
<?php

class Foo{}
?>
EOD;
        $listener = new MockPartialListener();
        $listener->expectOnce('endClass');
        $tokenizer = new WactClassAnnotationParser();
        $tokenizer->process($listener, $source);
    }