mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 05:18:52 +00:00
[ticket/15253] Update test
PHPBB3-15253
This commit is contained in:
parent
afb804fe1e
commit
91163d7ec3
3 changed files with 17 additions and 11 deletions
|
@ -36,7 +36,7 @@ class local implements adapter_interface
|
||||||
$this->filesystem = $filesystem;
|
$this->filesystem = $filesystem;
|
||||||
$this->root_path = $phpbb_root_path.$config[$path_key];
|
$this->root_path = $phpbb_root_path.$config[$path_key];
|
||||||
|
|
||||||
if(substr($this->root_path, -1, 1) != DIRECTORY_SEPARATOR)
|
if (substr($this->root_path, -1, 1) != DIRECTORY_SEPARATOR)
|
||||||
{
|
{
|
||||||
$this->root_path = $this->root_path.DIRECTORY_SEPARATOR;
|
$this->root_path = $this->root_path.DIRECTORY_SEPARATOR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
|
|
||||||
namespace phpbb\storage;
|
namespace phpbb\storage;
|
||||||
|
|
||||||
use phpbb\storage\exception\exception;
|
|
||||||
|
|
||||||
class storage
|
class storage
|
||||||
{
|
{
|
||||||
protected $adapter;
|
protected $adapter;
|
||||||
|
|
|
@ -16,10 +16,17 @@
|
||||||
protected $adapter;
|
protected $adapter;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->adapter = new \phpbb\storage\adapter\local();
|
|
||||||
}
|
$config = new \phpbb\config\config(array(
|
||||||
|
'test_path' => '.',
|
||||||
|
));
|
||||||
|
$filesystem = new \phpbb\filesystem\filesystem();
|
||||||
|
$phpbb_root_path = getcwd().DIRECTORY_SEPARATOR;
|
||||||
|
$path_key = 'test_path';
|
||||||
|
$this->adapter = new \phpbb\storage\adapter\local($config, $filesystem, $phpbb_root_path, $path_key);
|
||||||
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
{
|
{
|
||||||
|
@ -44,11 +51,11 @@
|
||||||
public function test_exists()
|
public function test_exists()
|
||||||
{
|
{
|
||||||
// Exists with files
|
// Exists with files
|
||||||
$this->assertTrue($this->adapter->exists(__DIR__.'/local_test.php'));
|
$this->assertTrue($this->adapter->exists('README.md'));
|
||||||
$this->assertFalse($this->adapter->exists(__DIR__.'/nonexistent_file.php'));
|
$this->assertFalse($this->adapter->exists('nonexistent_file.php'));
|
||||||
// exists with directory
|
// exists with directory
|
||||||
$this->assertTrue($this->adapter->exists(__DIR__.'/../adapter'));
|
$this->assertTrue($this->adapter->exists('phpBB'));
|
||||||
$this->assertFalse($this->adapter->exists(__DIR__.'/../nonexistet_folder'));
|
$this->assertFalse($this->adapter->exists('nonexistet_folder'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_delete()
|
public function test_delete()
|
||||||
|
@ -83,4 +90,5 @@
|
||||||
unlink('file.txt');
|
unlink('file.txt');
|
||||||
unlink('file2.txt');
|
unlink('file2.txt');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue