Jeroen De Dauw has submitted this change and it was merged.
Change subject: Add tests for mysql PRIMARY and UNIQUE indexes
......................................................................
Add tests for mysql PRIMARY and UNIQUE indexes
Change-Id: I8230aca62bd47982e9e08b6924f22e6d3012a9e1
---
M tests/phpunit/MySQL/MySQLTableDefinitionReaderTest.php
1 file changed, 21 insertions(+), 8 deletions(-)
Approvals:
Jeroen De Dauw: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/phpunit/MySQL/MySQLTableDefinitionReaderTest.php
b/tests/phpunit/MySQL/MySQLTableDefinitionReaderTest.php
index 049b1d8..f1555cf 100644
--- a/tests/phpunit/MySQL/MySQLTableDefinitionReaderTest.php
+++ b/tests/phpunit/MySQL/MySQLTableDefinitionReaderTest.php
@@ -64,19 +64,20 @@
public function sqlAndDefinitionProvider() {
$argLists = array();
- //TODO test case containing constraints PRIMARY & UNIQUE
-
$argLists[] = array(
array(
array(
(object)array( 'name' =>
'primaryField', 'type' => 'INT', 'cannull' => 'NO', 'defaultvalue' => null,
'extra' => '' ),
- (object)array( 'name' => 'textField',
'type' => 'BLOB', 'cannull' => 'YES', 'defaultvalue' => null, 'extra' => '' ),
- (object)array( 'name' => 'intField',
'type' => 'INT', 'cannull' => 'NO', 'defaultvalue' => 42, 'extra' => '' ),
+ (object)array( 'name' => 'textField',
'type' => 'BLOB', 'cannull' => 'YES', 'defaultvalue' => 'foo', 'extra' => '' ),
+ (object)array( 'name' => 'intField',
'type' => 'INT', 'cannull' => 'NO', 'defaultvalue' => null, 'extra' => '' ),
(object)array( 'name' => 'boolField',
'type' => 'TINYINT', 'cannull' => 'YES', 'defaultvalue' => null, 'extra' => ''
),
(object)array( 'name' => 'floatField',
'type' => 'FLOAT', 'cannull' => 'YES', 'defaultvalue' => null, 'extra' => '' ),
),
- //TODO test UNIQUE and PRIMARY keys
- array( null ),
+ array(
+ (object)array( 'name' => 'PRIMARY',
'columnName' => 'intField' ),
+ (object)array( 'name' =>
'uniqueIndexName', 'columnName' => 'floatField' ),
+ (object)array( 'name' =>
'uniqueIndexName', 'columnName' => 'boolField' ),
+ ),
array( (object)array( 'name' => 'indexName',
'columns' => 'intField,textField' ) )
),
new TableDefinition(
@@ -90,12 +91,14 @@
),
new FieldDefinition(
'textField',
- FieldDefinition::TYPE_TEXT
+ FieldDefinition::TYPE_TEXT,
+ FieldDefinition::NULL,
+ 'foo'
),
new FieldDefinition(
'intField',
FieldDefinition::TYPE_INTEGER,
- FieldDefinition::NOT_NULL, 42
+ FieldDefinition::NOT_NULL
),
new FieldDefinition(
'boolField',
@@ -108,6 +111,16 @@
),
array(
new IndexDefinition(
+ 'uniqueIndexName',
+ array( 'floatField' => 0,
'boolField' => 0 ),
+ IndexDefinition::TYPE_UNIQUE
+ ),
+ new IndexDefinition(
+ 'PRIMARY',
+ array( 'intField' => 0 ),
+ IndexDefinition::TYPE_PRIMARY
+ ),
+ new IndexDefinition(
'indexName',
array( 'intField' => 0,
'textField' => 0 ),
IndexDefinition::TYPE_INDEX
--
To view, visit https://gerrit.wikimedia.org/r/89702
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8230aca62bd47982e9e08b6924f22e6d3012a9e1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseDatabase
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits