data = new Data(); } public function testRefresh(): void { $process = [ 'User' => 'User1', 'Host' => 'Host1', 'Id' => 'Id1', 'db' => 'db1', 'Command' => 'Command1', 'Info' => 'Info1', 'State' => 'State1', 'Time' => 'Time1', ]; $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 12; $response = new ResponseRenderer(); $response->setAjax(true); $controller = new RefreshController( $response, new Template(), $this->data, new Processes($GLOBALS['dbi']) ); $_POST['full'] = '1'; $_POST['order_by_field'] = 'process'; $_POST['sort_order'] = 'DESC'; $controller(); $html = $response->getHTMLResult(); $this->assertStringContainsString('index.php?route=/server/status/processes', $html); $killProcess = 'data-post="' . Url::getCommon(['kill' => $process['Id']], '') . '"'; $this->assertStringContainsString($killProcess, $html); $this->assertStringContainsString('ajax kill_process', $html); $this->assertStringContainsString( __('Kill'), $html ); //validate 2: $process['User'] $this->assertStringContainsString( htmlspecialchars($process['User']), $html ); //validate 3: $process['Host'] $this->assertStringContainsString( htmlspecialchars($process['Host']), $html ); //validate 4: $process['db'] $this->assertStringContainsString( __('None'), $html ); //validate 5: $process['Command'] $this->assertStringContainsString( htmlspecialchars($process['Command']), $html ); //validate 6: $process['Time'] $this->assertStringContainsString($process['Time'], $html); //validate 7: $process['state'] $this->assertStringContainsString($process['State'], $html); //validate 8: $process['info'] $this->assertStringContainsString($process['Info'], $html); } }