菜谱项目

CompanyTest.php 588B

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