diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-10-29 23:27:51 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-10-29 23:27:51 +0300 |
commit | 4bd3a1c4234e3f4308db9542c953b6216b62fdd7 (patch) | |
tree | 00da1f55addeba68d3f8d69677c0b78fc717c751 /test/classes/Controllers | |
parent | cb7d976a6902e8253845c5fdef5daf2249987b38 (diff) |
Fix some issues and update SA baselines
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'test/classes/Controllers')
-rw-r--r-- | test/classes/Controllers/LintControllerTest.php | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/test/classes/Controllers/LintControllerTest.php b/test/classes/Controllers/LintControllerTest.php index 0ca372f053..b85d27f031 100644 --- a/test/classes/Controllers/LintControllerTest.php +++ b/test/classes/Controllers/LintControllerTest.php @@ -26,8 +26,6 @@ class LintControllerTest extends AbstractTestCase public function testWithoutParams(): void { - $_POST = []; - $this->getLintController()($this->createStub(ServerRequest::class)); $output = $this->getActualOutputForAssertion(); @@ -37,9 +35,13 @@ class LintControllerTest extends AbstractTestCase public function testWithoutSqlErrors(): void { - $_POST['sql_query'] = 'SELECT * FROM `actor` WHERE `actor_id` = 1;'; + $request = $this->createStub(ServerRequest::class); + $request->method('getParsedBodyParam')->willReturnMap([ + ['sql_query', null, 'SELECT * FROM `actor` WHERE `actor_id` = 1;'], + ['options', null, null], + ]); - $this->getLintController()($this->createStub(ServerRequest::class)); + $this->getLintController()($request); $output = $this->getActualOutputForAssertion(); $this->assertJson($output); @@ -48,8 +50,6 @@ class LintControllerTest extends AbstractTestCase public function testWithSqlErrors(): void { - $_POST['sql_query'] = 'SELECT * FROM `actor` WHEREE `actor_id` = 1;'; - $expectedJson = json_encode([ [ 'message' => 'An alias was previously found. (near <code>`actor_id`</code>)', @@ -86,7 +86,13 @@ class LintControllerTest extends AbstractTestCase ]); $this->assertNotFalse($expectedJson); - $this->getLintController()($this->createStub(ServerRequest::class)); + $request = $this->createStub(ServerRequest::class); + $request->method('getParsedBodyParam')->willReturnMap([ + ['sql_query', null, 'SELECT * FROM `actor` WHEREE `actor_id` = 1;'], + ['options', null, null], + ]); + + $this->getLintController()($request); $output = $this->getActualOutputForAssertion(); $this->assertJson($output); |