summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/data/testapp.zipbin0 -> 895 bytes
-rw-r--r--tests/data/testapp2.zipbin0 -> 2449 bytes
-rw-r--r--tests/lib/connector/sabre/objecttree.php3
-rw-r--r--tests/lib/db/migrator.php21
-rw-r--r--tests/lib/installer.php77
-rw-r--r--tests/preseed-config.php2
6 files changed, 101 insertions, 2 deletions
diff --git a/tests/data/testapp.zip b/tests/data/testapp.zip
new file mode 100644
index 00000000000..e76c0d18724
--- /dev/null
+++ b/tests/data/testapp.zip
Binary files differ
diff --git a/tests/data/testapp2.zip b/tests/data/testapp2.zip
new file mode 100644
index 00000000000..f46832f7a75
--- /dev/null
+++ b/tests/data/testapp2.zip
Binary files differ
diff --git a/tests/lib/connector/sabre/objecttree.php b/tests/lib/connector/sabre/objecttree.php
index 0075b7832b8..a88e23bbe2f 100644
--- a/tests/lib/connector/sabre/objecttree.php
+++ b/tests/lib/connector/sabre/objecttree.php
@@ -110,7 +110,8 @@ class ObjectTree extends PHPUnit_Framework_TestCase {
->will($this->returnValue(false));
/** @var $objectTree \OC\Connector\Sabre\ObjectTree */
- $objectTree->init($rootDir, $view);
+ $mountManager = \OC\Files\Filesystem::getMountManager();
+ $objectTree->init($rootDir, $view, $mountManager);
$objectTree->move($source, $dest);
}
diff --git a/tests/lib/db/migrator.php b/tests/lib/db/migrator.php
index e9b986236b8..e94d550f836 100644
--- a/tests/lib/db/migrator.php
+++ b/tests/lib/db/migrator.php
@@ -119,4 +119,25 @@ class Migrator extends \PHPUnit_Framework_TestCase {
$this->assertTrue(true);
}
}
+
+ public function testAddingPrimaryKeyWithAutoIncrement() {
+ $startSchema = new Schema(array(), array(), $this->getSchemaConfig());
+ $table = $startSchema->createTable($this->tableName);
+ $table->addColumn('id', 'integer');
+ $table->addColumn('name', 'string');
+
+ $endSchema = new Schema(array(), array(), $this->getSchemaConfig());
+ $table = $endSchema->createTable($this->tableName);
+ $table->addColumn('id', 'integer', array('autoincrement' => true));
+ $table->addColumn('name', 'string');
+ $table->setPrimaryKey(array('id'));
+
+ $migrator = $this->getMigrator();
+ $migrator->migrate($startSchema);
+
+ $migrator->checkMigrate($endSchema);
+ $migrator->migrate($endSchema);
+
+ $this->assertTrue(true);
+ }
}
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);
+ }
+}
diff --git a/tests/preseed-config.php b/tests/preseed-config.php
index 95ffb4514bf..3fd5b3cb7fc 100644
--- a/tests/preseed-config.php
+++ b/tests/preseed-config.php
@@ -7,7 +7,7 @@ $CONFIG = array (
array (
'path' => OC::$SERVERROOT.'/apps',
'url' => '/apps',
- 'writable' => false,
+ 'writable' => true,
),
1 =>
array (