Beispiel #1
0
 public function testGenerateWithDecimal()
 {
     $utilities = $this->getMockBuilder('Faker\\Components\\Engine\\Common\\Utilities')->disableOriginalConstructor()->getMock();
     $generator = $this->getMock('\\PHPStats\\Generator\\GeneratorInterface');
     $locale = $this->getMock('\\Faker\\Locale\\LocaleInterface');
     $utilities->expects($this->once())->method('generateRandomNum')->with($this->equalTo('xxxx.xx'))->will($this->returnValue(1234.22));
     $type = new Numeric();
     $type->setGenerator($generator);
     $type->setLocale($locale);
     $type->setUtilities($utilities);
     $type->setOption('format', 'xxxx.xx');
     $type->validate();
     $values = array();
     $this->assertEquals(1234.22, $type->generate(1, $values));
 }