Addshore has uploaded a new change for review. https://gerrit.wikimedia.org/r/89702
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(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseDatabase refs/changes/02/89702/1 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: newchange Gerrit-Change-Id: I8230aca62bd47982e9e08b6924f22e6d3012a9e1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseDatabase Gerrit-Branch: master Gerrit-Owner: Addshore <addshorew...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits