Exemple #1
0
 public function testUniqueNumberGenerate()
 {
     $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'), $this->isInstanceOf($generator))->will($this->returnValue(1207));
     $type = new UniqueNumber();
     $type->setGenerator($generator);
     $type->setLocale($locale);
     $type->setUtilities($utilities);
     $type->setOption('format', 'XXxx');
     $type->validate();
     $values = array();
     $this->assertEquals(1207, $type->generate(1, $values));
 }