[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->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;
} }

View file

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

View file

@ -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');
} }
} }