mirror of
https://github.com/flarum/framework.git
synced 2025-05-23 07:09:57 +08:00

committed by
Daniël Klabbers

parent
42a7f2f586
commit
970c0f5604
@ -11,8 +11,10 @@ namespace Flarum\Tests\integration\api\Controller;
|
||||
|
||||
use Flarum\Api\Controller\CreateUserController;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Flarum\User\Exception\PermissionDeniedException;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class CreateUserControllerTest extends ApiControllerTestCase
|
||||
{
|
||||
@ -46,11 +48,12 @@ class CreateUserControllerTest extends ApiControllerTestCase
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException \Illuminate\Validation\ValidationException
|
||||
* @expectedExceptionMessage The given data was invalid.
|
||||
*/
|
||||
public function cannot_create_user_without_data()
|
||||
{
|
||||
$this->expectException(ValidationException::class);
|
||||
$this->expectExceptionMessage('The given data was invalid.');
|
||||
|
||||
$this->callWith();
|
||||
}
|
||||
|
||||
@ -94,7 +97,6 @@ class CreateUserControllerTest extends ApiControllerTestCase
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException \Flarum\User\Exception\PermissionDeniedException
|
||||
*/
|
||||
public function disabling_sign_up_prevents_user_creation()
|
||||
{
|
||||
@ -102,6 +104,8 @@ class CreateUserControllerTest extends ApiControllerTestCase
|
||||
$settings = app(SettingsRepositoryInterface::class);
|
||||
$settings->set('allow_sign_up', false);
|
||||
|
||||
$this->expectException(PermissionDeniedException::class);
|
||||
|
||||
try {
|
||||
$this->callWith($this->data);
|
||||
} finally {
|
||||
|
Reference in New Issue
Block a user