Skip to content

Commit fab2170

Browse files
committed
Update tests
1 parent 41898b8 commit fab2170

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

tests/Feature/External/ToDataPackTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function test_export_contains_files(): void
5858

5959
$exporter = new ToDataPack($exportMock);
6060
$filename = $exporter->process($membership->bar->id, 'datapack-test.zip');
61-
$filename = $exportMock->disk()->path($filename);
61+
$filename = $exportMock->path($filename);
6262

6363
$unzippedFilesDisk = Storage::fake('temp-datapack-unzip');
6464

@@ -101,14 +101,12 @@ public function test_export_contains_files(): void
101101
}
102102

103103
/**
104-
* @return \Illuminate\Contracts\Filesystem\Factory&\PHPUnit\Framework\MockObject\MockObject
104+
* @return \Illuminate\Contracts\Filesystem\Filesystem
105105
*/
106106
private function getFileMock()
107107
{
108108
$disk = Storage::fake('exports');
109-
$factory = $this->createMock(\Illuminate\Contracts\Filesystem\Factory::class);
110-
$factory->method('disk')->willReturn($disk);
111109

112-
return $factory;
110+
return $disk;
113111
}
114112
}

tests/Feature/External/ToRecipeTypeTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function test_default_export_contains_schema_files(): void
5858

5959
$exporter = new ToRecipeType($exportMock);
6060
$filename = $exporter->process($membership->bar->id, 'recipes.zip');
61-
$filename = $exportMock->disk()->path($filename);
61+
$filename = $exportMock->path($filename);
6262

6363
$unzippedFilesDisk = Storage::fake('temp-recipes-unzip');
6464

@@ -75,14 +75,12 @@ public function test_default_export_contains_schema_files(): void
7575
}
7676

7777
/**
78-
* @return \Illuminate\Contracts\Filesystem\Factory&\PHPUnit\Framework\MockObject\MockObject
78+
* @return \Illuminate\Contracts\Filesystem\Filesystem
7979
*/
8080
private function getFileMock()
8181
{
8282
$disk = Storage::fake('exports');
83-
$factory = $this->createMock(\Illuminate\Contracts\Filesystem\Factory::class);
84-
$factory->method('disk')->willReturn($disk);
8583

86-
return $factory;
84+
return $disk;
8785
}
8886
}

tests/Unit/Services/Image/ImageServiceTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ class ImageServiceTest extends TestCase
1414
{
1515
public function testGeneratePlaceholderHash(): void
1616
{
17-
$hashKey = ImageHashingService::generatePlaceholderHashFromFilepath(base_path('tests/fixtures/cocktail.jpg'));
17+
$imageBuffer = file_get_contents(base_path('tests/fixtures/cocktail.jpg'));
18+
$hashKey = ImageHashingService::generatePlaceholderHashFromBuffer($imageBuffer);
1819

1920
$this->assertSame('q+cFHwD1eXbJQopoiJaWqWd2aHBWqQcC', $hashKey);
2021
}

0 commit comments

Comments
 (0)