Esempio n. 1
0
 /**
  * @param Testify $testify
  */
 public function run(Testify &$testify)
 {
     foreach ($this->classes as $class) {
         $test = new $class($this->parser);
         if (!property_exists($test, 'source')) {
             continue;
         }
         $actual = $this->parser->parse($test->source);
         $test->source = preg_replace('/\\r/', "", $test->source);
         $actual = preg_replace('/\\r/', "", $actual);
         $test->expected = preg_replace('/\\r/', "", $test->expected);
         $table = (new VisualFeedbackTable($class))->setSource($test->source)->setExpected($test->expected)->setActual($actual);
         if ($actual === null) {
             $table->setErrors($this->parser->lexerErrors, $this->parser->parserErrors);
         } else {
             if (!empty($test->postParseDelegates)) {
                 $test->triggerPostParse($this);
             }
         }
         $this->parser->lexerErrors = array();
         $this->parser->parserErrors = array();
         $message = $table->render();
         $testify->assertEquals($actual, $test->expected, $message);
         $this->parser->clearTypes();
     }
 }
Esempio n. 2
0
 /**
  * @param Block $block
  * @param $len
  */
 public function __construct(Block $block, $len)
 {
     $this->parsed = $block->parsed;
     $this->block = $block;
     $this->count = min(max($len, 0), 6);
     $this->modifier = $block->modifier;
     $this->parser = $this->parsed->parser;
     $this->parser->addType($this);
 }
Esempio n. 3
0
 /**
  * @param Utilities\Scripts $scripts
  */
 public function __construct(Utilities\Scripts $scripts = null)
 {
     if ($scripts != null) {
         $this->scripts = $scripts;
     } else {
         $this->scripts = new Utilities\Scripts();
     }
     $this->emptyParserValue = new Parsed();
     $this->events = new WikiLingoWYSIWYG\Events();
     $this->renderer = new WikiLingoWYSIWYG\Renderer($this);
     parent::__construct();
 }
 /**
  * @param Block $block
  */
 public function __construct(Block $block)
 {
     $this->parsed = $block->parsed;
     $this->block = $block;
     $termSet = false;
     $term = '';
     $description = '';
     foreach ($this->parsed->children as $child) {
         if ($child->text == ':' && $termSet == false) {
             $termSet = true;
         } else {
             if ($termSet == false) {
                 $term .= $child->text;
             } else {
                 $description .= $child->text;
             }
         }
     }
     $this->items[] = new DescriptionListItem($term, $description);
     $this->parser = $this->parsed->parser;
     $this->parser->addType($this);
 }