diff options
author | Georg Ehrke <developer@georgehrke.com> | 2014-06-16 15:54:50 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2014-06-16 15:54:50 +0200 |
commit | 15c215cd031602013d982d630306314fc6c1b21c (patch) | |
tree | e7f5bea6cc6d43694cd61dfedaef4ce7723e3b52 /tests/lib | |
parent | b67588d35c2ebf031e4f4f46fbce73fd555d33e8 (diff) | |
parent | 86f546ff6487b9ac8b18ad14ca290b8051f0496e (diff) | |
download | nextcloud-server-15c215cd031602013d982d630306314fc6c1b21c.tar.gz nextcloud-server-15c215cd031602013d982d630306314fc6c1b21c.zip |
Merge pull request #8808 from owncloud/update_shipped_apps_from_appstore
Make shipped apps updatable via appstore
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/installer.php | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/tests/lib/installer.php b/tests/lib/installer.php new file mode 100644 index 00000000000..5e267245200 --- /dev/null +++ b/tests/lib/installer.php @@ -0,0 +1,77 @@ +<?php +/** + * Copyright (c) 2014 Georg Ehrke <georg@owncloud.com> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +class Test_Installer extends PHPUnit_Framework_TestCase { + + private static $appid = 'testapp'; + private $appstore; + + public function setUp() { + $this->appstore = OC_Config::getValue('appstoreenabled', true); + OC_Config::setValue('appstoreenabled', true); + OC_Installer::removeApp(self::$appid); + } + + public function tearDown() { + OC_Installer::removeApp(self::$appid); + OC_Config::setValue('appstoreenabled', $this->appstore); + } + + public function testInstallApp() { + $pathOfTestApp = __DIR__; + $pathOfTestApp .= '/../data/'; + $pathOfTestApp .= 'testapp.zip'; + + $tmp = OC_Helper::tmpFile('.zip'); + OC_Helper::copyr($pathOfTestApp, $tmp); + + $data = array( + 'path' => $tmp, + 'source' => 'path', + ); + + OC_Installer::installApp($data); + $isInstalled = OC_Installer::isInstalled(self::$appid); + + $this->assertTrue($isInstalled); + } + + public function testUpdateApp() { + $pathOfOldTestApp = __DIR__; + $pathOfOldTestApp .= '/../data/'; + $pathOfOldTestApp .= 'testapp.zip'; + + $oldTmp = OC_Helper::tmpFile('.zip'); + OC_Helper::copyr($pathOfOldTestApp, $oldTmp); + + $oldData = array( + 'path' => $oldTmp, + 'source' => 'path', + ); + + $pathOfNewTestApp = __DIR__; + $pathOfNewTestApp .= '/../data/'; + $pathOfNewTestApp .= 'testapp2.zip'; + + $newTmp = OC_Helper::tmpFile('.zip'); + OC_Helper::copyr($pathOfNewTestApp, $newTmp); + + $newData = array( + 'path' => $newTmp, + 'source' => 'path', + ); + + OC_Installer::installApp($oldData); + $oldVersionNumber = OC_App::getAppVersion(self::$appid); + + OC_Installer::updateApp($newData); + $newVersionNumber = OC_App::getAppVersion(self::$appid); + + $this->assertNotEquals($oldVersionNumber, $newVersionNumber); + } +} |