-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
125 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
<?php | ||
$autoloader = include dirname(__DIR__) . '/vendor/autoload.php'; | ||
$autoloader->addPsr4('Dframe\\FileStorage\\tests\\', __DIR__); | ||
|
||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
define('APP_NAME', 'Dframe'); | ||
define('APP_DIR', __DIR__.'/'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace Dframe\FileStorage\Tests; | ||
|
||
use Dframe\FileStorage\Drivers\DatabaseDriverInterface; | ||
|
||
/** | ||
* Class FakeDriver | ||
* | ||
* @package Dframe\FileStorage\Tests | ||
*/ | ||
class FakeDriver implements DatabaseDriverInterface | ||
{ | ||
/** | ||
* @param $adapter | ||
* @param $path | ||
* @param bool $cache | ||
* | ||
* @return mixed | ||
*/ | ||
public function get($adapter, $path, $cache = false) | ||
{ | ||
// TODO: Implement get() method. | ||
} | ||
|
||
/** | ||
* @param $adapter | ||
* @param $path | ||
* @param $mine | ||
* @param $stream | ||
* | ||
* @return mixed | ||
*/ | ||
public function put($adapter, $path, $mine, $stream) | ||
{ | ||
// TODO: Implement put() method. | ||
} | ||
|
||
/** | ||
* @param $adapter | ||
* @param $originalId | ||
* @param $path | ||
* @param $mine | ||
* @param $stream | ||
* | ||
* @return mixed | ||
*/ | ||
public function cache($adapter, $originalId, $path, $mine, $stream) | ||
{ | ||
// TODO: Implement cache() method. | ||
} | ||
|
||
/** | ||
* @param $adapter | ||
* @param $path | ||
* | ||
* @return mixed | ||
*/ | ||
public function drop($adapter, $path) | ||
{ | ||
// TODO: Implement drop() method. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace Dframe\FileStorage\Tests; | ||
|
||
use Dframe\FileStorage\Storage; | ||
use League\Flysystem\Filesystem; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Class FileTests | ||
* | ||
* @package Dframe\FileStorage\Tests | ||
*/ | ||
class FileTest extends TestCase | ||
{ | ||
|
||
/** @var Storage */ | ||
protected $Storage; | ||
|
||
public function setUp() | ||
{ | ||
clearstatcache(); | ||
$fs = new \League\Flysystem\Adapter\Local(__DIR__ . '/'); | ||
$fs->deleteDir('files'); | ||
$fs->createDir('files', new \League\Flysystem\Config()); | ||
$fs->write('file.txt', 'contents', new \League\Flysystem\Config()); | ||
$local = new Filesystem($fs); | ||
|
||
$driver = new FakeDriver(); | ||
$config = [ | ||
'pluginsDir' => __DIR__ . '/plugins', | ||
'adapters' => [ | ||
'local' => $local, | ||
] | ||
]; | ||
|
||
$this->Storage = new Storage($driver, $config); | ||
} | ||
|
||
public function testHas() | ||
{ | ||
|
||
$this->assertTrue($this->Storage->getManager()->has('local://file.txt')); | ||
} | ||
|
||
public function testPut() | ||
{ | ||
$put = $this->Storage->put('local', __DIR__ . '/file.txt', 'files/file.txt'); | ||
$this->assertTrue($put['return']); | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
contents |