summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/App/AppStore/Bundles/BundleBase.php60
-rw-r--r--tests/lib/App/AppStore/Bundles/BundleFetcherTest.php78
-rw-r--r--tests/lib/App/AppStore/Bundles/CoreBundleTest.php36
-rw-r--r--tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php41
-rw-r--r--tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php38
-rw-r--r--tests/lib/App/AppStore/Bundles/SocialSharingBundleTest.php40
-rw-r--r--tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php95
-rw-r--r--tests/lib/Contacts/ContactsMenu/ManagerTest.php45
-rw-r--r--tests/lib/InstallerTest.php17
-rw-r--r--tests/lib/Repair/NC12/InstallCoreBundleTest.php144
10 files changed, 590 insertions, 4 deletions
diff --git a/tests/lib/App/AppStore/Bundles/BundleBase.php b/tests/lib/App/AppStore/Bundles/BundleBase.php
new file mode 100644
index 00000000000..23af1cda927
--- /dev/null
+++ b/tests/lib/App/AppStore/Bundles/BundleBase.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\App\AppStore\Bundles;
+
+use OC\App\AppStore\Bundles\Bundle;
+use OCP\IL10N;
+use Test\TestCase;
+
+abstract class BundleBase extends TestCase {
+ /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
+ protected $l10n;
+ /** @var Bundle */
+ protected $bundle;
+ /** @var string */
+ protected $bundleIdentifier;
+ /** @var string */
+ protected $bundleName;
+ /** @var array */
+ protected $bundleAppIds;
+
+ public function setUp() {
+ parent::setUp();
+ $this->l10n = $this->createMock(IL10N::class);
+ $this->l10n->method('t')
+ ->will($this->returnCallback(function ($text, $parameters = []) {
+ return vsprintf($text, $parameters);
+ }));
+ }
+
+ public function testGetIdentifier() {
+ $this->assertSame($this->bundleIdentifier, $this->bundle->getIdentifier());
+ }
+
+ public function testGetName() {
+ $this->assertSame($this->bundleName, $this->bundle->getName());
+ }
+
+ public function testGetAppIdentifiers() {
+ $this->assertSame($this->bundleAppIds, $this->bundle->getAppIdentifiers());
+ }
+}
diff --git a/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php b/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php
new file mode 100644
index 00000000000..71f9820fc72
--- /dev/null
+++ b/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ * @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\App\AppStore\Bundles;
+
+use OC\App\AppStore\Bundles\BundleFetcher;
+use OC\App\AppStore\Bundles\CoreBundle;
+use OC\App\AppStore\Bundles\EnterpriseBundle;
+use OC\App\AppStore\Bundles\GroupwareBundle;
+use OC\App\AppStore\Bundles\SocialSharingBundle;
+use OCP\IL10N;
+use Test\TestCase;
+
+class BundleFetcherTest extends TestCase {
+ /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
+ private $l10n;
+ /** @var BundleFetcher */
+ private $bundleFetcher;
+
+ public function setUp() {
+ parent::setUp();
+
+ $this->l10n = $this->createMock(IL10N::class);
+
+ $this->bundleFetcher = new BundleFetcher(
+ $this->l10n
+ );
+ }
+
+ public function testGetBundles() {
+ $expected = [
+ new EnterpriseBundle($this->l10n),
+ new GroupwareBundle($this->l10n),
+ new SocialSharingBundle($this->l10n),
+ ];
+ $this->assertEquals($expected, $this->bundleFetcher->getBundles());
+ }
+
+ public function testGetDefaultInstallationBundle() {
+ $expected = [
+ new CoreBundle($this->l10n),
+ ];
+ $this->assertEquals($expected, $this->bundleFetcher->getDefaultInstallationBundle());
+ }
+
+ public function testGetBundleByIdentifier() {
+ $this->assertEquals(new EnterpriseBundle($this->l10n), $this->bundleFetcher->getBundleByIdentifier('EnterpriseBundle'));
+ $this->assertEquals(new CoreBundle($this->l10n), $this->bundleFetcher->getBundleByIdentifier('CoreBundle'));
+ $this->assertEquals(new GroupwareBundle($this->l10n), $this->bundleFetcher->getBundleByIdentifier('GroupwareBundle'));
+ }
+
+ /**
+ * @expectedException \BadMethodCallException
+ * @expectedExceptionMessage Bundle with specified identifier does not exist
+ */
+ public function testGetBundleByIdentifierWithException() {
+ $this->bundleFetcher->getBundleByIdentifier('NotExistingBundle');
+ }
+
+}
diff --git a/tests/lib/App/AppStore/Bundles/CoreBundleTest.php b/tests/lib/App/AppStore/Bundles/CoreBundleTest.php
new file mode 100644
index 00000000000..235e2ec84fe
--- /dev/null
+++ b/tests/lib/App/AppStore/Bundles/CoreBundleTest.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\App\AppStore\Bundles;
+
+use OC\App\AppStore\Bundles\CoreBundle;
+
+class CoreBundleTest extends BundleBase {
+ public function setUp() {
+ parent::setUp();
+ $this->bundle = new CoreBundle($this->l10n);
+ $this->bundleIdentifier = 'CoreBundle';
+ $this->bundleName = 'Core bundle';
+ $this->bundleAppIds = [
+ 'bruteforcesettings',
+ ];
+ }
+}
diff --git a/tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php b/tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php
new file mode 100644
index 00000000000..e75486b3ed5
--- /dev/null
+++ b/tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\App\AppStore\Bundles;
+
+use OC\App\AppStore\Bundles\EnterpriseBundle;
+
+class EnterpriseBundleTest extends BundleBase {
+ public function setUp() {
+ parent::setUp();
+ $this->bundle = new EnterpriseBundle($this->l10n);
+ $this->bundleIdentifier = 'EnterpriseBundle';
+ $this->bundleName = 'Enterprise bundle';
+ $this->bundleAppIds = [
+ 'admin_audit',
+ 'user_ldap',
+ 'files_retention',
+ 'files_automatedtagging',
+ 'user_saml',
+ 'files_accesscontrol',
+ ];
+ }
+}
diff --git a/tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php b/tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php
new file mode 100644
index 00000000000..f2f9dcc5ccc
--- /dev/null
+++ b/tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\App\AppStore\Bundles;
+
+use OC\App\AppStore\Bundles\GroupwareBundle;
+
+class GroupwareBundleTest extends BundleBase {
+ public function setUp() {
+ parent::setUp();
+ $this->bundle = new GroupwareBundle($this->l10n);
+ $this->bundleIdentifier = 'GroupwareBundle';
+ $this->bundleName = 'Groupware bundle';
+ $this->bundleAppIds = [
+ 'calendar',
+ 'contacts',
+ 'spreed',
+ ];
+ }
+}
diff --git a/tests/lib/App/AppStore/Bundles/SocialSharingBundleTest.php b/tests/lib/App/AppStore/Bundles/SocialSharingBundleTest.php
new file mode 100644
index 00000000000..02ea0eb6ae5
--- /dev/null
+++ b/tests/lib/App/AppStore/Bundles/SocialSharingBundleTest.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\App\AppStore\Bundles;
+
+use OC\App\AppStore\Bundles\SocialSharingBundle;
+
+class SocialSharingBundleTest extends BundleBase {
+ public function setUp() {
+ parent::setUp();
+ $this->bundle = new SocialSharingBundle($this->l10n);
+ $this->bundleIdentifier = 'SocialSharingBundle';
+ $this->bundleName = 'Social sharing bundle';
+ $this->bundleAppIds = [
+ 'socialsharing_twitter',
+ 'socialsharing_googleplus',
+ 'socialsharing_facebook',
+ 'socialsharing_email',
+ 'socialsharing_diaspora',
+ ];
+ }
+}
diff --git a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
index 80c26a9078e..08da360388f 100644
--- a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
+++ b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
@@ -157,4 +157,99 @@ class ContactsStoreTest extends TestCase {
$this->assertEquals('https://photo', $entries[1]->getAvatar());
}
+ public function testFindOneUser() {
+ $user = $this->createMock(IUser::class);
+ $this->contactsManager->expects($this->once())
+ ->method('search')
+ ->with($this->equalTo('a567'), $this->equalTo(['UID']))
+ ->willReturn([
+ [
+ 'UID' => 123,
+ 'isLocalSystemBook' => false
+ ],
+ [
+ 'UID' => 'a567',
+ 'FN' => 'Darren Roner',
+ 'EMAIL' => [
+ 'darren@roner.au'
+ ],
+ 'isLocalSystemBook' => true
+ ],
+ ]);
+ $user->expects($this->once())
+ ->method('getUID')
+ ->willReturn('user123');
+
+ $entry = $this->contactsStore->findOne($user, 0, 'a567');
+
+ $this->assertEquals([
+ 'darren@roner.au'
+ ], $entry->getEMailAddresses());
+ }
+
+ public function testFindOneEMail() {
+ $user = $this->createMock(IUser::class);
+ $this->contactsManager->expects($this->once())
+ ->method('search')
+ ->with($this->equalTo('darren@roner.au'), $this->equalTo(['EMAIL']))
+ ->willReturn([
+ [
+ 'UID' => 123,
+ 'isLocalSystemBook' => false
+ ],
+ [
+ 'UID' => 'a567',
+ 'FN' => 'Darren Roner',
+ 'EMAIL' => [
+ 'darren@roner.au'
+ ],
+ 'isLocalSystemBook' => false
+ ],
+ ]);
+ $user->expects($this->once())
+ ->method('getUID')
+ ->willReturn('user123');
+
+ $entry = $this->contactsStore->findOne($user, 4, 'darren@roner.au');
+
+ $this->assertEquals([
+ 'darren@roner.au'
+ ], $entry->getEMailAddresses());
+ }
+
+ public function testFindOneNotSupportedType() {
+ $user = $this->createMock(IUser::class);
+
+ $entry = $this->contactsStore->findOne($user, 42, 'darren@roner.au');
+
+ $this->assertEquals(null, $entry);
+ }
+
+ public function testFindOneNoMatches() {
+ $user = $this->createMock(IUser::class);
+ $this->contactsManager->expects($this->once())
+ ->method('search')
+ ->with($this->equalTo('a567'), $this->equalTo(['UID']))
+ ->willReturn([
+ [
+ 'UID' => 123,
+ 'isLocalSystemBook' => false
+ ],
+ [
+ 'UID' => 'a567',
+ 'FN' => 'Darren Roner',
+ 'EMAIL' => [
+ 'darren@roner.au123'
+ ],
+ 'isLocalSystemBook' => false
+ ],
+ ]);
+ $user->expects($this->once())
+ ->method('getUID')
+ ->willReturn('user123');
+
+ $entry = $this->contactsStore->findOne($user, 0, 'a567');
+
+ $this->assertEquals(null, $entry);
+ }
}
diff --git a/tests/lib/Contacts/ContactsMenu/ManagerTest.php b/tests/lib/Contacts/ContactsMenu/ManagerTest.php
index 9c92ec54b9f..783e5590a29 100644
--- a/tests/lib/Contacts/ContactsMenu/ManagerTest.php
+++ b/tests/lib/Contacts/ContactsMenu/ManagerTest.php
@@ -99,4 +99,49 @@ class ManagerTest extends TestCase {
$this->assertEquals($expected, $data);
}
+ public function testFindOne() {
+ $shareTypeFilter = 42;
+ $shareWithFilter = 'foobar';
+
+ $user = $this->createMock(IUser::class);
+ $entry = current($this->generateTestEntries());
+ $provider = $this->createMock(IProvider::class);
+ $this->contactsStore->expects($this->once())
+ ->method('findOne')
+ ->with($user, $shareTypeFilter, $shareWithFilter)
+ ->willReturn($entry);
+ $this->actionProviderStore->expects($this->once())
+ ->method('getProviders')
+ ->with($user)
+ ->willReturn([$provider]);
+ $provider->expects($this->once())
+ ->method('process');
+
+ $data = $this->manager->findOne($user, $shareTypeFilter, $shareWithFilter);
+
+ $this->assertEquals($entry, $data);
+ }
+
+ public function testFindOne404() {
+ $shareTypeFilter = 42;
+ $shareWithFilter = 'foobar';
+
+ $user = $this->createMock(IUser::class);
+ $provider = $this->createMock(IProvider::class);
+ $this->contactsStore->expects($this->once())
+ ->method('findOne')
+ ->with($user, $shareTypeFilter, $shareWithFilter)
+ ->willReturn(null);
+ $this->actionProviderStore->expects($this->never())
+ ->method('getProviders')
+ ->with($user)
+ ->willReturn([$provider]);
+ $provider->expects($this->never())
+ ->method('process');
+
+ $data = $this->manager->findOne($user, $shareTypeFilter, $shareWithFilter);
+
+ $this->assertEquals(null, $data);
+ }
+
}
diff --git a/tests/lib/InstallerTest.php b/tests/lib/InstallerTest.php
index d1923970588..a31c8826bd9 100644
--- a/tests/lib/InstallerTest.php
+++ b/tests/lib/InstallerTest.php
@@ -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);
diff --git a/tests/lib/Repair/NC12/InstallCoreBundleTest.php b/tests/lib/Repair/NC12/InstallCoreBundleTest.php
new file mode 100644
index 00000000000..3a72934df86
--- /dev/null
+++ b/tests/lib/Repair/NC12/InstallCoreBundleTest.php
@@ -0,0 +1,144 @@
+<?php
+/**
+ * @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @author Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\Repair\NC12;
+
+use OC\App\AppStore\Bundles\Bundle;
+use OC\App\AppStore\Bundles\BundleFetcher;
+use OC\Installer;
+use OC\Repair\NC12\InstallCoreBundle;
+use OCP\IConfig;
+use OCP\Migration\IOutput;
+use Test\TestCase;
+
+
+class InstallCoreBundleTest extends TestCase {
+ /** @var BundleFetcher|\PHPUnit_Framework_MockObject_MockObject */
+ private $bundleFetcher;
+ /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ private $config;
+ /** @var Installer|\PHPUnit_Framework_MockObject_MockObject */
+ private $installer;
+ /** @var InstallCoreBundle */
+ private $installCoreBundle;
+
+ public function setUp() {
+ parent::setUp();
+ $this->bundleFetcher = $this->createMock(BundleFetcher::class);
+ $this->config = $this->createMock(IConfig::class);
+ $this->installer = $this->createMock(Installer::class);
+
+ $this->installCoreBundle = new InstallCoreBundle(
+ $this->bundleFetcher,
+ $this->config,
+ $this->installer
+ );
+ }
+
+ public function testGetName() {
+ $this->assertSame('Install new core bundle components', $this->installCoreBundle->getName());
+ }
+
+ public function testRunOlder() {
+ $this->config
+ ->expects($this->once())
+ ->method('getSystemValue')
+ ->with('version', '0.0.0')
+ ->willReturn('12.0.0.15');
+ $this->bundleFetcher
+ ->expects($this->never())
+ ->method('getDefaultInstallationBundle');
+ /** @var IOutput|\PHPUnit_Framework_MockObject_MockObject $output */
+ $output = $this->createMock(IOutput::class);
+ $output
+ ->expects($this->never())
+ ->method('info');
+ $output
+ ->expects($this->never())
+ ->method('warning');
+
+ $this->installCoreBundle->run($output);
+ }
+
+ public function testRunWithException() {
+ $this->config
+ ->expects($this->once())
+ ->method('getSystemValue')
+ ->with('version', '0.0.0')
+ ->willReturn('12.0.0.14');
+ $bundle = $this->createMock(Bundle::class);
+ $this->bundleFetcher
+ ->expects($this->once())
+ ->method('getDefaultInstallationBundle')
+ ->willReturn([
+ $bundle,
+ ]);
+ $this->installer
+ ->expects($this->once())
+ ->method('installAppBundle')
+ ->with($bundle)
+ ->willThrowException(new \Exception('ExceptionText'));
+ /** @var IOutput|\PHPUnit_Framework_MockObject_MockObject $output */
+ $output = $this->createMock(IOutput::class);
+ $output
+ ->expects($this->never())
+ ->method('info');
+ $output
+ ->expects($this->once())
+ ->method('warning')
+ ->with('Could not install core app bundle: ExceptionText');
+
+ $this->installCoreBundle->run($output);
+ }
+
+ public function testRun() {
+ $this->config
+ ->expects($this->once())
+ ->method('getSystemValue')
+ ->with('version', '0.0.0')
+ ->willReturn('12.0.0.14');
+ $bundle = $this->createMock(Bundle::class);
+ $this->bundleFetcher
+ ->expects($this->once())
+ ->method('getDefaultInstallationBundle')
+ ->willReturn([
+ $bundle,
+ ]);
+ $this->installer
+ ->expects($this->once())
+ ->method('installAppBundle')
+ ->with($bundle);
+ /** @var IOutput|\PHPUnit_Framework_MockObject_MockObject $output */
+ $output = $this->createMock(IOutput::class);
+ $output
+ ->expects($this->once())
+ ->method('info')
+ ->with('Successfully installed core app bundle.');
+ $output
+ ->expects($this->never())
+ ->method('warning');
+
+ $this->installCoreBundle->run($output);
+ }
+
+}