Skip to content

Commit

Permalink
Update #24, add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dusta committed Dec 17, 2018
1 parent d5b4099 commit 9e7c5ac
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 15 deletions.
2 changes: 0 additions & 2 deletions tests/Bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
<?php
$autoloader = include dirname(__DIR__) . '/vendor/autoload.php';
$autoloader->addPsr4('Dframe\\FileStorage\\tests\\', __DIR__);
46 changes: 41 additions & 5 deletions tests/FileTests.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,43 @@
<?php

namespace Dframe\FileStorage\Tests;

use Dframe\FileStorage\Storage;
use League\Flysystem\Adapter\Local;
use League\Flysystem\Config;
use League\Flysystem\Filesystem;
use PHPUnit\Framework\TestCase;

/**
* Created by PhpStorm.
* User: slasz
* Date: 17.12.2018
* Time: 20:13
*/
* Class FileTests
*
* @package Dframe\FileStorage\Tests
*/
class FileTests extends TestCase
{

public function setup()
{
clearstatcache();
$fs = new Local(__DIR__ . '/');
$fs->deleteDir('files');
$fs->createDir('files', new Config());
$fs->write('file.txt', 'contents', new Config());
$local = new Filesystem($fs);

$driver = false;
$config = [
'pluginsDir' => __DIR__ . '/plugins',
'adapters' => [
'local' => $local,
]
];

$this->Storage = new Storage($driver, $config);
}

public function testHas(){
$this->assertTrue($this->setup()->Storage->getManager()->has('file.txt'));
}

}
11 changes: 3 additions & 8 deletions tests/SetupTest.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<?php
namespace Dframe\FileStorage\tests;
namespace Dframe\FileStorage\Tests;

ini_set('session.use_cookies', 0);

// backward compatibility
if (!class_exists('\PHPUnit\Framework\TestCase') and class_exists('\PHPUnit_Framework_TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}
use PHPUnit\Framework\TestCase;

/**
* Class SetupTest
*
* @package Dframe\FileStorage\tests
*/
class SetupTest extends \PHPUnit\Framework\TestCase
class SetupTest extends TestCase
{
public function setUp()
{
Expand Down

0 comments on commit 9e7c5ac

Please sign in to comment.