Adjust tests

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
Lukas Reschke 2017-04-25 23:16:52 +02:00
parent d4ba8198fe
commit 3f9aaac4a2
No known key found for this signature in database
GPG Key ID: B9F6980CF6E759B1
2 changed files with 24 additions and 5 deletions

View File

@ -22,6 +22,7 @@
namespace Tests\Settings\Controller;
use OC\App\AppStore\Bundles\BundleFetcher;
use OC\App\AppStore\Fetcher\AppFetcher;
use OC\App\AppStore\Fetcher\CategoryFetcher;
use OC\Settings\Controller\AppSettingsController;
@ -60,6 +61,8 @@ class AppSettingsControllerTest extends TestCase {
private $appFetcher;
/** @var IFactory|\PHPUnit_Framework_MockObject_MockObject */
private $l10nFactory;
/** @var BundleFetcher|\PHPUnit_Framework_MockObject_MockObject */
private $bundleFetcher;
public function setUp() {
parent::setUp();
@ -75,6 +78,7 @@ class AppSettingsControllerTest extends TestCase {
$this->categoryFetcher = $this->createMock(CategoryFetcher::class);
$this->appFetcher = $this->createMock(AppFetcher::class);
$this->l10nFactory = $this->createMock(IFactory::class);
$this->bundleFetcher = $this->createMock(BundleFetcher::class);
$this->appSettingsController = new AppSettingsController(
'settings',
@ -85,7 +89,8 @@ class AppSettingsControllerTest extends TestCase {
$this->appManager,
$this->categoryFetcher,
$this->appFetcher,
$this->l10nFactory
$this->l10nFactory,
$this->bundleFetcher
);
}
@ -101,6 +106,11 @@ class AppSettingsControllerTest extends TestCase {
'ident' => 'enabled',
'displayName' => 'Enabled apps',
],
[
'id' => 3,
'ident' => 'app-bundles',
'displayName' => 'App bundles',
],
[
'id' => 1,
'ident' => 'disabled',

View File

@ -9,11 +9,13 @@
namespace Test;
use OC\App\AppStore\Bundles\Bundle;
use OC\App\AppStore\Fetcher\AppFetcher;
use OC\Archive\ZIP;
use OC\Installer;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\ILogger;
use OCP\ITempManager;
@ -29,6 +31,8 @@ class InstallerTest extends TestCase {
private $tempManager;
/** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
private $logger;
/** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
private $config;
/** @var Installer */
private $installer;
@ -40,11 +44,13 @@ class InstallerTest extends TestCase {
$this->clientService = $this->createMock(IClientService::class);
$this->tempManager = $this->createMock(ITempManager::class);
$this->logger = $this->createMock(ILogger::class);
$this->config = $this->createMock(IConfig::class);
$this->installer = new Installer(
$this->appFetcher,
$this->clientService,
$this->tempManager,
$this->logger
$this->logger,
$this->config
);
$config = \OC::$server->getConfig();
@ -54,7 +60,8 @@ class InstallerTest extends TestCase {
\OC::$server->getAppFetcher(),
\OC::$server->getHTTPClientService(),
\OC::$server->getTempManager(),
\OC::$server->getLogger()
\OC::$server->getLogger(),
$config
);
$installer->removeApp(self::$appid);
}
@ -64,7 +71,8 @@ class InstallerTest extends TestCase {
\OC::$server->getAppFetcher(),
\OC::$server->getHTTPClientService(),
\OC::$server->getTempManager(),
\OC::$server->getLogger()
\OC::$server->getLogger(),
\OC::$server->getConfig()
);
$installer->removeApp(self::$appid);
\OC::$server->getConfig()->setSystemValue('appstoreenabled', $this->appstore);
@ -86,7 +94,8 @@ class InstallerTest extends TestCase {
\OC::$server->getAppFetcher(),
\OC::$server->getHTTPClientService(),
\OC::$server->getTempManager(),
\OC::$server->getLogger()
\OC::$server->getLogger(),
\OC::$server->getConfig()
);
$installer->installApp(self::$appid);
$isInstalled = Installer::isInstalled(self::$appid);