public function testWeightGetNode()
 {
     $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();
     $weightBuilder = new SelectorWeightBuilder($name, $event, $repo, $utilities, $generator, $locale, $database, $template);
     $weightBuilder->weight(1.0);
     $this->assertInstanceOF('Faker\\Components\\Engine\\Common\\Composite\\SelectorNode', $weightBuilder->getNode());
     $this->assertInstanceOF('Faker\\Components\\Engine\\Common\\Selector\\PickSelector', $weightBuilder->getNode()->getInternal());
     $this->assertEquals(1.0, $weightBuilder->getNode()->getInternal()->getOption('probability'));
 }
 public function end()
 {
     return parent::end();
 }
Esempio n. 3
0
 /**
  *  Return a builder that allows alternation that preferences the left or right value.
  *
  *  @access public
  *  @return \Faker\Components\Engine\Entity\Builder\SelectorWeightBuilder
  */
 public function selectorWeightAlternate()
 {
     $node = new SelectorWeightBuilder('SelectorRandom', $this->eventDispatcher, $this->repo, $this->utilities, $this->generator, $this->locale, $this->database, $this->templateLoader);
     $node->setParent($this);
     return $node;
 }