BaseTestCase.php 945 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace EasySwoole\Validate\tests;
  3. use EasySwoole\Validate\Validate;
  4. use PHPUnit\Framework\TestCase;
  5. /**
  6. * 基础测试环境
  7. * Class BaseTestCase
  8. *
  9. * @internal
  10. */
  11. class BaseTestCase extends TestCase
  12. {
  13. /** @var Validate */
  14. protected $validate;
  15. // 建立测试基境 引入必要文件
  16. public function setUp(): void
  17. {
  18. /*require_once dirname(__FILE__) . '/../src/Rule.php';
  19. require_once dirname(__FILE__) . '/../src/Error.php';
  20. require_once dirname(__FILE__) . '/../src/Validate.php';*/
  21. $this->freeValidate();
  22. parent::setUp();
  23. }
  24. // 验证器是否已经实例化成功
  25. public function testValidateClass()
  26. {
  27. $this->assertInstanceOf(Validate::class, $this->validate, 'validate is not instance of Validate class');
  28. }
  29. // 释放并初始化验证器
  30. public function freeValidate()
  31. {
  32. $this->validate = new Validate();
  33. }
  34. }