diff --git a/framework/core/tests/Flarum/Api/Handler/IlluminateValidationExceptionHandlerTest.php b/framework/core/tests/Flarum/Api/Handler/IlluminateValidationExceptionHandlerTest.php index 2478f4a7b..dac27528d 100644 --- a/framework/core/tests/Flarum/Api/Handler/IlluminateValidationExceptionHandlerTest.php +++ b/framework/core/tests/Flarum/Api/Handler/IlluminateValidationExceptionHandlerTest.php @@ -25,7 +25,7 @@ class IlluminateValidationExceptionHandlerTest extends TestCase public function test_it_creates_the_desired_output() { $this->markTestIncomplete(); - + $exception = new ValidationException(['field' => ['Some error']]); $response = $this->handler->handle($exception); diff --git a/framework/core/tests/Flarum/Api/Handler/InvalidConfirmationTokenExceptionHandlerTest.php b/framework/core/tests/Flarum/Api/Handler/InvalidConfirmationTokenExceptionHandlerTest.php new file mode 100644 index 000000000..0951581c2 --- /dev/null +++ b/framework/core/tests/Flarum/Api/Handler/InvalidConfirmationTokenExceptionHandlerTest.php @@ -0,0 +1,30 @@ +handler = new InvalidConfirmationTokenExceptionHandler; + } + + public function test_it_handles_recognisable_exceptions() + { + $this->assertFalse($this->handler->manages(new \Exception)); + $this->assertTrue($this->handler->manages(new InvalidConfirmationTokenException)); + } + + public function test_output() + { + $response = $this->handler->handle(new InvalidConfirmationTokenException); + + $this->assertEquals(403, $response->getStatus()); + $this->assertEquals([['code' => 'invalid_confirmation_token']], $response->getErrors()); + } +}