8000 fix tests · trdynet/laravel-filemanager@3925082 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3925082

Browse files
committed
fix tests
1 parent d646d3f commit 3925082

File tree

2 files changed

+6
-40
lines changed

2 files changed

+6
-40
lines changed

tests/LfmPathTest.php

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -162,39 +162,6 @@ public function testPretty()
162162
$this->assertInstanceOf(LfmItem::class, $path->pretty('foo'));
163163
}
164164

165-
public function testDelete()
166-
{
167-
$storage = m::mock(LfmStorage::class);
168-
$storage->shouldReceive('isDirectory')->andReturn(true);
169-
$storage->shouldReceive('deleteDirectory')->andReturn('folder_deleted');
170-
171-
$helper = m::mock(Lfm::class);
172-
$helper->shouldReceive('getStorage')->with('files/bar')->andReturn($storage);
173-
$helper->shouldReceive('getCategoryName')->andReturn('files');
174-
$helper->shouldReceive('input')->with('working_dir')->andReturn('/bar');
175-
$helper->shouldReceive('isRunningOnWindows')->andReturn(false);
176-
$helper->shouldReceive('ds')->andReturn('/');
177-
178-
$path1 = new LfmPath($helper);
179-
180-
$this->assertEquals('folder_deleted', $path1->delete());
181-
182-
$storage = m::mock(LfmStorage::class);
183-
$storage->shouldReceive('isDirectory')->andReturn(false);
184-
$storage->shouldReceive('delete')->andReturn('file_deleted');
185-
186-
$helper = m::mock(Lfm::class);
187-
$helper->shouldReceive('getStorage')->with('files/bar')->andReturn($storage);
188-
$helper->shouldReceive('getCategoryName')->andReturn('files');
189-
$helper->shouldReceive('input')->with('working_dir')->andReturn('/bar');
190-
$helper->shouldReceive('isRunningOnWindows')->andReturn(false);
191-
$helper->shouldReceive('ds')->andReturn('/');
192-
193-
$path2 = new LfmPath($helper);
194-
195-
$this->assertEquals('file_deleted', $path2->delete());
196-
}
197-
198165
public function testCreateFolder()
199166
{
200167
$storage = m::mock(LfmStorage::class);

tests/LfmStorageRepositoryTest.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Illuminate\Support\Facades\Storage;
66
use Mockery as m;
77
use PHPUnit\Framework\TestCase;
8+
use UniSharp\LaravelFilemanager\Lfm;
89
use UniSharp\LaravelFilemanager\LfmPath;
910
use UniSharp\LaravelFilemanager\LfmStorageRepository;
1011

@@ -24,9 +25,12 @@ public function setUp()
2425
$disk->shouldReceive('directories')->with('foo')->andReturn(['foo/bar']);
2526
$disk->shouldReceive('move')->with('foo/bar', 'foo/bar/baz')->andReturn(true);
2627

27-
Storage::shouldReceive('disk')->andReturn($disk);
28+
$helper = m::mock(Lfm::class);
29+
$helper->shouldReceive('config')->with('disk')->andReturn('local');
2830

29-
$this->storage = new LfmStorageRepository('foo/bar', 'local');
31+
Storage::shouldReceive('disk')->with('local')->andReturn($disk);
32+
33+
$this->storage = new LfmStorageRepository('foo/bar', $helper);
3034
}
3135

3236
public function tearDown()
@@ -44,11 +48,6 @@ public function testRootPath()
4448
$this->assertEquals('foo/bar', $this->storage->rootPath());
4549
}
4650

47-
public function testIsDirectory()
48-
{
49-
$this->assertTrue($this->storage->isDirectory());
50-
}
51-
5251
public function testMove()
5352
{
5453
$new_lfm_path = m::mock(LfmPath::class);

0 commit comments

Comments
 (0)
0