コード例 #1
0
 public function testTypePropertiesSet()
 {
     $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();
     $type = new RangeTypeDefinition();
     $type->eventDispatcher($event);
     $type->database($database);
     $type->locale($locale);
     $type->utilities($utilities);
     $type->generator($generator);
     $typeNode = $type->startAtValue(100)->stopAtValue(300)->incrementByValue(10)->useRandomIncrement(true)->incrementWindow(1)->roundToXDecimals(0)->getNode();
     $interalType = $typeNode->getType();
     $this->assertEquals(100, $interalType->getOption('min'));
     $this->assertEquals(300, $interalType->getOption('max'));
     $this->assertEquals(10, $interalType->getOption('step'));
     $this->assertEquals(true, $interalType->getOption('windowStep'));
     $this->assertEquals(0, $interalType->getOption('round'));
     $this->assertEquals(true, $interalType->getOption('random'));
     $this->assertEquals($generator, $interalType->getGenerator());
     $this->assertEquals($locale, $interalType->getLocale());
     $this->assertEquals($utilities, $interalType->getUtilities());
 }