Ejemplo n.º 1
0
 public function testModifierAddedToParser()
 {
     $type = $this->getParserTypeMock();
     $modifier = $this->getModifierMock();
     $this->builder->addModifier($modifier);
     $parser = $this->builder->build($type, []);
     $this->assertSame(1, sizeof($parser->getModifiers()));
     $this->assertContains($modifier, $parser->getModifiers());
 }
Ejemplo n.º 2
0
 /**
  * @param ScraperEntity $scraper
  *
  * @return ParserInterface
  */
 protected function createParser(ScraperEntity $scraper)
 {
     $options = array_merge(['scraper' => $scraper], $scraper->getParserOptions());
     $parserType = $this->getParserType($scraper->getParser());
     $builder = new ParserBuilder($this->eventDispatcher);
     return $builder->build($parserType, $options);
 }