菜谱项目

PersonTest.php 829B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace Faker\Test\Provider\kk_KZ;
  3. use Faker\Generator;
  4. use Faker\Provider\DateTime;
  5. use Faker\Provider\kk_KZ\Person;
  6. class PersonTest extends \PHPUnit_Framework_TestCase
  7. {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function setUp()
  12. {
  13. $this->faker = new Generator();
  14. $this->faker->addProvider(new Person($this->faker));
  15. }
  16. public function testIndividualIdentificationNumberIsValid()
  17. {
  18. $birthDate = DateTime::dateTimeBetween('-30 years', '-10 years');
  19. $individualIdentificationNumber = $this->faker->individualIdentificationNumber($birthDate);
  20. $controlDigit = Person::checkSum($individualIdentificationNumber);
  21. $this->assertTrue($controlDigit === (int)substr($individualIdentificationNumber, 11, 1));
  22. }
  23. }