Skip to content

Commit be7d933

Browse files
committed
fix tests
1 parent ba49d26 commit be7d933

File tree

4 files changed

+18
-31
lines changed

4 files changed

+18
-31
lines changed

tests/LfmItemTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function testType()
9696
$this->lfm_path->shouldReceive('isDirectory')->andReturn(false);
9797
$this->lfm_path->shouldReceive('mimeType')->andReturn('application/plain');
9898
$this->lfm_path->shouldReceive('path')->with('absolute')->andReturn('foo/bar.baz');
99+
$this->lfm_path->shouldReceive('extension')->andReturn('baz');
99100

100101
$this->lfm->shouldReceive('getFileType')->with('baz')->andReturn('File');
101102

@@ -107,6 +108,7 @@ public function testType()
107108
public function testExtension()
108109
{
109110
$this->lfm_path->shouldReceive('path')->with('absolute')->andReturn('foo/bar.baz');
111+
$this->lfm_path->shouldReceive('extension')->andReturn('baz');
110112

111113
$item = new LfmItem($this->lfm_path, $this->lfm);
112114

@@ -160,6 +162,7 @@ public function testIcon()
160162
$this->lfm_path->shouldReceive('isDirectory')->andReturn(false);
161163
$this->lfm_path->shouldReceive('mimeType')->andReturn('application/plain');
162164
$this->lfm_path->shouldReceive('path')->with('absolute')->andReturn('foo/bar.baz');
165+
$this->lfm_path->shouldReceive('extension')->andReturn('baz');
163166

164167
$this->lfm->shouldReceive('getFileIcon')->with('baz')->andReturn('fa-file');
165168

tests/LfmPathTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,15 @@ public function testFiles()
158158
$this->assertInstanceOf(LfmItem::class, $path->files()[0]);
159159
}
160160

161-
public function testGet()
161+
public function testPretty()
162162
{
163163
$helper = m::mock(Lfm::class);
164164
$helper->shouldReceive('getNameFromPath')->andReturn('bar');
165165
$helper->shouldReceive('isRunningOnWindows')->andReturn(false);
166166

167167
$path = new LfmPath($helper);
168168

169-
$this->assertInstanceOf(LfmItem::class, $path->get('foo'));
169+
$this->assertInstanceOf(LfmItem::class, $path->pretty('foo'));
170170
}
171171

172172
public function testDelete()

tests/LfmStorageRepositoryTest.php

+1-16
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function setUp()
3434

3535
Storage::shouldReceive('disk')->andReturn($disk);
3636

37-
$this->storage = new LfmStorageRepository('foo/bar');
37+
$this->storage = new LfmStorageRepository('foo/bar', 'local');
3838
}
3939

4040
public function tearDown()
@@ -62,21 +62,11 @@ public function testFiles()
6262
$this->assertEquals('foo/bar/baz', $this->storage->files()[0]);
6363
}
6464

65-
public function testMakeDirectory()
66-
{
67-
$this->assertTrue($this->storage->makeDirectory());
68-
}
69-
7065
public function testExists()
7166
{
7267
$this->assertTrue($this->storage->exists());
7368
}
7469

75-
public function testGetFile()
76-
{
77-
$this->assertTrue($this->storage->getFile());
78-
}
79-
8070
public function testMimeType()
8171
{
8272
$this->assertEquals('text/plain', $this->storage->mimeType());
@@ -94,9 +84,4 @@ public function testMove()
9484

9585
$this->assertTrue($this->storage->move($new_lfm_path));
9686
}
97-
98-
public function testDirectoryIsEmpty()
99-
{
100-
$this->assertTrue($this->storage->directoryIsEmpty());
101-
}
10287
}

tests/LfmTest.php

+12-13
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function testGetStorage()
2424
$config = m::mock(Config::class);
2525
$config->shouldReceive('get')->with('lfm.driver')->once()->andReturn('file');
2626
$config->shouldReceive('get')->with('lfm.driver')->once()->andReturn('storage');
27+
$config->shouldReceive('get')->with('lfm.disk')->once()->andReturn('local');
2728

2829
$lfm1 = new Lfm($config);
2930
$lfm2 = new Lfm($config);
@@ -41,18 +42,6 @@ public function testInput()
4142
$this->assertEquals('bar', $lfm->input('foo'));
4243
}
4344

44-
public function testIsProcessingImages()
45-
{
46-
$request = m::mock(Request::class);
47-
$request->shouldReceive('input')->with('type')->once()->andReturn('image');
48-
$request->shouldReceive('input')->with('type')->once()->andReturn('file');
49-
50-
$lfm = new Lfm(m::mock(Config::class), $request);
51-
52-
$this->assertTrue($lfm->isProcessingImages());
53-
$this->assertFalse($lfm->isProcessingImages());
54-
}
55-
5645
public function testGetNameFromPath()
5746
{
5847
$this->assertEquals('bar', (new Lfm)->getNameFromPath('foo/bar'));
@@ -84,6 +73,9 @@ public function testGetCategoryName()
8473
->with('lfm.folder_categories.image.folder_name', m::type('string'))
8574
->once()
8675
->andReturn('photos');
76+
$config->shouldReceive('get')
77+
->with('lfm.folder_categories')
78+
->andReturn(['file' => [], 'image' => []]);
8779

8880
$request = m::mock(Request::class);
8981
$request->shouldReceive('input')->with('type')->once()->andReturn('file');
@@ -100,11 +92,18 @@ public function testCurrentLfmType()
10092
$request = m::mock(Request::class);
10193
$request->shouldReceive('input')->with('type')->once()->andReturn('file');
10294
$request->shouldReceive('input')->with('type')->once()->andReturn('image');
95+
$request->shouldReceive('input')->with('type')->once()->andReturn('foo');
10396

104-
$lfm = new Lfm(m::mock(Config::class), $request);
97+
$config = m::mock(Config::class);
98+
$config->shouldReceive('get')
99+
->with('lfm.folder_categories')
100+
->andReturn(['file' => [], 'image' => []]);
101+
102+
$lfm = new Lfm($config, $request);
105103

106104
$this->assertEquals('file', $lfm->currentLfmType());
107105
$this->assertEquals('image', $lfm->currentLfmType());
106+
$this->assertEquals('file', $lfm->currentLfmType());
108107
}
109108

110109
public function testGetUserSlug()

0 commit comments

Comments
 (0)