Browse Source

Fix tests

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
tags/v14.0.0beta1
Roeland Jago Douma 6 years ago
parent
commit
362e6b2903
No account linked to committer's email address

+ 11
- 5
apps/theming/tests/IconBuilderTest.php View File

@@ -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);

+ 2
- 1
tests/Core/Controller/CssControllerTest.php View File

@@ -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')

+ 2
- 1
tests/Core/Controller/JsControllerTest.php View File

@@ -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')

+ 2
- 1
tests/lib/App/AppStore/Fetcher/AppFetcherTest.php View File

@@ -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')

+ 2
- 1
tests/lib/App/AppStore/Fetcher/FetcherBase.php View File

@@ -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')

+ 2
- 1
tests/lib/Security/IdentityProof/ManagerTest.php View File

@@ -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')

+ 2
- 1
tests/lib/Template/CSSResourceLocatorTest.php View File

@@ -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);

+ 2
- 1
tests/lib/Template/SCSSCacherTest.php View File

@@ -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);

Loading…
Cancel
Save