UpgradeTest.php 825 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Tests\Unit;
  3. use App\Modes\Upgrade;
  4. use Tests\TestCase;
  5. use Illuminate\Foundation\Testing\WithFaker;
  6. use Illuminate\Foundation\Testing\RefreshDatabase;
  7. class UpgradeTest extends TestCase
  8. {
  9. /**
  10. * 判断用户是否达到升级要求
  11. * @author lyh
  12. * @date 2019/4/18
  13. * @description
  14. */
  15. public function testRequiredLevel()
  16. {
  17. $response = Upgrade::requierdLevel($level = 7, $uid = 1);
  18. $this->assertTrue($response, sprintf('用户[%s]具备等级[%s]的升级要求', $uid, $level));
  19. }
  20. /**
  21. * 测试“判断是否达到升级条件”
  22. * @author lyh
  23. * @date 2019/4/18
  24. * @description
  25. */
  26. public function testCondition()
  27. {
  28. $response = Upgrade::condition(13);
  29. $this->assertArrayHasKey(0, $response);
  30. }
  31. }