From 1a49dfc97975203f8ce44d82ac3cfe9c931e40de Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com> Date: Tue, 1 Dec 2020 19:33:24 -0500 Subject: [PATCH] Use process isolation for integration tests --- .../integration/extenders/ThrottleApiTest.php | 27 ++++++++++++------- framework/core/tests/phpunit.integration.xml | 2 +- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/framework/core/tests/integration/extenders/ThrottleApiTest.php b/framework/core/tests/integration/extenders/ThrottleApiTest.php index a384eeaf7..ffa2886bd 100644 --- a/framework/core/tests/integration/extenders/ThrottleApiTest.php +++ b/framework/core/tests/integration/extenders/ThrottleApiTest.php @@ -57,6 +57,9 @@ class ThrottleApiTest extends TestCase return true; } })); + + $this->prepDb(); + $response = $this->send($this->request('GET', '/api/discussions', ['authenticatedAs' => 2])); $this->assertEquals(429, $response->getStatusCode()); @@ -67,16 +70,20 @@ class ThrottleApiTest extends TestCase */ public function false_overrides_true_for_evaluating_throttlers() { - $this->extend((new Extend\ThrottleApi)->set('blockListDiscussions', function ($request) { - if ($request->getAttribute('routeName') === 'discussions.index') { - return true; - } - })); - $this->extend((new Extend\ThrottleApi)->set('blockListDiscussionsOverride', function ($request) { - if ($request->getAttribute('routeName') === 'discussions.index') { - return false; - } - })); + $this->extend( + (new Extend\ThrottleApi)->set('blockListDiscussions', function ($request) { + if ($request->getAttribute('routeName') === 'discussions.index') { + return true; + } + }), + (new Extend\ThrottleApi)->set('blockListDiscussionsOverride', function ($request) { + if ($request->getAttribute('routeName') === 'discussions.index') { + return false; + } + }) + ); + + $this->prepDb(); $response = $this->send($this->request('GET', '/api/discussions', ['authenticatedAs' => 2])); diff --git a/framework/core/tests/phpunit.integration.xml b/framework/core/tests/phpunit.integration.xml index 3e1869c9c..0799fafe5 100644 --- a/framework/core/tests/phpunit.integration.xml +++ b/framework/core/tests/phpunit.integration.xml @@ -6,7 +6,7 @@ convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" - processIsolation="false" + processIsolation="true" stopOnFailure="false">