1
0
mirror of https://github.com/flarum/core.git synced 2025-07-26 03:01:22 +02:00

Use process isolation for integration tests

This commit is contained in:
Alexander Skvortsov
2020-12-01 19:33:24 -05:00
committed by GitHub
parent 8830e9dd09
commit 984f751c71
2 changed files with 18 additions and 11 deletions

View File

@@ -57,6 +57,9 @@ class ThrottleApiTest extends TestCase
return true; return true;
} }
})); }));
$this->prepDb();
$response = $this->send($this->request('GET', '/api/discussions', ['authenticatedAs' => 2])); $response = $this->send($this->request('GET', '/api/discussions', ['authenticatedAs' => 2]));
$this->assertEquals(429, $response->getStatusCode()); $this->assertEquals(429, $response->getStatusCode());
@@ -67,16 +70,20 @@ class ThrottleApiTest extends TestCase
*/ */
public function false_overrides_true_for_evaluating_throttlers() public function false_overrides_true_for_evaluating_throttlers()
{ {
$this->extend((new Extend\ThrottleApi)->set('blockListDiscussions', function ($request) { $this->extend(
if ($request->getAttribute('routeName') === 'discussions.index') { (new Extend\ThrottleApi)->set('blockListDiscussions', function ($request) {
return true; if ($request->getAttribute('routeName') === 'discussions.index') {
} return true;
})); }
$this->extend((new Extend\ThrottleApi)->set('blockListDiscussionsOverride', function ($request) { }),
if ($request->getAttribute('routeName') === 'discussions.index') { (new Extend\ThrottleApi)->set('blockListDiscussionsOverride', function ($request) {
return false; if ($request->getAttribute('routeName') === 'discussions.index') {
} return false;
})); }
})
);
$this->prepDb();
$response = $this->send($this->request('GET', '/api/discussions', ['authenticatedAs' => 2])); $response = $this->send($this->request('GET', '/api/discussions', ['authenticatedAs' => 2]));

View File

@@ -6,7 +6,7 @@
convertErrorsToExceptions="true" convertErrorsToExceptions="true"
convertNoticesToExceptions="true" convertNoticesToExceptions="true"
convertWarningsToExceptions="true" convertWarningsToExceptions="true"
processIsolation="false" processIsolation="true"
stopOnFailure="false"> stopOnFailure="false">
<testsuites> <testsuites>