[Pkg-owncloud-commits] [owncloud] 184/223: Added unit test for checkMigrate with primary key + autoinc

David Prévot taffit at moszumanska.debian.org
Sun Jun 22 01:54:23 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit ffdc1c2fcfd3fe05bd8d5b58839d3610ece0a03e
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Tue Jun 17 15:07:36 2014 +0200

    Added unit test for checkMigrate with primary key + autoinc
    
    Added unit test to make sure that checkMigrate() works when adding a
    primary key and autoincrement column to a table schema.
---
 tests/lib/db/migrator.php | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/tests/lib/db/migrator.php b/tests/lib/db/migrator.php
index e9b9862..e94d550 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);
+	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list