1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-05 00:13:29 +02:00

[ticket/15253] Update test

PHPBB3-15253
This commit is contained in:
Rubén Calvo 2017-06-25 19:53:40 +02:00
parent afb804fe1e
commit 91163d7ec3
3 changed files with 17 additions and 11 deletions

View File

@ -36,7 +36,7 @@ class local implements adapter_interface
$this->filesystem = $filesystem;
$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;
}

View File

@ -13,8 +13,6 @@
namespace phpbb\storage;
use phpbb\storage\exception\exception;
class storage
{
protected $adapter;

View File

@ -16,10 +16,17 @@
protected $adapter;
public function setUp()
{
parent::setUp();
$this->adapter = new \phpbb\storage\adapter\local();
}
{
parent::setUp();
$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()
{
@ -44,11 +51,11 @@
public function test_exists()
{
// Exists with files
$this->assertTrue($this->adapter->exists(__DIR__.'/local_test.php'));
$this->assertFalse($this->adapter->exists(__DIR__.'/nonexistent_file.php'));
$this->assertTrue($this->adapter->exists('README.md'));
$this->assertFalse($this->adapter->exists('nonexistent_file.php'));
// exists with directory
$this->assertTrue($this->adapter->exists(__DIR__.'/../adapter'));
$this->assertFalse($this->adapter->exists(__DIR__.'/../nonexistet_folder'));
$this->assertTrue($this->adapter->exists('phpBB'));
$this->assertFalse($this->adapter->exists('nonexistet_folder'));
}
public function test_delete()
@ -83,4 +90,5 @@
unlink('file.txt');
unlink('file2.txt');
}
}