菜谱项目

CompanyTest.php 927B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace Faker\Test\Provider\ru_RU;
  3. use Faker\Generator;
  4. use Faker\Provider\ru_RU\Company;
  5. class CompanyTest extends \PHPUnit_Framework_TestCase
  6. {
  7. /**
  8. * @var Generator
  9. */
  10. private $faker;
  11. public function setUp()
  12. {
  13. $faker = new Generator();
  14. $faker->addProvider(new Company($faker));
  15. $this->faker = $faker;
  16. }
  17. public function testINN()
  18. {
  19. $this->assertRegExp('/^[0-9]{10}$/', $this->faker->inn);
  20. $this->assertEquals("77", substr($this->faker->inn("77"), 0, 2));
  21. $this->assertEquals("02", substr($this->faker->inn(2), 0, 2));
  22. }
  23. public function testKPP()
  24. {
  25. $this->assertRegExp('/^[0-9]{9}$/', $this->faker->kpp);
  26. $this->assertEquals("01001", substr($this->faker->kpp, -5, 5));
  27. $inn = $this->faker->inn;
  28. $this->assertEquals(substr($inn, 0, 4), substr($this->faker->kpp($inn), 0, 4));
  29. }
  30. }