PersonTest.php 839 B

12345678910111213141516171819202122232425262728293031
  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. use PHPUnit\Framework\TestCase;
  7. class PersonTest extends TestCase
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function setUp()
  13. {
  14. $this->faker = new Generator();
  15. $this->faker->addProvider(new Person($this->faker));
  16. }
  17. public function testIndividualIdentificationNumberIsValid()
  18. {
  19. $birthDate = DateTime::dateTimeBetween('-30 years', '-10 years');
  20. $individualIdentificationNumber = $this->faker->individualIdentificationNumber($birthDate);
  21. $controlDigit = Person::checkSum($individualIdentificationNumber);
  22. $this->assertSame($controlDigit, (int)substr($individualIdentificationNumber, 11, 1));
  23. }
  24. }