diff options
author | MaurĂcio Meneghini Fauth <mauricio@fauth.dev> | 2022-11-06 23:01:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-06 23:01:07 +0300 |
commit | 456be438ea2f000988d4fb654d6159a127edc24c (patch) | |
tree | 909755d4c7b63a4406b14770d4948b0cb8ad5dfa /test | |
parent | dc3dc0d5f11864c18c66ae9ecf3041aa10ae43f6 (diff) | |
parent | aa3b4ed737f8965b609843a6f722ce9a1fbef877 (diff) |
Merge pull request #17872 from kamil-tekiela/Remove-$params-2
Refactoring of Processes.php
Diffstat (limited to 'test')
-rw-r--r-- | test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php | 17 | ||||
-rw-r--r-- | test/classes/Controllers/Server/Status/ProcessesControllerTest.php | 31 |
2 files changed, 34 insertions, 14 deletions
diff --git a/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php b/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php index 5fccaacb01..b1b1f318f1 100644 --- a/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php +++ b/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php @@ -66,11 +66,18 @@ class RefreshControllerTest extends AbstractTestCase new Processes($GLOBALS['dbi']) ); - $_POST['full'] = '1'; - $_POST['order_by_field'] = 'process'; - $_POST['sort_order'] = 'DESC'; - - $controller($this->createStub(ServerRequest::class)); + $request = $this->createStub(ServerRequest::class); + $request->method('getParsedBodyParam')->willReturnMap([ + ['column_name', '', ''], + ['order_by_field', '', 'process'], + ['sort_order', '', 'DESC'], + ]); + $request->method('hasBodyParam')->willReturnMap([ + ['full', true], + ['showExecuting', false], + ]); + + $controller($request); $html = $response->getHTMLResult(); $this->assertStringContainsString('index.php?route=/server/status/processes', $html); diff --git a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php index a0ddb6e27c..6bd6dc4414 100644 --- a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php +++ b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php @@ -87,13 +87,19 @@ class ProcessesControllerTest extends AbstractTestCase $this->assertStringContainsString('Show full queries', $html); $this->assertStringContainsString('index.php?route=/server/status/processes', $html); - $_POST['full'] = '1'; - $_POST['column_name'] = 'Database'; - $_POST['order_by_field'] = 'Db'; - $_POST['sort_order'] = 'ASC'; + $request = $this->createStub(ServerRequest::class); + $request->method('getParsedBodyParam')->willReturnMap([ + ['column_name', '', 'Database'], + ['order_by_field', '', 'Db'], + ['sort_order', '', 'ASC'], + ]); + $request->method('hasBodyParam')->willReturnMap([ + ['full', true], + ['showExecuting', false], + ]); $this->dummyDbi->addSelectDb('mysql'); - $controller($this->createStub(ServerRequest::class)); + $controller($request); $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); @@ -101,12 +107,19 @@ class ProcessesControllerTest extends AbstractTestCase $this->assertStringContainsString('Database', $html); $this->assertStringContainsString('DESC', $html); - $_POST['column_name'] = 'Host'; - $_POST['order_by_field'] = 'Host'; - $_POST['sort_order'] = 'DESC'; + $request = $this->createStub(ServerRequest::class); + $request->method('getParsedBodyParam')->willReturnMap([ + ['column_name', '', 'Host'], + ['order_by_field', '', 'Host'], + ['sort_order', '', 'DESC'], + ]); + $request->method('hasBodyParam')->willReturnMap([ + ['full', true], + ['showExecuting', false], + ]); $this->dummyDbi->addSelectDb('mysql'); - $controller($this->createStub(ServerRequest::class)); + $controller($request); $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); |