Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/50941
Change subject: Added test stubs for new Query code ...................................................................... Added test stubs for new Query code Change-Id: Ib8c3c700ad7db8510dd91b8101693efc09368ffe --- M repo/config/Wikibase.experimental.php M repo/tests/phpunit/includes/Database/FieldDefinitionTest.php M repo/tests/phpunit/includes/Database/TableBuilderTest.php M repo/tests/phpunit/includes/Database/TableDefinitionTest.php A repo/tests/phpunit/includes/Query/QueryEngineResultTest.php A repo/tests/phpunit/includes/Query/QueryEngineTest.php A repo/tests/phpunit/includes/Query/QueryStoreTest.php A repo/tests/phpunit/includes/Query/SQLStore/EngineTest.php A repo/tests/phpunit/includes/Query/SQLStore/SetupTest.php A repo/tests/phpunit/includes/Query/SQLStore/StoreTest.php 10 files changed, 279 insertions(+), 25 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/41/50941/1 diff --git a/repo/config/Wikibase.experimental.php b/repo/config/Wikibase.experimental.php index b6a3501..ac88acf 100644 --- a/repo/config/Wikibase.experimental.php +++ b/repo/config/Wikibase.experimental.php @@ -46,33 +46,45 @@ $wgAutoloadClasses['Wikibase\QueryHandler'] = $dir . 'includes/content/QueryHandler.php'; +$classes = array( + 'Wikibase\Repo\Database\FieldDefinition', + 'Wikibase\Repo\Database\MediaWikiQueryInterface', + 'Wikibase\Repo\Database\QueryInterface', + 'Wikibase\Repo\Database\TableBuilder', + 'Wikibase\Repo\Database\TableDefinition', -foreach ( array( - 'Wikibase\Repo\Database\FieldDefinition', - 'Wikibase\Repo\Database\MediaWikiQueryInterface', - 'Wikibase\Repo\Database\QueryInterface', - 'Wikibase\Repo\Database\TableBuilder', - 'Wikibase\Repo\Database\TableDefinition', + 'Wikibase\Repo\Query\QueryEngine', + 'Wikibase\Repo\Query\QueryEngineResult', + 'Wikibase\Repo\Query\QueryResult', + 'Wikibase\Repo\Query\QueryStore', - 'Wikibase\Repo\Query\QueryEngine', - 'Wikibase\Repo\Query\QueryEngineResult', - 'Wikibase\Repo\Query\QueryResult', - 'Wikibase\Repo\Query\QueryStore', + 'Wikibase\Repo\Query\SQLStore\DataValueHandler', + 'Wikibase\Repo\Query\SQLStore\Engine', + 'Wikibase\Repo\Query\SQLStore\Setup', + 'Wikibase\Repo\Query\SQLStore\Store', +); - 'Wikibase\Repo\Query\SQLStore\DataValueHandler', - 'Wikibase\Repo\Query\SQLStore\Engine', - 'Wikibase\Repo\Query\SQLStore\Setup', - 'Wikibase\Repo\Query\SQLStore\Store', - ) as $class ) { - +foreach ( $classes as $class ) { + // This enforces partial PSR-0 compliance $wgAutoloadClasses[$class] = $dir . 'includes' . str_replace( '\\', '/', substr( $class, 13 ) ) . '.php'; } + +unset( $classes ); if ( !class_exists( 'MessageReporter' ) ) { $wgAutoloadClasses['MessageReporter'] = $dir . 'includes/MessageReporter.php'; $wgAutoloadClasses['ObservableMessageReporter'] = $dir . 'includes/MessageReporter.php'; } +if ( defined( 'MW_PHPUNIT_TEST' ) ) { + $wgAutoloadClasses['Wikibase\Repo\Test\Query\QueryEngineTest'] + = $dir . 'tests/phpunit/includes/Query/QueryEngineTest.php'; + + $wgAutoloadClasses['Wikibase\Repo\Test\Query\QueryStoreTest'] + = $dir . 'tests/phpunit/includes/Query/QueryStoreTest.php'; +} + +unset( $dir ); $wgAPIModules['wbremovequalifiers'] = 'Wikibase\Repo\Api\RemoveQualifiers'; $wgAPIModules['wbsetqualifier'] = 'Wikibase\Repo\Api\SetQualifier'; @@ -82,8 +94,6 @@ $wgSpecialPages['EntityData'] = 'SpecialEntityData'; $wgContentHandlers[CONTENT_MODEL_WIKIBASE_QUERY] = '\Wikibase\QueryHandler'; - -unset( $dir ); /** * Hook to add PHPUnit test cases. @@ -110,6 +120,12 @@ 'Database/TableBuilder', 'Database/TableDefinition', + 'Query/QueryEngineResult', + + 'Query/SQLStore/Engine', + 'Query/SQLStore/Setup', + 'Query/SQLStore/Store', + 'specials/SpecialEntityData', ); diff --git a/repo/tests/phpunit/includes/Database/FieldDefinitionTest.php b/repo/tests/phpunit/includes/Database/FieldDefinitionTest.php index 122cbfb..5566a95 100644 --- a/repo/tests/phpunit/includes/Database/FieldDefinitionTest.php +++ b/repo/tests/phpunit/includes/Database/FieldDefinitionTest.php @@ -5,7 +5,7 @@ use Wikibase\Repo\Database\FieldDefinition; /** - * Unit test Wikibase\Repo\Database\FieldDefinition class. + * Unit tests for the Wikibase\Repo\Database\FieldDefinition class. * * 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 @@ -23,7 +23,7 @@ * http://www.gnu.org/copyleft/gpl.html * * @file - * @since 0.4 + * @since wd.db * * @ingroup WikibaseRepoTest * diff --git a/repo/tests/phpunit/includes/Database/TableBuilderTest.php b/repo/tests/phpunit/includes/Database/TableBuilderTest.php index aa2d33f..5fa496c 100644 --- a/repo/tests/phpunit/includes/Database/TableBuilderTest.php +++ b/repo/tests/phpunit/includes/Database/TableBuilderTest.php @@ -7,7 +7,7 @@ use Wikibase\Repo\Database\TableDefinition; /** - * Unit test Wikibase\Repo\Database\TableBuilder class. + * Unit tests for the Wikibase\Repo\Database\TableBuilder class. * * 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 @@ -25,7 +25,7 @@ * http://www.gnu.org/copyleft/gpl.html * * @file - * @since 0.4 + * @since wd.db * * @ingroup WikibaseRepoTest * @@ -125,7 +125,7 @@ /** * @see MessageReporter::reportMessage * - * @since 0.4 + * @since wd.db * * @param string $message */ diff --git a/repo/tests/phpunit/includes/Database/TableDefinitionTest.php b/repo/tests/phpunit/includes/Database/TableDefinitionTest.php index 1a8baa5..cc1a168 100644 --- a/repo/tests/phpunit/includes/Database/TableDefinitionTest.php +++ b/repo/tests/phpunit/includes/Database/TableDefinitionTest.php @@ -6,7 +6,7 @@ use Wikibase\Repo\Database\TableDefinition; /** - * Unit test Wikibase\Repo\Database\TableDefinition class. + * Unit tests for the Wikibase\Repo\Database\TableDefinition class. * * 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 @@ -24,7 +24,7 @@ * http://www.gnu.org/copyleft/gpl.html * * @file - * @since 0.4 + * @since wd.db * * @ingroup WikibaseRepoTest * diff --git a/repo/tests/phpunit/includes/Query/QueryEngineResultTest.php b/repo/tests/phpunit/includes/Query/QueryEngineResultTest.php new file mode 100644 index 0000000..09639fc --- /dev/null +++ b/repo/tests/phpunit/includes/Query/QueryEngineResultTest.php @@ -0,0 +1,41 @@ +<?php + +namespace Wikibase\Repo\Test\Query; + +use Wikibase\Repo\Query\QueryEngineResult; + +/** + * Unit tests for the Wikibase\Repo\Query\QueryEngineResult class. + * + * 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 wd.qe + * + * @ingroup WikibaseRepoTest + * + * @group Wikibase + * @group WikibaseRepo + * @group WikibaseQuery + * + * @licence GNU GPL v2+ + * @author Jeroen De Dauw < jeroended...@gmail.com > + */ +class QueryEngineResultTest extends QueryEngineTest { + + // TODO + +} diff --git a/repo/tests/phpunit/includes/Query/QueryEngineTest.php b/repo/tests/phpunit/includes/Query/QueryEngineTest.php new file mode 100644 index 0000000..8ec86d0 --- /dev/null +++ b/repo/tests/phpunit/includes/Query/QueryEngineTest.php @@ -0,0 +1,37 @@ +<?php + +namespace Wikibase\Repo\Test\Query; + +use Wikibase\Repo\Database\FieldDefinition; + +/** + * Base test class for Wikibase\Repo\Query\QueryEngine implementing 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 wd.qe + * + * @ingroup WikibaseRepoTest + * + * @licence GNU GPL v2+ + * @author Jeroen De Dauw < jeroended...@gmail.com > + */ +abstract class QueryEngineTest extends \MediaWikiTestCase { + + // TODO + +} diff --git a/repo/tests/phpunit/includes/Query/QueryStoreTest.php b/repo/tests/phpunit/includes/Query/QueryStoreTest.php new file mode 100644 index 0000000..ba166ab --- /dev/null +++ b/repo/tests/phpunit/includes/Query/QueryStoreTest.php @@ -0,0 +1,35 @@ +<?php + +namespace Wikibase\Repo\Test\Query; + +/** + * Base test class for Wikibase\Repo\Query\QueryStore implementing 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 wd.qe + * + * @ingroup WikibaseRepoTest + * + * @licence GNU GPL v2+ + * @author Jeroen De Dauw < jeroended...@gmail.com > + */ +abstract class QueryStoreTest extends \MediaWikiTestCase { + + // TODO + +} diff --git a/repo/tests/phpunit/includes/Query/SQLStore/EngineTest.php b/repo/tests/phpunit/includes/Query/SQLStore/EngineTest.php new file mode 100644 index 0000000..9576889 --- /dev/null +++ b/repo/tests/phpunit/includes/Query/SQLStore/EngineTest.php @@ -0,0 +1,42 @@ +<?php + +namespace Wikibase\Repo\Test\Query\SQLStore; + +use Wikibase\Repo\Query\SQLStore\Engine; +use Wikibase\Repo\Test\Query\QueryEngineTest; + +/** + * Unit tests for the Wikibase\Repo\Query\SQLStore\Engine class. + * + * 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 wd.qe + * + * @ingroup WikibaseRepoTest + * + * @group Wikibase + * @group WikibaseRepo + * @group WikibaseQuery + * + * @licence GNU GPL v2+ + * @author Jeroen De Dauw < jeroended...@gmail.com > + */ +class EngineTest extends QueryEngineTest { + + // TODO + +} diff --git a/repo/tests/phpunit/includes/Query/SQLStore/SetupTest.php b/repo/tests/phpunit/includes/Query/SQLStore/SetupTest.php new file mode 100644 index 0000000..825c593 --- /dev/null +++ b/repo/tests/phpunit/includes/Query/SQLStore/SetupTest.php @@ -0,0 +1,41 @@ +<?php + +namespace Wikibase\Repo\Test\Query\SQLStore; + +use Wikibase\Repo\Query\SQLStore\Setup; + +/** + * Unit tests for the Wikibase\Repo\Query\SQLStore\Setup class. + * + * 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 wd.qe + * + * @ingroup WikibaseRepoTest + * + * @group Wikibase + * @group WikibaseRepo + * @group WikibaseQuery + * + * @licence GNU GPL v2+ + * @author Jeroen De Dauw < jeroended...@gmail.com > + */ +class SetupTest extends \MediaWikiTestCase { + + // TODO + +} diff --git a/repo/tests/phpunit/includes/Query/SQLStore/StoreTest.php b/repo/tests/phpunit/includes/Query/SQLStore/StoreTest.php new file mode 100644 index 0000000..c3c1cc7 --- /dev/null +++ b/repo/tests/phpunit/includes/Query/SQLStore/StoreTest.php @@ -0,0 +1,42 @@ +<?php + +namespace Wikibase\Repo\Test\Query\SQLStore; + +use Wikibase\Repo\Query\SQLStore\Store; +use Wikibase\Repo\Test\Query\QueryStoreTest; + +/** + * Unit tests for the Wikibase\Repo\Query\SQLStore\Store class. + * + * 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 wd.qe + * + * @ingroup WikibaseRepoTest + * + * @group Wikibase + * @group WikibaseRepo + * @group WikibaseQuery + * + * @licence GNU GPL v2+ + * @author Jeroen De Dauw < jeroended...@gmail.com > + */ +class StoreTest extends QueryStoreTest { + + // TODO + +} -- To view, visit https://gerrit.wikimedia.org/r/50941 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib8c3c700ad7db8510dd91b8101693efc09368ffe Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase 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