From e39511e3dc5d721af0196f6e8389e03fda4ad2f3 Mon Sep 17 00:00:00 2001 From: gmorel Date: Mon, 23 Sep 2013 14:55:36 +0200 Subject: [PATCH] Working : Upload image : Fix unit tests --- .../Thelia/Tests/Tools/FileManagerTest.php | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/core/lib/Thelia/Tests/Tools/FileManagerTest.php b/core/lib/Thelia/Tests/Tools/FileManagerTest.php index 25ecd52af..04fa23144 100644 --- a/core/lib/Thelia/Tests/Tools/FileManagerTest.php +++ b/core/lib/Thelia/Tests/Tools/FileManagerTest.php @@ -13,7 +13,6 @@ namespace Thelia\Tests\Type; use Thelia\Core\Event\ImagesCreateOrUpdateEvent; use Thelia\Exception\ImageException; use Thelia\Model\Admin; -use Thelia\Model\ProductImage; use Thelia\Tools\FileManager; class FileManagerTest extends \PHPUnit_Framework_TestCase { @@ -195,6 +194,9 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { $stubProductImage->expects($this->any()) ->method('save') ->will($this->returnValue(10)); + $stubProductImage->expects($this->any()) + ->method('getFile') + ->will($this->returnValue('file')); $fileManager = new FileManager($stubContainer); @@ -221,6 +223,9 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { $stubCategoryImage->expects($this->any()) ->method('save') ->will($this->returnValue(10)); + $stubCategoryImage->expects($this->any()) + ->method('getFile') + ->will($this->returnValue('file')); $fileManager = new FileManager($stubContainer); @@ -247,6 +252,9 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { $stubFolderImage->expects($this->any()) ->method('save') ->will($this->returnValue(10)); + $stubFolderImage->expects($this->any()) + ->method('getFile') + ->will($this->returnValue('file')); $fileManager = new FileManager($stubContainer); @@ -273,6 +281,9 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { $stubContentImage->expects($this->any()) ->method('save') ->will($this->returnValue(10)); + $stubContentImage->expects($this->any()) + ->method('getFile') + ->will($this->returnValue('file')); $fileManager = new FileManager($stubContainer); @@ -301,11 +312,13 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { $stubProductImage->expects($this->any()) ->method('save') ->will($this->returnValue(10)); + $stubProductImage->expects($this->any()) + ->method('getFile') + ->will($this->returnValue('file')); $event = new ImagesCreateOrUpdateEvent('bad', 24); - $modelImage = new ProductImage(); - $fileManager->saveImage($event, $modelImage); + $fileManager->saveImage($event, $stubProductImage); } /** @@ -325,6 +338,9 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { $stubProductImage->expects($this->any()) ->method('save') ->will($this->returnValue(0)); + $stubProductImage->expects($this->any()) + ->method('getFile') + ->will($this->returnValue('file')); $event = new ImagesCreateOrUpdateEvent(ImagesCreateOrUpdateEvent::TYPE_PRODUCT, 24);