Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/74149
Change subject: Added initial SQLite table creation support ...................................................................... Added initial SQLite table creation support Also got rid of verbose GPL headers Change-Id: I53f04591a48d63e321b119425b7fc9abfb1ea986 --- M WikibaseDatabase.i18n.php M WikibaseDatabase.mw.php M WikibaseDatabase.php M src/DBConnectionProvider.php M src/FieldDefinition.php M src/LazyDBConnectionProvider.php M src/MWDB/ExtendedAbstraction.php M src/MWDB/ExtendedMySQLAbstraction.php A src/MWDB/ExtendedSQLiteAbstraction.php M src/MediaWikiQueryInterface.php M src/MessageReporter.php M src/QueryInterface.php M src/ResultIterator.php M src/TableBuilder.php M src/TableDefinition.php M tests/phpunit/DeleteFailedExceptionTest.php M tests/phpunit/FieldDefinitionTest.php M tests/phpunit/InsertFailedExceptionTest.php M tests/phpunit/MWDB/ExtendedAbstractionTest.php M tests/phpunit/MWDB/ExtendedMySQLAbstractionTest.php A tests/phpunit/MWDB/ExtendedSQLiteAbstractionTest.php M tests/phpunit/MediaWikiQueryInterfaceTest.php M tests/phpunit/ResultIteratorTest.php M tests/phpunit/SelectFailedExceptionTest.php M tests/phpunit/TableBuilderTest.php M tests/phpunit/TableCreationFailedExceptionTest.php M tests/phpunit/TableDefinitionTest.php M tests/phpunit/UpdateFailedExceptionTest.php 28 files changed, 153 insertions(+), 391 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseDatabase refs/changes/49/74149/1 diff --git a/WikibaseDatabase.i18n.php b/WikibaseDatabase.i18n.php index 8ac37b2..9138c00 100644 --- a/WikibaseDatabase.i18n.php +++ b/WikibaseDatabase.i18n.php @@ -3,21 +3,6 @@ /** * Internationalization file for the Wikibase Database component. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @since 0.1 * * @file diff --git a/WikibaseDatabase.mw.php b/WikibaseDatabase.mw.php index 525d1b1..5b2e82d 100644 --- a/WikibaseDatabase.mw.php +++ b/WikibaseDatabase.mw.php @@ -4,21 +4,6 @@ * MediaWiki setup for the Database component of Wikibase. * The component should be included via the main entry point, Database.php. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @since 0.1 * * @file diff --git a/WikibaseDatabase.php b/WikibaseDatabase.php index a10c304..0b041e1 100644 --- a/WikibaseDatabase.php +++ b/WikibaseDatabase.php @@ -3,21 +3,6 @@ /** * Entry point for the Database component of Wikibase. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @since 0.1 * * @file diff --git a/src/DBConnectionProvider.php b/src/DBConnectionProvider.php index 54a50b4..9bac3ab 100644 --- a/src/DBConnectionProvider.php +++ b/src/DBConnectionProvider.php @@ -7,21 +7,6 @@ /** * Interface for database connection providers. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @since 0.1 * * @file diff --git a/src/FieldDefinition.php b/src/FieldDefinition.php index 1797c4b..133830d 100644 --- a/src/FieldDefinition.php +++ b/src/FieldDefinition.php @@ -7,21 +7,6 @@ /** * Definition of a database table field. Immutable. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @since 0.1 * * @file diff --git a/src/LazyDBConnectionProvider.php b/src/LazyDBConnectionProvider.php index 4dfd246..541a649 100644 --- a/src/LazyDBConnectionProvider.php +++ b/src/LazyDBConnectionProvider.php @@ -8,21 +8,6 @@ * Lazy database connection provider. * The connection is fetched when needed using the id provided in the constructor. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @since 0.1 * * @file diff --git a/src/MWDB/ExtendedAbstraction.php b/src/MWDB/ExtendedAbstraction.php index 835046d..a839279 100644 --- a/src/MWDB/ExtendedAbstraction.php +++ b/src/MWDB/ExtendedAbstraction.php @@ -19,21 +19,6 @@ * is first done here. If you feel like taking core CR crap and waiting a few * months, by all means try to get the functionality into core. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @since 0.1 * * @file diff --git a/src/MWDB/ExtendedMySQLAbstraction.php b/src/MWDB/ExtendedMySQLAbstraction.php index 2fe4c7b..80e9e36 100644 --- a/src/MWDB/ExtendedMySQLAbstraction.php +++ b/src/MWDB/ExtendedMySQLAbstraction.php @@ -9,21 +9,6 @@ /** * MySQL implementation of ExtendedAbstraction. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @since 0.1 * * @file diff --git a/src/MWDB/ExtendedSQLiteAbstraction.php b/src/MWDB/ExtendedSQLiteAbstraction.php new file mode 100644 index 0000000..fda2dbf --- /dev/null +++ b/src/MWDB/ExtendedSQLiteAbstraction.php @@ -0,0 +1,110 @@ +<?php + +namespace Wikibase\Database\MWDB; + +use Wikibase\Database\TableDefinition; +use Wikibase\Database\FieldDefinition; +use RuntimeException; + +/** + * SQLite implementation of ExtendedAbstraction. + * + * @since 0.1 + * + * @file + * @ingroup WikibaseDatabase + * + * @licence GNU GPL v2+ + * @author Jeroen De Dauw < jeroended...@gmail.com > + */ +class ExtendedSQLiteAbstraction extends ExtendedAbstraction { + + /** + * @see ExtendedAbstraction::getType + * + * @since 0.1 + * + * @return string + */ + protected function getType() { + return 'sqlite'; + } + + /** + * @see ExtendedAbstraction::createTable + * + * @since 0.1 + * + * @param TableDefinition $table + * + * @return boolean Success indicator + */ + public function createTable( TableDefinition $table ) { + $db = $this->getDB(); + + // TODO: Escape table name? + // TODO: get rid of global (DatabaseBase currently provides no access to its mTablePrefix field) + $sql = 'CREATE TABLE ' . $GLOBALS['wgDBprefix'] . $table->getName() . ' ('; + + $fields = array(); + + foreach ( $table->getFields() as $field ) { + $fields[] = $field->getName() . ' ' . $this->getFieldSQL( $field ); + } + + $sql .= implode( ',', $fields ); + + // TODO: table options + $sql .= ');'; + + $success = $db->query( $sql, __METHOD__ ); + + return $success !== false; + } + + /** + * @since 0.1 + * + * @param FieldDefinition $field + * + * @return string + * @throws RuntimeException + */ + protected function getFieldSQL( FieldDefinition $field ) { + $sql = $this->getFieldType( $field->getType() ); + + if ( $field->getDefault() !== null ) { + $sql .= ' DEFAULT ' . $this->getDB()->addQuotes( $field->getDefault() ); + } + + // TODO: add all field stuff relevant here + + $sql .= $field->allowsNull() ? ' NULL' : ' NOT NULL'; + + return $sql; + } + + /** + * Returns the MySQL field type for a given FieldDefinition type constant. + * + * @param string $fieldType + * + * @return string + * @throws RuntimeException + */ + protected function getFieldType( $fieldType ) { + switch ( $fieldType ) { + case FieldDefinition::TYPE_INTEGER: + return 'INT'; + case FieldDefinition::TYPE_FLOAT: + return 'FLOAT'; + case FieldDefinition::TYPE_TEXT: + return 'BLOB'; + case FieldDefinition::TYPE_BOOLEAN: + return 'TINYINT'; + default: + throw new RuntimeException( __CLASS__ . ' does not support db fields of type ' . $fieldType ); + } + } + +} diff --git a/src/MediaWikiQueryInterface.php b/src/MediaWikiQueryInterface.php index d0c0026..4e78c25 100644 --- a/src/MediaWikiQueryInterface.php +++ b/src/MediaWikiQueryInterface.php @@ -9,21 +9,6 @@ * Implementation of the QueryInterface interface using the MediaWiki * database abstraction layer where possible. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @since 0.1 * * @file diff --git a/src/MessageReporter.php b/src/MessageReporter.php index a961cda..89dffbd 100644 --- a/src/MessageReporter.php +++ b/src/MessageReporter.php @@ -5,21 +5,6 @@ /** * Interface for objects that can report messages. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @since 0.1 * @file * diff --git a/src/QueryInterface.php b/src/QueryInterface.php index 647c205..e7fe2f8 100644 --- a/src/QueryInterface.php +++ b/src/QueryInterface.php @@ -5,21 +5,6 @@ /** * Interface for objects that provide a database query service. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @since 0.1 * * @file diff --git a/src/ResultIterator.php b/src/ResultIterator.php index a7cd243..8477f04 100644 --- a/src/ResultIterator.php +++ b/src/ResultIterator.php @@ -6,21 +6,6 @@ * Iterator for selection results. * Each item is an object that has as properties the field names. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @since 0.1 * * @file diff --git a/src/TableBuilder.php b/src/TableBuilder.php index db35afc..9d54948 100644 --- a/src/TableBuilder.php +++ b/src/TableBuilder.php @@ -5,21 +5,6 @@ /** * Object that can create a table in a database given a table definition. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @since 0.1 * * @file diff --git a/src/TableDefinition.php b/src/TableDefinition.php index 8f95da7..ca86411 100644 --- a/src/TableDefinition.php +++ b/src/TableDefinition.php @@ -7,21 +7,6 @@ /** * Definition of a database table. Immutable. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @since 0.1 * * @file diff --git a/tests/phpunit/DeleteFailedExceptionTest.php b/tests/phpunit/DeleteFailedExceptionTest.php index 4ffc7c6..07769c8 100644 --- a/tests/phpunit/DeleteFailedExceptionTest.php +++ b/tests/phpunit/DeleteFailedExceptionTest.php @@ -7,21 +7,6 @@ /** * @covers Wikibase\Database\DeleteFailedException * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @file * @since 0.1 * diff --git a/tests/phpunit/FieldDefinitionTest.php b/tests/phpunit/FieldDefinitionTest.php index c47d090..2c1fb5a 100644 --- a/tests/phpunit/FieldDefinitionTest.php +++ b/tests/phpunit/FieldDefinitionTest.php @@ -7,21 +7,6 @@ /** * @covers Wikibase\Database\FieldDefinition * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @file * @since 0.1 * diff --git a/tests/phpunit/InsertFailedExceptionTest.php b/tests/phpunit/InsertFailedExceptionTest.php index d3dc897..6de251e 100644 --- a/tests/phpunit/InsertFailedExceptionTest.php +++ b/tests/phpunit/InsertFailedExceptionTest.php @@ -7,21 +7,6 @@ /** * @covers Wikibase\Database\InsertFailedException * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @file * @since 0.1 * diff --git a/tests/phpunit/MWDB/ExtendedAbstractionTest.php b/tests/phpunit/MWDB/ExtendedAbstractionTest.php index 3ba4f29..bd70018 100644 --- a/tests/phpunit/MWDB/ExtendedAbstractionTest.php +++ b/tests/phpunit/MWDB/ExtendedAbstractionTest.php @@ -9,21 +9,6 @@ /** * Base class with tests for the Wikibase\Database\MWDB\ExtendedAbstraction deriving classes. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @file * @since 0.1 * @@ -109,7 +94,7 @@ ); $this->assertTrue( - $extendedAbstraction->getDB()->dropTable( $table->getName() ), + $extendedAbstraction->getDB()->dropTable( $table->getName() ) !== false, 'Table removal worked' ); diff --git a/tests/phpunit/MWDB/ExtendedMySQLAbstractionTest.php b/tests/phpunit/MWDB/ExtendedMySQLAbstractionTest.php index c13194b..d454e68 100644 --- a/tests/phpunit/MWDB/ExtendedMySQLAbstractionTest.php +++ b/tests/phpunit/MWDB/ExtendedMySQLAbstractionTest.php @@ -8,21 +8,6 @@ /** * @covers Wikibase\Database\MWDB\ExtendedMySQLAbstraction * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @file * @since 0.1 * diff --git a/tests/phpunit/MWDB/ExtendedSQLiteAbstractionTest.php b/tests/phpunit/MWDB/ExtendedSQLiteAbstractionTest.php new file mode 100644 index 0000000..969fbc7 --- /dev/null +++ b/tests/phpunit/MWDB/ExtendedSQLiteAbstractionTest.php @@ -0,0 +1,42 @@ +<?php + +namespace Wikibase\Database\Tests\MWDB; + +use Wikibase\Database\LazyDBConnectionProvider; +use Wikibase\Database\MWDB\ExtendedSQLiteAbstraction; + +/** + * @covers Wikibase\Database\MWDB\ExtendedSQLiteAbstraction + * + * @file + * @since 0.1 + * + * @ingroup WikibaseDatabaseTest + * + * @group Wikibase + * @group WikibaseDatabase + * @group Database + * + * @licence GNU GPL v2+ + * @author Jeroen De Dauw < jeroended...@gmail.com > + */ +class ExtendedSQLiteAbstractionTest extends ExtendedAbstractionTest { + + protected function setUp() { + if ( !function_exists( 'wfGetDB' ) || wfGetDB( DB_SLAVE )->getType() !== 'sqlite' ) { + $this->markTestSkipped( 'Can only run the ExtendedSQLiteAbstractionTest when MediaWiki is using SQLite' ); + } + + parent::setUp(); + } + + /** + * @see ExtendedAbstractionTest::newInstance + * + * @return ExtendedSQLiteAbstraction + */ + protected function newInstance() { + return new ExtendedSQLiteAbstraction( new LazyDBConnectionProvider( DB_MASTER ) ); + } + +} diff --git a/tests/phpunit/MediaWikiQueryInterfaceTest.php b/tests/phpunit/MediaWikiQueryInterfaceTest.php index 94ee771..0b8aba9 100644 --- a/tests/phpunit/MediaWikiQueryInterfaceTest.php +++ b/tests/phpunit/MediaWikiQueryInterfaceTest.php @@ -12,21 +12,6 @@ /** * @covers Wikibase\Database\MediaWikiQueryInterface * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @file * @since 0.1 * diff --git a/tests/phpunit/ResultIteratorTest.php b/tests/phpunit/ResultIteratorTest.php index 379cf7b..773f7dc 100644 --- a/tests/phpunit/ResultIteratorTest.php +++ b/tests/phpunit/ResultIteratorTest.php @@ -7,21 +7,6 @@ /** * @covers Wikibase\Database\TableBuilder * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @file * @since 0.1 * diff --git a/tests/phpunit/SelectFailedExceptionTest.php b/tests/phpunit/SelectFailedExceptionTest.php index 7496190..a40ce4e 100644 --- a/tests/phpunit/SelectFailedExceptionTest.php +++ b/tests/phpunit/SelectFailedExceptionTest.php @@ -7,21 +7,6 @@ /** * @covers Wikibase\Database\SelectFailedException * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @file * @since 0.1 * diff --git a/tests/phpunit/TableBuilderTest.php b/tests/phpunit/TableBuilderTest.php index ccf3ecb..93a5a44 100644 --- a/tests/phpunit/TableBuilderTest.php +++ b/tests/phpunit/TableBuilderTest.php @@ -9,21 +9,6 @@ /** * @covers Wikibase\Database\TableBuilder * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @file * @since 0.1 * diff --git a/tests/phpunit/TableCreationFailedExceptionTest.php b/tests/phpunit/TableCreationFailedExceptionTest.php index 2570293..9ba1b76 100644 --- a/tests/phpunit/TableCreationFailedExceptionTest.php +++ b/tests/phpunit/TableCreationFailedExceptionTest.php @@ -7,21 +7,6 @@ /** * @covers Wikibase\Database\TableCreationFailedException * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @file * @since 0.1 * diff --git a/tests/phpunit/TableDefinitionTest.php b/tests/phpunit/TableDefinitionTest.php index 8cb83af..2f2f670 100644 --- a/tests/phpunit/TableDefinitionTest.php +++ b/tests/phpunit/TableDefinitionTest.php @@ -8,21 +8,6 @@ /** * @covers Wikibase\Database\TableDefinition * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @file * @since 0.1 * diff --git a/tests/phpunit/UpdateFailedExceptionTest.php b/tests/phpunit/UpdateFailedExceptionTest.php index 46627a7..778fa52 100644 --- a/tests/phpunit/UpdateFailedExceptionTest.php +++ b/tests/phpunit/UpdateFailedExceptionTest.php @@ -7,21 +7,6 @@ /** * @covers Wikibase\Database\UpdateFailedException * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * * @file * @since 0.1 * -- To view, visit https://gerrit.wikimedia.org/r/74149 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I53f04591a48d63e321b119425b7fc9abfb1ea986 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseDatabase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits