1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace PhpMyAdmin\Tests; |
6
|
|
|
|
7
|
|
|
use PhpMyAdmin\Footer; |
8
|
|
|
use PhpMyAdmin\Header; |
9
|
|
|
use PhpMyAdmin\ResponseRenderer; |
|
|
|
|
10
|
|
|
use PHPUnit\Framework\Attributes\PreserveGlobalState; |
11
|
|
|
use PHPUnit\Framework\Attributes\RunInSeparateProcess; |
12
|
|
|
use ReflectionProperty; |
13
|
|
|
|
14
|
|
|
/** @covers \PhpMyAdmin\ResponseRenderer */ |
15
|
|
|
class ResponseRendererTest extends AbstractTestCase |
16
|
|
|
{ |
17
|
|
|
protected function setUp(): void |
18
|
|
|
{ |
19
|
|
|
parent::setUp(); |
20
|
|
|
|
21
|
|
|
$GLOBALS['dbi'] = $this->createDatabaseInterface(); |
22
|
|
|
|
23
|
|
|
$GLOBALS['lang'] = 'en'; |
24
|
|
|
$GLOBALS['server'] = 1; |
25
|
|
|
$GLOBALS['text_dir'] = 'ltr'; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
#[RunInSeparateProcess] |
29
|
|
|
#[PreserveGlobalState(false)] |
30
|
|
|
public function testSetAjax(): void |
31
|
|
|
{ |
32
|
|
|
$_REQUEST = []; |
33
|
|
|
$response = ResponseRenderer::getInstance(); |
34
|
|
|
$header = $response->getHeader(); |
35
|
|
|
$footer = (new ReflectionProperty(ResponseRenderer::class, 'footer'))->getValue($response); |
36
|
|
|
$this->assertInstanceOf(Footer::class, $footer); |
37
|
|
|
$headerIsAjax = new ReflectionProperty(Header::class, 'isAjax'); |
38
|
|
|
$footerIsAjax = new ReflectionProperty(Footer::class, 'isAjax'); |
39
|
|
|
|
40
|
|
|
$this->assertFalse($response->isAjax()); |
41
|
|
|
$this->assertFalse($headerIsAjax->getValue($header)); |
42
|
|
|
$this->assertFalse($footerIsAjax->getValue($footer)); |
43
|
|
|
|
44
|
|
|
$response->setAjax(true); |
45
|
|
|
$this->assertTrue($response->isAjax()); |
46
|
|
|
$this->assertTrue($headerIsAjax->getValue($header)); |
47
|
|
|
$this->assertTrue($footerIsAjax->getValue($footer)); |
48
|
|
|
|
49
|
|
|
$response->setAjax(false); |
50
|
|
|
$this->assertFalse($response->isAjax()); |
51
|
|
|
$this->assertFalse($headerIsAjax->getValue($header)); |
52
|
|
|
$this->assertFalse($footerIsAjax->getValue($footer)); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths