phpmyadmin/test/classes/FileListingTest.php
Maurício Meneghini Fauth 05b064cbca Add some tests for FileListing class
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
2018-09-20 22:11:37 -03:00

63 lines
1.4 KiB
PHP

<?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());
}
}