From 2430ebe95d7a2a639e4f7dd1cefaa62a4e13ef12 Mon Sep 17 00:00:00 2001
From: resurtm <resurtm@gmail.com>
Date: Wed, 22 May 2013 22:37:09 +0600
Subject: [PATCH] MSSQL AR tests.

---
 framework/yii/db/mssql/Schema.php                       |  7 -------
 tests/unit/framework/db/mssql/MssqlActiveRecordTest.php | 12 ++++++++++++
 2 files changed, 12 insertions(+), 7 deletions(-)
 create mode 100644 tests/unit/framework/db/mssql/MssqlActiveRecordTest.php

diff --git a/framework/yii/db/mssql/Schema.php b/framework/yii/db/mssql/Schema.php
index f37ae8f..c52dfc3 100644
--- a/framework/yii/db/mssql/Schema.php
+++ b/framework/yii/db/mssql/Schema.php
@@ -290,13 +290,6 @@ SQL;
 		$table->primaryKey = $this->db
 			->createCommand($sql, array(':tableName' => $table->name, ':schemaName' => $table->schemaName))
 			->queryColumn();
-		if (count($table->primaryKey) == 0) {
-			// table does not have primary key
-			$table->primaryKey = null;
-		} elseif (count($table->primaryKey) == 1) {
-			// table has one primary key
-			$table->primaryKey = $table->primaryKey[0];
-		}
 	}
 
 	/**
diff --git a/tests/unit/framework/db/mssql/MssqlActiveRecordTest.php b/tests/unit/framework/db/mssql/MssqlActiveRecordTest.php
new file mode 100644
index 0000000..2cf0b01
--- /dev/null
+++ b/tests/unit/framework/db/mssql/MssqlActiveRecordTest.php
@@ -0,0 +1,12 @@
+<?php
+
+namespace yiiunit\framework\db\mssql;
+
+class MssqlActiveRecordTest extends \yiiunit\framework\db\ActiveRecordTest
+{
+    protected function setUp()
+    {
+        $this->driverName = 'sqlsrv';
+        parent::setUp();
+    }
+}
--
libgit2 0.27.1