Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

33 rindas
721B

  1. <?php
  2. namespace Framework\Testing;
  3. use Closure;
  4. use PHPUnit\Framework\TestCase as BaseTestCase;
  5. use Throwable;
  6. class TestCase extends BaseTestCase
  7. {
  8. protected function assertExceptionThrown(Closure $risky, string $exceptionType): array
  9. {
  10. $result = null;
  11. $exception = null;
  12. try {
  13. $result = $risky();
  14. $this->fail('exception was not thrown');
  15. }
  16. catch (Throwable $e) {
  17. $actualType = $e::class;
  18. if ($actualType !== $exceptionType) {
  19. $this->fail("exception was {$actualType}, but expected {$exceptionType}");
  20. }
  21. $exception = $e;
  22. }
  23. return [$exception, $result];
  24. }
  25. }

Powered by TurnKey Linux.