[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/wact/tests/cases/annotation/ -> acceptance.test.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  
  10  require_once('limb/wact/src/annotation/WactClassAnnotationParser.class.php');
  11  require_once(dirname(__FILE__) . '/ListenerStub.class.php');
  12  
  13  class AcceptanceTestOfWactClassAnnotationParser extends UnitTestCase {
  14  
  15      function testBaseFunctionality() {
  16          $fileContent = <<<EOD
  17  <?php
  18  //--------------------------------------------------------------------------------

  19  // Copyright 2004 Procata, Inc.

  20  // Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)

  21  //--------------------------------------------------------------------------------

  22  /**

  23   * @package wact

  24   */
  25  //-------------------------------------------------------------------------------

  26  
  27  /**

  28   * Bla-bla-bla

  29   * @object Article

  30   * @see Article.html

  31   * @access protected

  32   */
  33  class Article extends DomainObject {
  34      /*

  35      * @private

  36      * @column title

  37      */
  38       var \$Title;
  39  
  40      /*

  41      * @private

  42      * @column body

  43      */
  44       var \$Body;
  45  
  46      /*

  47      * @property-getter isNew

  48      */
  49       function getIsNew() {
  50           return (time() - \$this->get('Created') < 10 * 60 * 60 * 24);
  51       }
  52  }
  53  ?>
  54  EOD;
  55          $listener = new ListenerStub;
  56          $tokenizer = new WactClassAnnotationParser();
  57  
  58          $tokenizer->process($listener, $fileContent);
  59  
  60          $this->assertEqual($listener->history,
  61                             array(array('annotation', 'package', 'wact'),
  62                                   array('annotation', 'object', 'Article'),
  63                                   array('annotation', 'see', 'Article.html'),
  64                                   array('annotation', 'access', 'protected'),
  65                                   array('beginClass', 'Article', 'DomainObject'),
  66                                   array('annotation', 'private', NULL),
  67                                   array('annotation', 'column', 'title'),
  68                                   array('property',   'Title', 'public'),
  69                                   array('annotation', 'private', NULL),
  70                                   array('annotation', 'column', 'body'),
  71                                   array('property',   'Body', 'public'),
  72                                   array('annotation', 'property-getter', 'isNew'),
  73                                   array('method',     'getIsNew'),
  74                                   array('endClass')));
  75      }
  76  }
  77  
  78  ?>


Generated: Thu Jan 8 04:06:23 2009 Cross-referenced by PHPXref 0.7