a normal reply - too-obscure
'],
]
]);
-
- $this->app();
}
/**
@@ -50,8 +53,6 @@ class PolicyTest extends TestCase
*/
public function unrelated_user_cant_hide_discussion_by_default()
{
- $this->prepDb();
-
$response = $this->send(
$this->request('PATCH', '/api/discussions/1', $this->hideQuery)
);
@@ -69,8 +70,6 @@ class PolicyTest extends TestCase
->modelPolicy(Discussion::class, CustomPolicy::class)
);
- $this->prepDb();
-
$response = $this->send(
$this->request('PATCH', '/api/discussions/1', $this->hideQuery)
);
@@ -89,8 +88,6 @@ class PolicyTest extends TestCase
->modelPolicy(Discussion::class, CustomPolicy::class)
);
- $this->prepDb();
-
$response = $this->send(
$this->request('PATCH', '/api/discussions/1', $this->hideQuery)
);
@@ -110,8 +107,6 @@ class PolicyTest extends TestCase
->modelPolicy(Discussion::class, CustomPolicy::class)
);
- $this->prepDb();
-
$response = $this->send(
$this->request('PATCH', '/api/discussions/1', $this->hideQuery)
);
@@ -132,8 +127,6 @@ class PolicyTest extends TestCase
->modelPolicy(Discussion::class, ForceAllowHidePolicy::class)
);
- $this->prepDb();
-
$response = $this->send(
$this->request('PATCH', '/api/discussions/1', $this->hideQuery)
);
@@ -146,7 +139,7 @@ class PolicyTest extends TestCase
*/
public function regular_user_cant_start_discussions_by_default()
{
- $this->prepDb();
+ $this->app();
$user = User::find(2);
@@ -163,7 +156,7 @@ class PolicyTest extends TestCase
->globalPolicy(GlobalStartDiscussionPolicy::class)
);
- $this->prepDb();
+ $this->app();
$user = User::find(2);
@@ -180,7 +173,7 @@ class PolicyTest extends TestCase
->globalPolicy(GlobalStartDiscussionPolicy::class)
);
- $this->prepDb();
+ $this->app();
$user = User::find(2);
@@ -192,7 +185,7 @@ class PolicyTest extends TestCase
*/
public function unrelated_user_cant_hide_post_by_default()
{
- $this->prepDb();
+ $this->app();
$user = User::find(2);
@@ -207,7 +200,7 @@ class PolicyTest extends TestCase
$this->extend(
(new Extend\Policy)->modelPolicy(CommentPost::class, CommentPostChildClassPolicy::class)
);
- $this->prepDb();
+ $this->app();
$user = User::find(2);
@@ -223,7 +216,7 @@ class PolicyTest extends TestCase
(new Extend\Policy)->modelPolicy(Post::class, PostParentClassPolicy::class),
(new Extend\Policy)->modelPolicy(CommentPost::class, CommentPostChildClassPolicy::class)
);
- $this->prepDb();
+ $this->app();
$user = User::find(2);
diff --git a/tests/integration/extenders/SettingsTest.php b/tests/integration/extenders/SettingsTest.php
index 77c41d70e..d279bfd27 100644
--- a/tests/integration/extenders/SettingsTest.php
+++ b/tests/integration/extenders/SettingsTest.php
@@ -17,8 +17,13 @@ class SettingsTest extends TestCase
{
use RetrievesAuthorizedUsers;
- protected function prepDb()
+ /**
+ * @inheritDoc
+ */
+ protected function setUp(): void
{
+ parent::setUp();
+
$this->prepareDatabase([
'users' => [
$this->normalUser()
@@ -35,8 +40,6 @@ class SettingsTest extends TestCase
*/
public function custom_setting_isnt_serialized_by_default()
{
- $this->prepDb();
-
$response = $this->send(
$this->request('GET', '/api', [
'authenticatedAs' => 1,
@@ -58,8 +61,6 @@ class SettingsTest extends TestCase
->serializeToForum('customPrefix.customSetting', 'custom-prefix.custom_setting')
);
- $this->prepDb();
-
$response = $this->send(
$this->request('GET', '/api', [
'authenticatedAs' => 1,
@@ -84,8 +85,6 @@ class SettingsTest extends TestCase
})
);
- $this->prepDb();
-
$response = $this->send(
$this->request('GET', '/api', [
'authenticatedAs' => 1,
@@ -108,8 +107,6 @@ class SettingsTest extends TestCase
->serializeToForum('customPrefix.customSetting2', 'custom-prefix.custom_setting2', CustomInvokableClass::class)
);
- $this->prepDb();
-
$response = $this->send(
$this->request('GET', '/api', [
'authenticatedAs' => 1,
@@ -132,8 +129,6 @@ class SettingsTest extends TestCase
->serializeToForum('customPrefix.noCustomSetting', 'custom-prefix.no_custom_setting', null, 'customDefault')
);
- $this->prepDb();
-
$response = $this->send(
$this->request('GET', '/api', [
'authenticatedAs' => 1,
@@ -158,8 +153,6 @@ class SettingsTest extends TestCase
}, 'customDefault')
);
- $this->prepDb();
-
$response = $this->send(
$this->request('GET', '/api', [
'authenticatedAs' => 1,
diff --git a/tests/integration/extenders/ThrottleApiTest.php b/tests/integration/extenders/ThrottleApiTest.php
index 33a4853e7..b2e88798b 100644
--- a/tests/integration/extenders/ThrottleApiTest.php
+++ b/tests/integration/extenders/ThrottleApiTest.php
@@ -17,8 +17,13 @@ class ThrottleApiTest extends TestCase
{
use RetrievesAuthorizedUsers;
- protected function prepDb(): void
+ /**
+ * @inheritDoc
+ */
+ protected function setUp(): void
{
+ parent::setUp();
+
$this->prepareDatabase([
'users' => [
$this->normalUser(),
@@ -31,8 +36,6 @@ class ThrottleApiTest extends TestCase
*/
public function list_discussions_not_restricted_by_default()
{
- $this->prepDb();
-
$response = $this->send($this->request('GET', '/api/discussions', ['authenticatedAs' => 2]));
$this->assertEquals(200, $response->getStatusCode());
@@ -49,8 +52,6 @@ class ThrottleApiTest extends TestCase
}
}));
- $this->prepDb();
-
$response = $this->send($this->request('GET', '/api/discussions', ['authenticatedAs' => 2]));
$this->assertEquals(429, $response->getStatusCode());
@@ -74,10 +75,6 @@ class ThrottleApiTest extends TestCase
})
);
- $this->prepDb();
-
- $this->prepDb();
-
$response = $this->send($this->request('GET', '/api/discussions', ['authenticatedAs' => 2]));
$this->assertEquals(200, $response->getStatusCode());
diff --git a/tests/integration/extenders/UserTest.php b/tests/integration/extenders/UserTest.php
index 02ce5f00e..497bc7f95 100644
--- a/tests/integration/extenders/UserTest.php
+++ b/tests/integration/extenders/UserTest.php
@@ -20,8 +20,13 @@ class UserTest extends TestCase
{
use RetrievesAuthorizedUsers;
- protected function prepDb()
+ /**
+ * @inheritDoc
+ */
+ protected function setUp(): void
{
+ parent::setUp();
+
$this->prepareDatabase([
'users' => [
$this->normalUser(),
@@ -30,8 +35,6 @@ class UserTest extends TestCase
['key' => 'display_name_driver', 'value' => 'custom'],
]
]);
-
- $this->app();
}
protected function registerTestPreference()
@@ -47,7 +50,7 @@ class UserTest extends TestCase
*/
public function username_display_name_driver_used_by_default()
{
- $this->prepDb();
+ $this->app();
$user = User::find(1);
@@ -64,7 +67,7 @@ class UserTest extends TestCase
->displayNameDriver('custom', CustomDisplayNameDriver::class)
);
- $this->prepDb();
+ $this->app();
$user = User::find(1);
@@ -76,7 +79,8 @@ class UserTest extends TestCase
*/
public function user_has_permissions_for_expected_groups_if_no_processors_added()
{
- $this->prepDb();
+ $this->app();
+
$user = User::find(2);
$this->assertContains('viewUserList', $user->getPermissions());
@@ -93,7 +97,8 @@ class UserTest extends TestCase
});
}));
- $this->prepDb();
+ $this->app();
+
$user = User::find(2);
$this->assertNotContains('viewUserList', $user->getPermissions());
@@ -106,7 +111,8 @@ class UserTest extends TestCase
{
$this->extend((new Extend\User)->permissionGroups(CustomGroupProcessorClass::class));
- $this->prepDb();
+ $this->app();
+
$user = User::find(2);
$this->assertNotContains('viewUserList', $user->getPermissions());
@@ -118,7 +124,8 @@ class UserTest extends TestCase
public function can_add_user_preference()
{
$this->registerTestPreference();
- $this->prepDb();
+
+ $this->app();
/** @var User $user */
$user = User::find(2);
@@ -131,7 +138,8 @@ class UserTest extends TestCase
public function can_store_user_preference()
{
$this->registerTestPreference();
- $this->prepDb();
+
+ $this->app();
/** @var User $user */
$user = User::find(2);
@@ -147,7 +155,8 @@ class UserTest extends TestCase
public function storing_user_preference_modified_by_transformer()
{
$this->registerTestPreference();
- $this->prepDb();
+
+ $this->app();
/** @var User $user */
$user = User::find(2);