| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /laragon4/www/wa-gateway/vendor/unisharp/laravel-filemanager/tests/ |
Upload File : |
<?php
namespace Tests;
use Illuminate\Support\Facades\Storage;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use UniSharp\LaravelFilemanager\Lfm;
use UniSharp\LaravelFilemanager\LfmPath;
use UniSharp\LaravelFilemanager\LfmStorageRepository;
class LfmStorageRepositoryTest extends TestCase
{
private $storage;
public function setUp()
{
parent::setUp();
$disk = m::mock('disk');
$disk->shouldReceive('getDriver')->andReturn($disk);
$disk->shouldReceive('getAdapter')->andReturn($disk);
$disk->shouldReceive('getPathPrefix')->andReturn('foo/bar');
$disk->shouldReceive('functionToCall')->with('foo/bar')->andReturn('baz');
$disk->shouldReceive('directories')->with('foo')->andReturn(['foo/bar']);
$disk->shouldReceive('move')->with('foo/bar', 'foo/bar/baz')->andReturn(true);
$helper = m::mock(Lfm::class);
$helper->shouldReceive('config')->with('disk')->andReturn('local');
Storage::shouldReceive('disk')->with('local')->andReturn($disk);
$this->storage = new LfmStorageRepository('foo/bar', $helper);
}
public function tearDown()
{
m::close();
}
public function testMagicCall()
{
$this->assertEquals('baz', $this->storage->functionToCall());
}
public function testRootPath()
{
$this->assertEquals('foo/bar', $this->storage->rootPath());
}
public function testMove()
{
$new_lfm_path = m::mock(LfmPath::class);
$new_lfm_path->shouldReceive('path')->with('storage')->andReturn('foo/bar/baz');
$this->assertTrue($this->storage->move($new_lfm_path));
}
}