mirror of
https://github.com/flarum/core.git
synced 2025-07-20 00:01:17 +02:00
Tests: Rely on admin user, groups, permissions from test setup script
This commit is contained in:
committed by
Alexander Skvortsov
parent
a42ce7045d
commit
1b98526e89
@@ -11,50 +11,6 @@ namespace Flarum\Tests\integration;
|
|||||||
|
|
||||||
trait RetrievesAuthorizedUsers
|
trait RetrievesAuthorizedUsers
|
||||||
{
|
{
|
||||||
protected function adminGroup(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'id' => 1,
|
|
||||||
'name_singular' => 'Admin',
|
|
||||||
'name_plural' => 'Admins',
|
|
||||||
'color' => '#B72A2A',
|
|
||||||
'icon' => 'fas fa-wrench',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function guestGroup(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'id' => 2,
|
|
||||||
'name_singular' => 'Guest',
|
|
||||||
'name_plural' => 'Guests',
|
|
||||||
'color' => null,
|
|
||||||
'icon' => null,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function memberGroup(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'id' => 3,
|
|
||||||
'name_singular' => 'Member',
|
|
||||||
'name_plural' => 'Members',
|
|
||||||
'color' => null,
|
|
||||||
'icon' => null,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function adminUser(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'id' => 1,
|
|
||||||
'username' => 'admin',
|
|
||||||
'password' => '$2y$10$HMOAe.XaQjOimA778VmFue1OCt7tj5j0wk5vfoL/CMSJq2BQlfBV2', // BCrypt hash for "password"
|
|
||||||
'email' => 'admin@machine.local',
|
|
||||||
'is_email_confirmed' => 1,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function normalUser(): array
|
protected function normalUser(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@@ -25,7 +25,6 @@ class WithApiKeyTest extends TestCase
|
|||||||
|
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
@@ -21,18 +21,6 @@ class RequireCsrfTokenTest extends TestCase
|
|||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
|
||||||
$this->adminUser(),
|
|
||||||
],
|
|
||||||
'groups' => [
|
|
||||||
$this->adminGroup(),
|
|
||||||
],
|
|
||||||
'group_user' => [
|
|
||||||
['user_id' => 1, 'group_id' => 1],
|
|
||||||
],
|
|
||||||
'group_permission' => [
|
|
||||||
['permission' => 'viewUserList', 'group_id' => 3],
|
|
||||||
],
|
|
||||||
'api_keys' => [
|
'api_keys' => [
|
||||||
['user_id' => 1, 'key' => 'superadmin'],
|
['user_id' => 1, 'key' => 'superadmin'],
|
||||||
],
|
],
|
||||||
|
@@ -18,30 +18,6 @@ class CreateTest extends TestCase
|
|||||||
{
|
{
|
||||||
use RetrievesAuthorizedUsers;
|
use RetrievesAuthorizedUsers;
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
$this->prepareDatabase([
|
|
||||||
'users' => [
|
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser(),
|
|
||||||
],
|
|
||||||
'groups' => [
|
|
||||||
$this->adminGroup(),
|
|
||||||
$this->memberGroup(),
|
|
||||||
],
|
|
||||||
'group_user' => [
|
|
||||||
['user_id' => 1, 'group_id' => 1],
|
|
||||||
['user_id' => 2, 'group_id' => 3],
|
|
||||||
],
|
|
||||||
'group_permission' => [
|
|
||||||
['permission' => 'viewDiscussions', 'group_id' => 3],
|
|
||||||
['permission' => 'startDiscussion', 'group_id' => 3],
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
|
@@ -29,15 +29,8 @@ class DeletionTest extends TestCase
|
|||||||
['id' => 1, 'discussion_id' => 1, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>foo bar</p></t>'],
|
['id' => 1, 'discussion_id' => 1, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>foo bar</p></t>'],
|
||||||
],
|
],
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
],
|
],
|
||||||
'groups' => [
|
|
||||||
$this->adminGroup(),
|
|
||||||
],
|
|
||||||
'group_user' => [
|
|
||||||
['user_id' => 1, 'group_id' => 1],
|
|
||||||
],
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -30,13 +30,6 @@ class ListTest extends TestCase
|
|||||||
],
|
],
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
],
|
|
||||||
'groups' => [
|
|
||||||
$this->memberGroup(),
|
|
||||||
$this->guestGroup(),
|
|
||||||
],
|
|
||||||
'group_permission' => [
|
|
||||||
['permission' => 'viewDiscussions', 'group_id' => 2],
|
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@@ -37,17 +37,6 @@ class ShowTest extends TestCase
|
|||||||
],
|
],
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
],
|
|
||||||
'groups' => [
|
|
||||||
$this->guestGroup(),
|
|
||||||
$this->memberGroup(),
|
|
||||||
],
|
|
||||||
'group_user' => [
|
|
||||||
['user_id' => 2, 'group_id' => 3],
|
|
||||||
],
|
|
||||||
'group_permission' => [
|
|
||||||
['permission' => 'viewDiscussions', 'group_id' => 2],
|
|
||||||
['permission' => 'viewDiscussions', 'group_id' => 3],
|
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@@ -23,17 +23,8 @@ class ShowTest extends TestCase
|
|||||||
|
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
],
|
]
|
||||||
'groups' => [
|
|
||||||
$this->adminGroup(),
|
|
||||||
$this->memberGroup(),
|
|
||||||
],
|
|
||||||
'group_user' => [
|
|
||||||
['user_id' => 1, 'group_id' => 1],
|
|
||||||
['user_id' => 2, 'group_id' => 3],
|
|
||||||
],
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,15 +24,8 @@ class CreateTest extends TestCase
|
|||||||
|
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
],
|
],
|
||||||
'groups' => [
|
|
||||||
$this->adminGroup(),
|
|
||||||
],
|
|
||||||
'group_user' => [
|
|
||||||
['user_id' => 1, 'group_id' => 1],
|
|
||||||
],
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,16 +22,8 @@ class ListTest extends TestCase
|
|||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser(),
|
|
||||||
],
|
|
||||||
'groups' => [
|
'groups' => [
|
||||||
$this->adminGroup(),
|
$this->hiddenGroup(),
|
||||||
$this->hiddenGroup()
|
|
||||||
],
|
|
||||||
'group_user' => [
|
|
||||||
['user_id' => 1, 'group_id' => 1],
|
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -48,7 +40,8 @@ class ListTest extends TestCase
|
|||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
$data = json_decode($response->getBody()->getContents(), true);
|
$data = json_decode($response->getBody()->getContents(), true);
|
||||||
|
|
||||||
$this->assertEquals(['1'], Arr::pluck($data['data'], 'id'));
|
// The four default groups created by the installer
|
||||||
|
$this->assertEquals(['1', '2', '3', '4'], Arr::pluck($data['data'], 'id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,7 +58,8 @@ class ListTest extends TestCase
|
|||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
$data = json_decode($response->getBody()->getContents(), true);
|
$data = json_decode($response->getBody()->getContents(), true);
|
||||||
|
|
||||||
$this->assertEquals(['1', '10'], Arr::pluck($data['data'], 'id'));
|
// The four default groups created by the installer and our hidden group
|
||||||
|
$this->assertEquals(['1', '2', '3', '4', '10'], Arr::pluck($data['data'], 'id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function hiddenGroup(): array
|
protected function hiddenGroup(): array
|
||||||
|
@@ -27,15 +27,6 @@ class CreateTest extends TestCase
|
|||||||
],
|
],
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
],
|
|
||||||
'groups' => [
|
|
||||||
$this->memberGroup(),
|
|
||||||
],
|
|
||||||
'group_user' => [
|
|
||||||
['user_id' => 2, 'group_id' => 3],
|
|
||||||
],
|
|
||||||
'group_permission' => [
|
|
||||||
['permission' => 'viewDiscussions', 'group_id' => 3],
|
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@@ -23,16 +23,6 @@ class CreateTest extends TestCase
|
|||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser(),
|
|
||||||
],
|
|
||||||
'groups' => [
|
|
||||||
$this->adminGroup()
|
|
||||||
],
|
|
||||||
'group_user' => [
|
|
||||||
['user_id' => 1, 'group_id' => 1],
|
|
||||||
],
|
|
||||||
'settings' => [
|
'settings' => [
|
||||||
['key' => 'mail_driver', 'value' => 'log'],
|
['key' => 'mail_driver', 'value' => 'log'],
|
||||||
],
|
],
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
namespace Flarum\Tests\integration\api\users;
|
namespace Flarum\Tests\integration\api\users;
|
||||||
|
|
||||||
use Flarum\Group\Permission;
|
|
||||||
use Flarum\Tests\integration\RetrievesAuthorizedUsers;
|
use Flarum\Tests\integration\RetrievesAuthorizedUsers;
|
||||||
use Flarum\Tests\integration\TestCase;
|
use Flarum\Tests\integration\TestCase;
|
||||||
|
|
||||||
@@ -17,24 +16,6 @@ class ListTest extends TestCase
|
|||||||
{
|
{
|
||||||
use RetrievesAuthorizedUsers;
|
use RetrievesAuthorizedUsers;
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
$this->prepareDatabase([
|
|
||||||
'users' => [
|
|
||||||
$this->adminUser(),
|
|
||||||
],
|
|
||||||
'groups' => [
|
|
||||||
$this->adminGroup(),
|
|
||||||
$this->guestGroup(),
|
|
||||||
],
|
|
||||||
'group_user' => [
|
|
||||||
['user_id' => 1, 'group_id' => 1],
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
|
@@ -22,18 +22,8 @@ class ShowTest extends TestCase
|
|||||||
|
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
],
|
],
|
||||||
'groups' => [
|
|
||||||
$this->adminGroup()
|
|
||||||
],
|
|
||||||
'group_user' => [
|
|
||||||
['user_id' => 1, 'group_id' => 1],
|
|
||||||
],
|
|
||||||
'settings' => [
|
|
||||||
['key' => 'mail_driver', 'value' => 'log'],
|
|
||||||
],
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,20 +22,7 @@ class UpdateTest extends TestCase
|
|||||||
|
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
],
|
|
||||||
'groups' => [
|
|
||||||
$this->adminGroup(),
|
|
||||||
$this->memberGroup(),
|
|
||||||
],
|
|
||||||
'group_user' => [
|
|
||||||
['user_id' => 1, 'group_id' => 1],
|
|
||||||
['user_id' => 2, 'group_id' => 3],
|
|
||||||
],
|
|
||||||
'group_permission' => [
|
|
||||||
['permission' => 'viewUserList', 'group_id' => 3],
|
|
||||||
['permission' => 'viewDiscussions', 'group_id' => 3]
|
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@@ -35,13 +35,8 @@ class ApiControllerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser()
|
$this->normalUser()
|
||||||
],
|
],
|
||||||
'groups' => [
|
|
||||||
$this->adminGroup(),
|
|
||||||
$this->memberGroup()
|
|
||||||
],
|
|
||||||
'discussions' => [
|
'discussions' => [
|
||||||
['id' => 1, 'title' => 'Custom Discussion Title', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'first_post_id' => 0, 'comment_count' => 1, 'is_private' => 0],
|
['id' => 1, 'title' => 'Custom Discussion Title', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'first_post_id' => 0, 'comment_count' => 1, 'is_private' => 0],
|
||||||
['id' => 2, 'title' => 'Custom Discussion Title', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 3, 'first_post_id' => 0, 'comment_count' => 1, 'is_private' => 0],
|
['id' => 2, 'title' => 'Custom Discussion Title', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 3, 'first_post_id' => 0, 'comment_count' => 1, 'is_private' => 0],
|
||||||
|
@@ -31,7 +31,6 @@ class ApiSerializerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser()
|
$this->normalUser()
|
||||||
],
|
],
|
||||||
'discussions' => [
|
'discussions' => [
|
||||||
|
@@ -24,15 +24,6 @@ class EventTest extends TestCase
|
|||||||
|
|
||||||
protected function buildGroup()
|
protected function buildGroup()
|
||||||
{
|
{
|
||||||
$this->prepareDatabase([
|
|
||||||
'groups' => [
|
|
||||||
$this->adminGroup(),
|
|
||||||
],
|
|
||||||
'users' => [
|
|
||||||
$this->adminUser(),
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$bus = $this->app()->getContainer()->make(Dispatcher::class);
|
$bus = $this->app()->getContainer()->make(Dispatcher::class);
|
||||||
|
|
||||||
return $bus->dispatch(
|
return $bus->dispatch(
|
||||||
|
@@ -23,28 +23,11 @@ class MailTest extends TestCase
|
|||||||
{
|
{
|
||||||
use RetrievesAuthorizedUsers;
|
use RetrievesAuthorizedUsers;
|
||||||
|
|
||||||
protected function prepDb()
|
|
||||||
{
|
|
||||||
$this->prepareDatabase([
|
|
||||||
'users' => [
|
|
||||||
$this->adminUser(),
|
|
||||||
],
|
|
||||||
'groups' => [
|
|
||||||
$this->adminGroup(),
|
|
||||||
],
|
|
||||||
'group_user' => [
|
|
||||||
['user_id' => 1, 'group_id' => 1],
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function drivers_are_unchanged_by_default()
|
public function drivers_are_unchanged_by_default()
|
||||||
{
|
{
|
||||||
$this->prepDb();
|
|
||||||
|
|
||||||
$response = $this->send(
|
$response = $this->send(
|
||||||
$this->request('GET', '/api/mail/settings', [
|
$this->request('GET', '/api/mail/settings', [
|
||||||
'authenticatedAs' => 1,
|
'authenticatedAs' => 1,
|
||||||
@@ -76,8 +59,6 @@ class MailTest extends TestCase
|
|||||||
->driver('custom', CustomDriver::class)
|
->driver('custom', CustomDriver::class)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->prepDb();
|
|
||||||
|
|
||||||
$response = $this->send(
|
$response = $this->send(
|
||||||
$this->request('GET', '/api/mail/settings', [
|
$this->request('GET', '/api/mail/settings', [
|
||||||
'authenticatedAs' => 1,
|
'authenticatedAs' => 1,
|
||||||
@@ -100,8 +81,6 @@ class MailTest extends TestCase
|
|||||||
->driver('smtp', CustomDriver::class)
|
->driver('smtp', CustomDriver::class)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->prepDb();
|
|
||||||
|
|
||||||
$response = $this->send(
|
$response = $this->send(
|
||||||
$this->request('GET', '/api/mail/settings', [
|
$this->request('GET', '/api/mail/settings', [
|
||||||
'authenticatedAs' => 1,
|
'authenticatedAs' => 1,
|
||||||
|
@@ -29,7 +29,6 @@ class ModelTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
@@ -245,11 +244,6 @@ class ModelTest extends TestCase
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->prepDB();
|
$this->prepDB();
|
||||||
$this->prepareDatabase([
|
|
||||||
'groups' => [
|
|
||||||
$this->adminGroup()
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
|
|
||||||
$group = Group::find(1);
|
$group = Group::find(1);
|
||||||
|
|
||||||
|
@@ -26,7 +26,6 @@ class ModelUrlTest extends TestCase
|
|||||||
$userClass = User::class;
|
$userClass = User::class;
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
],
|
],
|
||||||
'settings' => [
|
'settings' => [
|
||||||
|
@@ -37,17 +37,6 @@ class ModelVisibilityTest extends TestCase
|
|||||||
],
|
],
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
],
|
|
||||||
'groups' => [
|
|
||||||
$this->guestGroup(),
|
|
||||||
$this->memberGroup(),
|
|
||||||
],
|
|
||||||
'group_user' => [
|
|
||||||
['user_id' => 2, 'group_id' => 3],
|
|
||||||
],
|
|
||||||
'group_permission' => [
|
|
||||||
['permission' => 'viewDiscussions', 'group_id' => 2],
|
|
||||||
['permission' => 'viewDiscussions', 'group_id' => 3],
|
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@@ -32,7 +32,6 @@ class PolicyTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
],
|
],
|
||||||
'discussions' => [
|
'discussions' => [
|
||||||
|
@@ -21,7 +21,6 @@ class SettingsTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser()
|
$this->normalUser()
|
||||||
],
|
],
|
||||||
'settings' => [
|
'settings' => [
|
||||||
|
@@ -22,15 +22,6 @@ class ThrottleApiTest extends TestCase
|
|||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
],
|
|
||||||
'groups' => [
|
|
||||||
$this->memberGroup(),
|
|
||||||
],
|
|
||||||
'group_user' => [
|
|
||||||
['user_id' => 2, 'group_id' => 3],
|
|
||||||
],
|
|
||||||
'group_permission' => [
|
|
||||||
['permission' => 'viewDiscussions', 'group_id' => 3],
|
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@@ -24,17 +24,10 @@ class UserTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
'users' => [
|
||||||
$this->adminUser(),
|
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
],
|
],
|
||||||
'group_permission' => [
|
|
||||||
['permission' => 'viewUserList', 'group_id' => 3]
|
|
||||||
],
|
|
||||||
'settings' => [
|
'settings' => [
|
||||||
['key' => 'display_name_driver', 'value' => 'custom'],
|
['key' => 'display_name_driver', 'value' => 'custom'],
|
||||||
],
|
|
||||||
'group_permission' => [
|
|
||||||
['permission' => 'viewUserList', 'group_id' => 3],
|
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@@ -56,8 +56,8 @@ $pipeline = $installation
|
|||||||
)
|
)
|
||||||
->adminUser(new AdminUser(
|
->adminUser(new AdminUser(
|
||||||
'admin',
|
'admin',
|
||||||
'secret',
|
'password',
|
||||||
'admin@flarum.email'
|
'admin@machine.local'
|
||||||
))
|
))
|
||||||
->settings(['mail_driver' => 'log'])
|
->settings(['mail_driver' => 'log'])
|
||||||
->build();
|
->build();
|
||||||
|
Reference in New Issue
Block a user