mirror of
https://github.com/flarum/framework.git
synced 2025-05-23 15:19:56 +08:00
API Client: Use new error handling mechanism
This commit is contained in:

committed by
Daniël Klabbers

parent
6cf3c1088d
commit
ddfb2c1ec1
@ -13,7 +13,6 @@ use Flarum\Api\Controller\CreateDiscussionController;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class CreateDiscussionControllerTest extends ApiControllerTestCase
|
||||
{
|
||||
@ -70,11 +69,9 @@ class CreateDiscussionControllerTest extends ApiControllerTestCase
|
||||
$this->actor = User::find(1);
|
||||
|
||||
$data = Arr::except($this->data, 'content');
|
||||
$response = $this->callWith($data);
|
||||
|
||||
$this->expectException(ValidationException::class);
|
||||
$this->expectExceptionMessage('The given data was invalid.');
|
||||
|
||||
$this->callWith($data);
|
||||
$this->assertEquals(422, $response->getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -85,10 +82,8 @@ class CreateDiscussionControllerTest extends ApiControllerTestCase
|
||||
$this->actor = User::find(1);
|
||||
|
||||
$data = Arr::except($this->data, 'title');
|
||||
$response = $this->callWith($data);
|
||||
|
||||
$this->expectException(ValidationException::class);
|
||||
$this->expectExceptionMessage('The given data was invalid.');
|
||||
|
||||
$this->callWith($data);
|
||||
$this->assertEquals(422, $response->getStatusCode());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user