/**
  * Returns the parent node.
  *
  * @return Faker\Components\Engine\Entity\Builder\NodeBuilder
  */
 public function end()
 {
     return parent::end();
 }
 public function testRandomGetNode()
 {
     $name = 'fieldA';
     $utilities = $this->getMockBuilder('Faker\\Components\\Engine\\Common\\Utilities')->disableOriginalConstructor()->getMock();
     $generator = $this->getMock('\\PHPStats\\Generator\\GeneratorInterface');
     $locale = $this->getMock('\\Faker\\Locale\\LocaleInterface');
     $event = $this->getMockBuilder('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface')->getMock();
     $database = $this->getMockBuilder('Doctrine\\DBAL\\Connection')->disableOriginalConstructor()->getMock();
     $template = $this->getMockBuilder('Faker\\Components\\Templating\\Loader')->disableOriginalConstructor()->getMock();
     $repo = $this->getMockBuilder('Faker\\Components\\Engine\\Common\\TypeRepository')->getMock();
     $randomBuilder = new SelectorRandomBuilder($name, $event, $repo, $utilities, $generator, $locale, $database, $template);
     $this->assertInstanceOF('Faker\\Components\\Engine\\Common\\Composite\\SelectorNode', $randomBuilder->getNode());
     $this->assertInstanceOF('Faker\\Components\\Engine\\Common\\Selector\\RandomSelector', $randomBuilder->getNode()->getInternal());
 }
Ejemplo n.º 3
0
 /**
  *  Return a builder that picks a type at random from the supplied list
  *
  *  @access public
  *  @return \Faker\Components\Engine\Entity\Builder\SelectorRandomBuilder
  */
 public function selectorRandom()
 {
     $node = new SelectorRandomBuilder('SelectorRandom', $this->eventDispatcher, $this->repo, $this->utilities, $this->generator, $this->locale, $this->database, $this->templateLoader);
     $node->setParent($this);
     return $node;
 }