jenkins-bot has submitted this change and it was merged. Change subject: SMW\Test\PropertyStatisticsTableTest issue on Windows ......................................................................
SMW\Test\PropertyStatisticsTableTest issue on Windows I excluded the Datagroup from running tests in the past but now I need those but PropertyStatisticsTableTest still complains on Windows about pow( 2 , 31 ) being "MWException: The value to add must be a positive integer" and since I don't have to time to research this in detail, I added isWinOS() which checks if the test runs on a Win platform and if so do pow( 2 , 30 ) instead. Doing pow( 2 , 30 ) might not sufficiently serve the test purpose and I do not know why Win is complaining about pow( 2 , 31 ) but I need the group Datagroup tests to be run without failure. Change-Id: Icf5243f37919f9784e884d5cb81faa023a2e2891 --- M tests/phpunit/includes/storage/sqlstore/PropertyStatisticsTableTest.php 1 file changed, 13 insertions(+), 2 deletions(-) Approvals: Mwjames: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/phpunit/includes/storage/sqlstore/PropertyStatisticsTableTest.php b/tests/phpunit/includes/storage/sqlstore/PropertyStatisticsTableTest.php index 83f1769..7c52bf8 100644 --- a/tests/phpunit/includes/storage/sqlstore/PropertyStatisticsTableTest.php +++ b/tests/phpunit/includes/storage/sqlstore/PropertyStatisticsTableTest.php @@ -35,6 +35,17 @@ */ class PropertyStatisticsTableTest extends \MediaWikiTestCase { + /** + * On the Windows platform pow( 2 , 31 ) returns with + * "MWException: The value to add must be a positive integer" therefore + * return true if this test runs on Windows + * + * @return boolean + */ + private function isWinOS() { + return strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN'; + } + public function testDeleteAll() { if ( !( smwfGetStore() instanceof \SMWSQLStore3 ) ) { $this->markTestSkipped( 'Test only applicable to SMWSQLStore3' ); @@ -62,7 +73,7 @@ $usageCounts[] = array( $propId, mt_rand( 0, 100000 ) ); } - $usageCounts[] = array( 9001, pow( 2 , 31 ) - 1 ); + $usageCounts[] = array( 9001, $this->isWinOS() ? pow( 2 , 30 ) : pow( 2 , 31 ) ); return $usageCounts; } @@ -123,7 +134,7 @@ 1 => 42, 2 => 0, 9001 => 9001, - 9002 => pow( 2 , 31 ) - 1, + 9002 => $this->isWinOS() ? pow( 2 , 30 ) : pow( 2 , 31 ), 9003 => 1, ); -- To view, visit https://gerrit.wikimedia.org/r/60622 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icf5243f37919f9784e884d5cb81faa023a2e2891 Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/SemanticMediaWiki Gerrit-Branch: master Gerrit-Owner: Mwjames <jamesin.hongkon...@gmail.com> Gerrit-Reviewer: Mwjames <jamesin.hongkon...@gmail.com> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits