зеркало из https://github.com/nextcloud/cookbook.git
Repair the tests
Signed-off-by: Christian Wolf <github@christianwolf.email>
This commit is contained in:
Родитель
d7ac9f29f4
Коммит
6a92dbe702
|
@ -87,7 +87,7 @@ class ThumbnailFileHelper {
|
|||
private function recreateSingleThumbnail(Folder $recipeFolder, int $type): void {
|
||||
$filename = ImageSize::NAME_MAP[$type];
|
||||
|
||||
if ($this->fileHelper->hasImage($filename)) {
|
||||
if ($this->fileHelper->hasImage($recipeFolder)) {
|
||||
$full = $this->fileHelper->getImage($recipeFolder);
|
||||
$file = $recipeFolder->get($filename);
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ class ImageService {
|
|||
* @return File The file of the thumbnail
|
||||
*/
|
||||
public function getThumbnailAsFile(Folder $recipeFolder, int $type): File {
|
||||
return $this->thumbnailHelper->ensureThumbnailExists($recipeFolder, $type);
|
||||
return $this->thumbnailHelper->getThumbnail($recipeFolder, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1115,8 +1115,6 @@ class RecipeService {
|
|||
default:
|
||||
throw new Exception($this->il10n->t('Image size "%s" is not recognized.', [$size]));
|
||||
}
|
||||
|
||||
throw new Exception($this->il10n->t('Image file not recognised'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,7 +67,7 @@ class ThumbnailFileHelperTest extends TestCase {
|
|||
/**
|
||||
* @dataProvider dpFilename
|
||||
*/
|
||||
public function testEnsureThumbnailExistsWithExistingThumbnail($type, $filename) {
|
||||
public function testGetThumbnailWithExistingThumbnail($type, $filename) {
|
||||
/**
|
||||
* @var MockObject|Folder $f
|
||||
*/
|
||||
|
@ -77,13 +77,13 @@ class ThumbnailFileHelperTest extends TestCase {
|
|||
$file = $this->createStub(File::class);
|
||||
$f->method('get')->with($filename)->willReturn($file);
|
||||
|
||||
$this->assertSame($file, $this->dut->ensureThumbnailExists($f, $type));
|
||||
$this->assertSame($file, $this->dut->getThumbnail($f, $type));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dpFilename
|
||||
*/
|
||||
public function testEnsureThumbnailExistsWithNonExistingThumbnail($type, $filename) {
|
||||
public function testGetThumbnailWithNonExistingThumbnail($type, $filename) {
|
||||
/**
|
||||
* @var MockObject|Folder $f
|
||||
*/
|
||||
|
@ -101,13 +101,13 @@ class ThumbnailFileHelperTest extends TestCase {
|
|||
$this->generationHelper->expects($this->once())->method('generateThumbnail')
|
||||
->with($full, $type, $file);
|
||||
|
||||
$this->assertSame($file, $this->dut->ensureThumbnailExists($f, $type));
|
||||
$this->assertSame($file, $this->dut->getThumbnail($f, $type));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dpFilename
|
||||
*/
|
||||
public function testEnsureThumbnailExistsWithNonExistingMainImage($type, $filename) {
|
||||
public function testGetThumbnailWithNonExistingMainImage($type, $filename) {
|
||||
/**
|
||||
* @var MockObject|Folder $f
|
||||
*/
|
||||
|
@ -122,7 +122,7 @@ class ThumbnailFileHelperTest extends TestCase {
|
|||
|
||||
$this->expectException(NoRecipeImageFoundException::class);
|
||||
|
||||
$this->dut->ensureThumbnailExists($f, $type);
|
||||
$this->dut->getThumbnail($f, $type);
|
||||
}
|
||||
|
||||
public function dpDrop() {
|
||||
|
|
|
@ -74,7 +74,7 @@ class ImageServiceTest extends TestCase {
|
|||
public function testGetThumbnailAsFile($type) {
|
||||
$recipeFolder = $this->createStub(Folder::class);
|
||||
$file = $this->createStub(File::class);
|
||||
$this->thumbnailHelper->method('ensureThumbnailExists')->with($recipeFolder, $type)->willReturn($file);
|
||||
$this->thumbnailHelper->method('getThumbnail')->with($recipeFolder, $type)->willReturn($file);
|
||||
$this->assertSame($file, $this->dut->getThumbnailAsFile($recipeFolder, $type));
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ class ImageServiceTest extends TestCase {
|
|||
$file = $this->createStub(File::class);
|
||||
$content = 'This is the content of the file.';
|
||||
$file->method('getContent')->willReturn($content);
|
||||
$this->thumbnailHelper->method('ensureThumbnailExists')->with($recipeFolder, $type)->willReturn($file);
|
||||
$this->thumbnailHelper->method('getThumbnail')->with($recipeFolder, $type)->willReturn($file);
|
||||
|
||||
$this->assertEquals($content, $this->dut->getThumbnail($recipeFolder, $type));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче