mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/15253] Update tests
PHPBB3-15253
This commit is contained in:
@@ -28,6 +28,14 @@
|
||||
$this->adapter = new \phpbb\storage\adapter\local($config, $filesystem, $phpbb_root_path, $path_key);
|
||||
}
|
||||
|
||||
public function data_test_exists()
|
||||
{
|
||||
yield ['README.md', true];
|
||||
yield ['nonexistent_file.php', false];
|
||||
yield ['phpBB/phpbb', true];
|
||||
yield ['nonexistent/folder', false];
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
$this->adapter = null;
|
||||
@@ -48,24 +56,24 @@
|
||||
unlink('file.txt');
|
||||
}
|
||||
|
||||
public function test_exists()
|
||||
/**
|
||||
* @dataProvider data_test_exists
|
||||
*/
|
||||
public function test_exists($path, $expected)
|
||||
{
|
||||
// Exists with files
|
||||
$this->assertTrue($this->adapter->exists('README.md'));
|
||||
$this->assertFalse($this->adapter->exists('nonexistent_file.php'));
|
||||
// exists with directory
|
||||
$this->assertTrue($this->adapter->exists('phpBB'));
|
||||
$this->assertFalse($this->adapter->exists('nonexistet_folder'));
|
||||
$this->assertSame($expected, $this->adapter->exists($path));
|
||||
}
|
||||
|
||||
public function test_delete()
|
||||
public function test_delete_file()
|
||||
{
|
||||
// Delete with files
|
||||
file_put_contents('file.txt', '');
|
||||
$this->assertTrue(file_exists('file.txt'));
|
||||
$this->adapter->delete('file.txt');
|
||||
$this->assertFalse(file_exists('file.txt'));
|
||||
// Delete with directories
|
||||
}
|
||||
|
||||
public function test_delete_folder()
|
||||
{
|
||||
mkdir('path/to/dir', 0777, true);
|
||||
$this->assertTrue(file_exists('path/to/dir'));
|
||||
$this->adapter->delete('path');
|
||||
|
Reference in New Issue
Block a user