Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some tests for FileListing class
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
- Loading branch information
1 parent
82eb1a0
commit 05b064c
Showing
2 changed files
with
63 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
/** | ||
* Tests for PhpMyAdmin\FileListing | ||
* @package PhpMyAdmin\Tests | ||
*/ | ||
|
||
namespace PhpMyAdmin\Tests; | ||
|
||
use PhpMyAdmin\FileListing; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Class FileListingTest | ||
* @package PhpMyAdmin\Tests | ||
*/ | ||
class FileListingTest extends TestCase | ||
{ | ||
/** | ||
* @var FileListing $fileListing | ||
*/ | ||
private $fileListing; | ||
|
||
/** | ||
* @return void | ||
*/ | ||
protected function setUp(): void | ||
{ | ||
$this->fileListing = new FileListing(); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function testGetDirContent(): void | ||
{ | ||
$this->assertFalse($this->fileListing->getDirContent('nonexistent directory')); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function testGetFileSelectOptions(): void | ||
{ | ||
$this->assertFalse($this->fileListing->getFileSelectOptions('nonexistent directory')); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function testSupportedDecompressions(): void | ||
{ | ||
$GLOBALS['cfg']['ZipDump'] = false; | ||
$GLOBALS['cfg']['GZipDump'] = false; | ||
$GLOBALS['cfg']['BZipDump'] = false; | ||
$this->assertEmpty($this->fileListing->supportedDecompressions()); | ||
|
||
$GLOBALS['cfg']['ZipDump'] = true; | ||
$GLOBALS['cfg']['GZipDump'] = true; | ||
$GLOBALS['cfg']['BZipDump'] = true; | ||
$this->assertEquals('gz|bz2|zip', $this->fileListing->supportedDecompressions()); | ||
} | ||
} |