Skip to content

Commit

Permalink
Use process isolation for integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
askvortsov1 committed Dec 2, 2020
1 parent 8830e9d commit 984f751
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
27 changes: 17 additions & 10 deletions tests/integration/extenders/ThrottleApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public function list_discussions_can_be_restricted()
return true;
}
}));

$this->prepDb();

$response = $this->send($this->request('GET', '/api/discussions', ['authenticatedAs' => 2]));

$this->assertEquals(429, $response->getStatusCode());
Expand All @@ -67,16 +70,20 @@ public function list_discussions_can_be_restricted()
*/
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]));

Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit.integration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
processIsolation="true"
stopOnFailure="false">

<testsuites>
Expand Down

0 comments on commit 984f751

Please sign in to comment.