-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve unit test for ResponseRenderer::setAjax()
Also tests the setAjax() method of Header, Footer and Console classes. Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
- Loading branch information
1 parent
b908461
commit 3f587cc
Showing
9 changed files
with
114 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpMyAdmin\Tests; | ||
|
||
use PhpMyAdmin\Footer; | ||
use PhpMyAdmin\Header; | ||
use PhpMyAdmin\ResponseRenderer; | ||
use ReflectionProperty; | ||
|
||
/** | ||
* @covers \PhpMyAdmin\ResponseRenderer | ||
*/ | ||
class ResponseRendererTest extends AbstractTestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$GLOBALS['lang'] = 'en'; | ||
$GLOBALS['server'] = 1; | ||
$GLOBALS['text_dir'] = 'ltr'; | ||
$GLOBALS['PMA_PHP_SELF'] = 'index.php'; | ||
} | ||
|
||
/** | ||
* @runInSeparateProcess | ||
* @preserveGlobalState disabled | ||
*/ | ||
public function testSetAjax(): void | ||
{ | ||
$_REQUEST = []; | ||
$response = ResponseRenderer::getInstance(); | ||
$header = $response->getHeader(); | ||
$footerReflection = new ReflectionProperty(ResponseRenderer::class, 'footer'); | ||
$footerReflection->setAccessible(true); | ||
$footer = $footerReflection->getValue($response); | ||
$this->assertInstanceOf(Footer::class, $footer); | ||
$headerIsAjax = new ReflectionProperty(Header::class, 'isAjax'); | ||
$headerIsAjax->setAccessible(true); | ||
$footerIsAjax = new ReflectionProperty(Footer::class, 'isAjax'); | ||
$footerIsAjax->setAccessible(true); | ||
|
||
$this->assertFalse($response->isAjax()); | ||
$this->assertFalse($headerIsAjax->getValue($header)); | ||
$this->assertFalse($footerIsAjax->getValue($footer)); | ||
|
||
$response->setAjax(true); | ||
$this->assertTrue($response->isAjax()); | ||
$this->assertTrue($headerIsAjax->getValue($header)); | ||
$this->assertTrue($footerIsAjax->getValue($footer)); | ||
|
||
$response->setAjax(false); | ||
$this->assertFalse($response->isAjax()); | ||
$this->assertFalse($headerIsAjax->getValue($header)); | ||
$this->assertFalse($footerIsAjax->getValue($footer)); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.