mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 23:23:52 +08:00
Move trait to base test class
This way, its properties can be overwritten in subclasses of `ApiControllerTestCase`. This isn't allowed when those subclasses use the trait directly.
This commit is contained in:
parent
f41ae92f1a
commit
99f9ec45f1
|
@ -11,6 +11,7 @@
|
|||
|
||||
namespace Flarum\Tests\Api\Controller;
|
||||
|
||||
use Flarum\Tests\Test\Concerns\RetrievesAuthorizedUsers;
|
||||
use Flarum\Tests\Test\TestCase;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
@ -19,6 +20,8 @@ use Psr\Http\Server\RequestHandlerInterface;
|
|||
|
||||
abstract class ApiControllerTestCase extends TestCase
|
||||
{
|
||||
use RetrievesAuthorizedUsers;
|
||||
|
||||
/**
|
||||
* @var RequestHandlerInterface
|
||||
*/
|
||||
|
|
|
@ -14,13 +14,10 @@ namespace Flarum\Tests\Api\Controller;
|
|||
use Flarum\Api\Controller\CreateDiscussionController;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Tests\Test\Concerns\RetrievesAuthorizedUsers;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class CreateDiscussionControllerTest extends ApiControllerTestCase
|
||||
{
|
||||
use RetrievesAuthorizedUsers;
|
||||
|
||||
protected $controller = CreateDiscussionController::class;
|
||||
|
||||
protected $data = [
|
||||
|
|
|
@ -13,13 +13,10 @@ namespace Flarum\Tests\Api\Controller;
|
|||
|
||||
use Flarum\Api\Controller\CreateGroupController;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\Tests\Test\Concerns\RetrievesAuthorizedUsers;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class CreateGroupControllerTest extends ApiControllerTestCase
|
||||
{
|
||||
use RetrievesAuthorizedUsers;
|
||||
|
||||
protected $controller = CreateGroupController::class;
|
||||
|
||||
protected $data = [
|
||||
|
|
|
@ -13,13 +13,10 @@ namespace Flarum\Tests\Api\Controller;
|
|||
|
||||
use Flarum\Api\Controller\CreatePostController;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Tests\Test\Concerns\RetrievesAuthorizedUsers;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class CreatePostControllerTest extends ApiControllerTestCase
|
||||
{
|
||||
use RetrievesAuthorizedUsers;
|
||||
|
||||
protected $controller = CreatePostController::class;
|
||||
|
||||
protected $data = [
|
||||
|
|
|
@ -13,12 +13,9 @@ namespace Flarum\Tests\Api\Controller;
|
|||
|
||||
use Flarum\Api\Controller\CreateTokenController;
|
||||
use Flarum\Http\AccessToken;
|
||||
use Flarum\Tests\Test\Concerns\RetrievesAuthorizedUsers;
|
||||
|
||||
class CreateTokenControllerTest extends ApiControllerTestCase
|
||||
{
|
||||
use RetrievesAuthorizedUsers;
|
||||
|
||||
protected $controller = CreateTokenController::class;
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,14 +13,11 @@ namespace Flarum\Tests\Api\Controller;
|
|||
|
||||
use Flarum\Api\Controller\CreateUserController;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Flarum\Tests\Test\Concerns\RetrievesAuthorizedUsers;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class CreateUserControllerTest extends ApiControllerTestCase
|
||||
{
|
||||
use RetrievesAuthorizedUsers;
|
||||
|
||||
protected $controller = CreateUserController::class;
|
||||
|
||||
protected $data = [
|
||||
|
|
|
@ -13,12 +13,9 @@ namespace Flarum\Tests\Api\Controller;
|
|||
|
||||
use Flarum\Api\Controller\DeleteDiscussionController;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Tests\Test\Concerns\RetrievesAuthorizedUsers;
|
||||
|
||||
class DeleteDiscussionControllerTest extends ApiControllerTestCase
|
||||
{
|
||||
use RetrievesAuthorizedUsers;
|
||||
|
||||
protected $controller = DeleteDiscussionController::class;
|
||||
protected $discussion;
|
||||
|
||||
|
|
|
@ -13,12 +13,9 @@ namespace Flarum\Tests\Api\Controller;
|
|||
|
||||
use Flarum\Api\Controller\ListDiscussionsController;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Tests\Test\Concerns\RetrievesAuthorizedUsers;
|
||||
|
||||
class ListDiscussionControllerTest extends ApiControllerTestCase
|
||||
{
|
||||
use RetrievesAuthorizedUsers;
|
||||
|
||||
protected $controller = ListDiscussionsController::class;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user