菜谱项目

CompanyTest.php 581B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace Faker\Test\Provider\en_ZA;
  3. use Faker\Generator;
  4. use Faker\Provider\en_ZA\Company;
  5. class CompanyTest extends \PHPUnit_Framework_TestCase
  6. {
  7. private $faker;
  8. public function setUp()
  9. {
  10. $faker = new Generator();
  11. $faker->addProvider(new Company($faker));
  12. $this->faker = $faker;
  13. }
  14. public function testGenerateValidCompanyNumber()
  15. {
  16. $companyRegNo = $this->faker->companyNumber();
  17. $this->assertEquals(14, strlen($companyRegNo));
  18. $this->assertRegExp('#^\d{4}/\d{6}/\d{2}$#', $companyRegNo);
  19. }
  20. }