From: aude Date: Thu, 8 Nov 2012 12:04:24 +0000 (+0000) Subject: move ORMTableTest from Wikibase to core X-Git-Tag: 1.31.0-rc.0~21691 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24ze_article%22%29%20.%20%22?a=commitdiff_plain;h=16e2c77715a4667b6d526e1de06b3d31525074c0;p=lhc%2Fweb%2Fwiklou.git move ORMTableTest from Wikibase to core - this is more generally useful than to be buried inside Wikibase client. - it was in Wikibase/client/tests/phpunit/includes/store/EntityCacheTableTest.php - patchset 2: add to test autoloader Change-Id: I5bc41d6d205f28bcc5bf0c8a78b782c8888c18eb --- diff --git a/tests/TestsAutoLoader.php b/tests/TestsAutoLoader.php index 8ed24bb7f0..7a835d6c66 100644 --- a/tests/TestsAutoLoader.php +++ b/tests/TestsAutoLoader.php @@ -43,6 +43,9 @@ $wgAutoloadClasses += array( 'RandomImageGenerator' => "$testFolder/phpunit/includes/api/RandomImageGenerator.php", 'UserWrapper' => "$testFolder/phpunit/includes/api/ApiTestCase.php", + //db + 'ORMTableTest' => "$testFolder/phpunit/includes/db/ORMTableTest.php", + //Selenium 'SeleniumTestConstants' => "$testFolder/selenium/SeleniumTestConstants.php", diff --git a/tests/phpunit/includes/db/ORMTableTest.php b/tests/phpunit/includes/db/ORMTableTest.php new file mode 100644 index 0000000000..2ed3dd3a13 --- /dev/null +++ b/tests/phpunit/includes/db/ORMTableTest.php @@ -0,0 +1,65 @@ + + */ +abstract class ORMTableTest extends MediaWikiTestCase { + + /** + * @since 1.21 + * @return string + */ + protected abstract function getTableClass(); + + /** + * @since 1.21 + * @return IORMTable + */ + public function getTable() { + $class = $this->getTableClass(); + return $class::singleton(); + } + + /** + * @since 1.21 + * @return string + */ + public function getRowClass() { + return $this->getTable()->getRowClass(); + } + + /** + * @since 1.21 + */ + public function testSingleton() { + $class = $this->getTableClass(); + + $this->assertInstanceOf( $class, $class::singleton() ); + $this->assertTrue( $class::singleton() === $class::singleton() ); + } + +}