From 362e6b29038ae43d65114062c254774bc3b64803 Mon Sep 17 00:00:00 2001
From: Roeland Jago Douma <roeland@famdouma.nl>
Date: Tue, 8 May 2018 20:59:31 +0200
Subject: [PATCH] Fix tests

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
---
 apps/theming/tests/IconBuilderTest.php           | 16 +++++++++++-----
 tests/Core/Controller/CssControllerTest.php      |  3 ++-
 tests/Core/Controller/JsControllerTest.php       |  3 ++-
 .../lib/App/AppStore/Fetcher/AppFetcherTest.php  |  3 ++-
 tests/lib/App/AppStore/Fetcher/FetcherBase.php   |  3 ++-
 tests/lib/Security/IdentityProof/ManagerTest.php |  3 ++-
 tests/lib/Template/CSSResourceLocatorTest.php    |  3 ++-
 tests/lib/Template/SCSSCacherTest.php            |  3 ++-
 8 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/apps/theming/tests/IconBuilderTest.php b/apps/theming/tests/IconBuilderTest.php
index a2a330a2f24..1b9f204cd9e 100644
--- a/apps/theming/tests/IconBuilderTest.php
+++ b/apps/theming/tests/IconBuilderTest.php
@@ -25,13 +25,11 @@
  */
 namespace OCA\Theming\Tests;
 
+use OC\Files\AppData\AppData;
 use OCA\Theming\IconBuilder;
 use OCA\Theming\ThemingDefaults;
 use OCA\Theming\Util;
 use OCP\App\IAppManager;
-use OCP\AppFramework\Http\NotFoundResponse;
-use OCP\Files\IAppData;
-use OCP\Files\IRootFolder;
 use OCP\Files\NotFoundException;
 use OCP\IConfig;
 use PHPUnit\Framework\Error\Warning;
@@ -41,7 +39,7 @@ class IconBuilderTest extends TestCase {
 
 	/** @var IConfig */
 	protected $config;
-	/** @var IAppData */
+	/** @var AppData */
 	protected $appData;
 	/** @var ThemingDefaults */
 	protected $themingDefaults;
@@ -56,7 +54,7 @@ class IconBuilderTest extends TestCase {
 		parent::setUp();
 
 		$this->config = $this->getMockBuilder(IConfig::class)->getMock();
-		$this->appData = $this->createMock(IAppData::class);
+		$this->appData = $this->createMock(AppData::class);
 		$this->themingDefaults = $this->getMockBuilder('OCA\Theming\ThemingDefaults')
 			->disableOriginalConstructor()->getMock();
 		$this->appManager = $this->getMockBuilder('OCP\App\IAppManager')->getMock();
@@ -127,6 +125,10 @@ class IconBuilderTest extends TestCase {
 		$this->themingDefaults->expects($this->once())
 			->method('getColorPrimary')
 			->willReturn($color);
+		$this->appData->expects($this->once())
+			->method('getFolder')
+			->with('images')
+			->willThrowException(new NotFoundException());
 
 		$expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file);
 		$icon = new \Imagick();
@@ -156,6 +158,10 @@ class IconBuilderTest extends TestCase {
 		$this->themingDefaults->expects($this->once())
 			->method('getColorPrimary')
 			->willReturn($color);
+		$this->appData->expects($this->once())
+			->method('getFolder')
+			->with('images')
+			->willThrowException(new NotFoundException());
 
 		$expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file);
 		$actualIcon = $this->iconBuilder->getFavicon($app);
diff --git a/tests/Core/Controller/CssControllerTest.php b/tests/Core/Controller/CssControllerTest.php
index 8ec15f449a0..f4e6e83201e 100644
--- a/tests/Core/Controller/CssControllerTest.php
+++ b/tests/Core/Controller/CssControllerTest.php
@@ -23,6 +23,7 @@
 namespace Tests\Core\Controller;
 
 use OC\Core\Controller\CssController;
+use OC\Files\AppData\AppData;
 use OC\Files\AppData\Factory;
 use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\FileDisplayResponse;
@@ -51,7 +52,7 @@ class CssControllerTest extends TestCase {
 
 		/** @var Factory|\PHPUnit_Framework_MockObject_MockObject $factory */
 		$factory = $this->createMock(Factory::class);
-		$this->appData = $this->createMock(IAppData::class);
+		$this->appData = $this->createMock(AppData::class);
 		$factory->expects($this->once())
 			->method('get')
 			->with('css')
diff --git a/tests/Core/Controller/JsControllerTest.php b/tests/Core/Controller/JsControllerTest.php
index 3910045276b..307ef837786 100644
--- a/tests/Core/Controller/JsControllerTest.php
+++ b/tests/Core/Controller/JsControllerTest.php
@@ -23,6 +23,7 @@
 namespace Tests\Core\Controller;
 
 use OC\Core\Controller\JsController;
+use OC\Files\AppData\AppData;
 use OC\Files\AppData\Factory;
 use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\FileDisplayResponse;
@@ -51,7 +52,7 @@ class JsControllerTest extends TestCase {
 
 		/** @var Factory|\PHPUnit_Framework_MockObject_MockObject $factory */
 		$factory = $this->createMock(Factory::class);
-		$this->appData = $this->createMock(IAppData::class);
+		$this->appData = $this->createMock(AppData::class);
 		$factory->expects($this->once())
 			->method('get')
 			->with('js')
diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
index 59dc7366cc0..1465e09d08b 100644
--- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
@@ -23,6 +23,7 @@ namespace Test\App\AppStore\Fetcher;
 
 use OC\App\AppStore\Fetcher\AppFetcher;
 use OC\App\CompareVersion;
+use OC\Files\AppData\AppData;
 use OC\Files\AppData\Factory;
 use OCP\AppFramework\Utility\ITimeFactory;
 use OCP\Files\IAppData;
@@ -63,7 +64,7 @@ EOD;
 
 		/** @var Factory|PHPUnit_Framework_MockObject_MockObject $factory */
 		$factory = $this->createMock(Factory::class);
-		$this->appData = $this->createMock(IAppData::class);
+		$this->appData = $this->createMock(AppData::class);
 		$factory->expects($this->once())
 			->method('get')
 			->with('appstore')
diff --git a/tests/lib/App/AppStore/Fetcher/FetcherBase.php b/tests/lib/App/AppStore/Fetcher/FetcherBase.php
index 90b7523d850..851773a6506 100644
--- a/tests/lib/App/AppStore/Fetcher/FetcherBase.php
+++ b/tests/lib/App/AppStore/Fetcher/FetcherBase.php
@@ -22,6 +22,7 @@
 namespace Test\App\AppStore\Fetcher;
 
 use OC\App\AppStore\Fetcher\Fetcher;
+use OC\Files\AppData\AppData;
 use OC\Files\AppData\Factory;
 use OCP\AppFramework\Utility\ITimeFactory;
 use OCP\Files\IAppData;
@@ -58,7 +59,7 @@ abstract class FetcherBase extends TestCase {
 	public function setUp() {
 		parent::setUp();
 		$this->appDataFactory = $this->createMock(Factory::class);
-		$this->appData = $this->createMock(IAppData::class);
+		$this->appData = $this->createMock(AppData::class);
 		$this->appDataFactory->expects($this->once())
 			->method('get')
 			->with('appstore')
diff --git a/tests/lib/Security/IdentityProof/ManagerTest.php b/tests/lib/Security/IdentityProof/ManagerTest.php
index 290e7be5c94..9d17182e52e 100644
--- a/tests/lib/Security/IdentityProof/ManagerTest.php
+++ b/tests/lib/Security/IdentityProof/ManagerTest.php
@@ -21,6 +21,7 @@
 
 namespace Test\Security\IdentityProof;
 
+use OC\Files\AppData\AppData;
 use OC\Files\AppData\Factory;
 use OC\Security\IdentityProof\Key;
 use OC\Security\IdentityProof\Manager;
@@ -50,7 +51,7 @@ class ManagerTest extends TestCase  {
 
 		/** @var Factory|\PHPUnit_Framework_MockObject_MockObject $factory */
 		$this->factory = $this->createMock(Factory::class);
-		$this->appData = $this->createMock(IAppData::class);
+		$this->appData = $this->createMock(AppData::class);
 		$this->config = $this->createMock(IConfig::class);
 		$this->factory->expects($this->any())
 			->method('get')
diff --git a/tests/lib/Template/CSSResourceLocatorTest.php b/tests/lib/Template/CSSResourceLocatorTest.php
index 5e2c3705efa..a8b123b8d5b 100644
--- a/tests/lib/Template/CSSResourceLocatorTest.php
+++ b/tests/lib/Template/CSSResourceLocatorTest.php
@@ -23,6 +23,7 @@
 
 namespace Test\Template;
 
+use OC\Files\AppData\AppData;
 use OC\Files\AppData\Factory;
 use OCP\Files\IAppData;
 use OCP\ICacheFactory;
@@ -51,7 +52,7 @@ class CSSResourceLocatorTest extends \Test\TestCase {
 		parent::setUp();
 
 		$this->logger = $this->createMock(ILogger::class);
-		$this->appData = $this->createMock(IAppData::class);
+		$this->appData = $this->createMock(AppData::class);
 		$this->urlGenerator = $this->createMock(IURLGenerator::class);
 		$this->config = $this->createMock(IConfig::class);
 		$this->cacheFactory = $this->createMock(ICacheFactory::class);
diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php
index a55ba30711b..5e3700477ff 100644
--- a/tests/lib/Template/SCSSCacherTest.php
+++ b/tests/lib/Template/SCSSCacherTest.php
@@ -23,6 +23,7 @@
 
 namespace Test\Template;
 
+use OC\Files\AppData\AppData;
 use OC\Files\AppData\Factory;
 use OC\Template\SCSSCacher;
 use OCA\Theming\ThemingDefaults;
@@ -58,7 +59,7 @@ class SCSSCacherTest extends \Test\TestCase {
 	protected function setUp() {
 		parent::setUp();
 		$this->logger = $this->createMock(ILogger::class);
-		$this->appData = $this->createMock(IAppData::class);
+		$this->appData = $this->createMock(AppData::class);
 
 		/** @var Factory|\PHPUnit_Framework_MockObject_MockObject $factory */
 		$factory = $this->createMock(Factory::class);
-- 
GitLab