1
0
mirror of https://github.com/fzaninotto/Faker.git synced 2025-03-24 09:19:50 +01:00

Add test for not null digit generator

This commit is contained in:
Francois Zaninotto 2012-04-14 21:25:47 +02:00
parent 9ce05970b4
commit 606ee1a981

View File

@ -16,6 +16,12 @@ class BaseTest extends \PHPUnit_Framework_TestCase
$this->assertTrue(BaseProvider::randomDigit() >= 0);
$this->assertTrue(BaseProvider::randomDigit() < 10);
}
public function testRandomDigitNotNullReturnsNotNullDigit()
{
$this->assertTrue(BaseProvider::randomDigitNotNull() > 0);
$this->assertTrue(BaseProvider::randomDigitNotNull() < 10);
}
public function testRandomNumberReturnsInteger()
{
@ -60,6 +66,16 @@ class BaseTest extends \PHPUnit_Framework_TestCase
$this->assertRegExp('/foo\dBa\dr/', BaseProvider::numerify('foo#Ba#r'));
}
public function testNumerifyReturnsStringWithPercentageSignsReplacedByDigits()
{
$this->assertRegExp('/foo\dBa\dr/', BaseProvider::numerify('foo%Ba%r'));
}
public function testNumerifyReturnsStringWithPercentageSignsReplacedByNotNullDigits()
{
$this->assertNotEquals('0', BaseProvider::numerify('%'));
}
public function testLexifyReturnsSameStringWhenItContainsNoQuestionMark()
{
$this->assertEquals('fooBar#', BaseProvider::lexify('fooBar#'));