[MediaWiki-commits] [Gerrit] Reduce the number of cases in GetEntitiesTest - change (mediawiki...Wikibase)

2014-07-31 Thread Daniel Kinzler (Code Review)
Daniel Kinzler has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/150798

Change subject: Reduce the number of cases in GetEntitiesTest
..

Reduce the number of cases in GetEntitiesTest

Bug: 68919
Change-Id: I2ca21d0632d42c88bec88e299be6b958a2faf71d
---
M repo/tests/phpunit/includes/api/GetEntitiesTest.php
1 file changed, 28 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/98/150798/1

diff --git a/repo/tests/phpunit/includes/api/GetEntitiesTest.php 
b/repo/tests/phpunit/includes/api/GetEntitiesTest.php
index 24880fe..4821dde 100644
--- a/repo/tests/phpunit/includes/api/GetEntitiesTest.php
+++ b/repo/tests/phpunit/includes/api/GetEntitiesTest.php
@@ -9,8 +9,7 @@
 /**
  * @covers Wikibase\Api\GetEntities
  *
- * Test cases are generated using the data provided in the various static 
arrays below
- * Adding one extra element to any of the arrays (except format) will generate 
4 new tests
+ * Test cases are generated using the data provided in the various static 
arrays below.
  *
  * @licence GNU GPL v2+
  * @author Adam Shorland
@@ -148,29 +147,38 @@
public static function provideData() {
$testCases = array();
 
-   // Generate test cases based on the static information provided 
in arrays above
-   foreach ( self::$goodItems as $itemData ) {
-   foreach ( self::$goodProps  as $propData ) {
-   foreach ( self::$goodLangs as $langData ) {
-   foreach ( self::$goodSorts as $sortData 
) {
-   $testCase['p'] = $itemData['p'];
-   $testCase['e'] = $itemData['e'];
-   $testCase['p']['props'] = 
$propData;
-   $testCase['p']['languages'] = 
$langData;
-   $testCase['p'] = array_merge( 
$testCase['p'], $sortData );
-   $testCases[] = $testCase;
-   if( in_array( 'claims', 
explode( '|', $propData ) ) ){
-   
$testCase['p']['ungroupedlist'] = true;
-   $testCases[] = 
$testCase;
-   }
-   }
+   // Test cases for props filter
+   foreach ( self::$goodProps  as $propData ) {
+   foreach ( self::$goodItems as $testCase ) {
+   $testCase['p']['props'] = $propData;
+   $testCases[] = $testCase;
+
+   if( in_array( 'claims', explode( '|', $propData 
) ) ){
+   $testCase['p']['ungroupedlist'] = true;
+   $testCases[] = $testCase;
}
}
}
 
-   // We only want to test each format once so don't include this 
in the main generation loop
+   // Test cases for languages
+   foreach ( self::$goodLangs as $langData ) {
+   foreach ( self::$goodItems as $testCase ) {
+   $testCase['p']['languages'] = $langData;
+   $testCases[] = $testCase;
+   }
+   }
+
+   // Test cases for sort order
+   foreach ( self::$goodSorts as $sortData ) {
+   foreach ( self::$goodItems as $testCase ) {
+   $testCase['p'] = array_merge( $testCase['p'], 
$sortData );
+   $testCases[] = $testCase;
+   }
+   }
+
+   // Test cases for different formats (for one item)
foreach ( self::$goodFormats as $formatData ) {
-   $testCase = $testCases[0];
+   $testCase = reset( self::$goodItems );
$testCase['p']['format'] = $formatData;
$testCases[] = $testCase;
}

-- 
To view, visit https://gerrit.wikimedia.org/r/150798
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ca21d0632d42c88bec88e299be6b958a2faf71d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Reduce the number of cases in GetEntitiesTest - change (mediawiki...Wikibase)

2014-08-01 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Reduce the number of cases in GetEntitiesTest
..


Reduce the number of cases in GetEntitiesTest

Bug: 68919
Change-Id: I2ca21d0632d42c88bec88e299be6b958a2faf71d
---
M repo/tests/phpunit/includes/api/GetEntitiesTest.php
1 file changed, 28 insertions(+), 20 deletions(-)

Approvals:
  Addshore: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/tests/phpunit/includes/api/GetEntitiesTest.php 
b/repo/tests/phpunit/includes/api/GetEntitiesTest.php
index 24880fe..4821dde 100644
--- a/repo/tests/phpunit/includes/api/GetEntitiesTest.php
+++ b/repo/tests/phpunit/includes/api/GetEntitiesTest.php
@@ -9,8 +9,7 @@
 /**
  * @covers Wikibase\Api\GetEntities
  *
- * Test cases are generated using the data provided in the various static 
arrays below
- * Adding one extra element to any of the arrays (except format) will generate 
4 new tests
+ * Test cases are generated using the data provided in the various static 
arrays below.
  *
  * @licence GNU GPL v2+
  * @author Adam Shorland
@@ -148,29 +147,38 @@
public static function provideData() {
$testCases = array();
 
-   // Generate test cases based on the static information provided 
in arrays above
-   foreach ( self::$goodItems as $itemData ) {
-   foreach ( self::$goodProps  as $propData ) {
-   foreach ( self::$goodLangs as $langData ) {
-   foreach ( self::$goodSorts as $sortData 
) {
-   $testCase['p'] = $itemData['p'];
-   $testCase['e'] = $itemData['e'];
-   $testCase['p']['props'] = 
$propData;
-   $testCase['p']['languages'] = 
$langData;
-   $testCase['p'] = array_merge( 
$testCase['p'], $sortData );
-   $testCases[] = $testCase;
-   if( in_array( 'claims', 
explode( '|', $propData ) ) ){
-   
$testCase['p']['ungroupedlist'] = true;
-   $testCases[] = 
$testCase;
-   }
-   }
+   // Test cases for props filter
+   foreach ( self::$goodProps  as $propData ) {
+   foreach ( self::$goodItems as $testCase ) {
+   $testCase['p']['props'] = $propData;
+   $testCases[] = $testCase;
+
+   if( in_array( 'claims', explode( '|', $propData 
) ) ){
+   $testCase['p']['ungroupedlist'] = true;
+   $testCases[] = $testCase;
}
}
}
 
-   // We only want to test each format once so don't include this 
in the main generation loop
+   // Test cases for languages
+   foreach ( self::$goodLangs as $langData ) {
+   foreach ( self::$goodItems as $testCase ) {
+   $testCase['p']['languages'] = $langData;
+   $testCases[] = $testCase;
+   }
+   }
+
+   // Test cases for sort order
+   foreach ( self::$goodSorts as $sortData ) {
+   foreach ( self::$goodItems as $testCase ) {
+   $testCase['p'] = array_merge( $testCase['p'], 
$sortData );
+   $testCases[] = $testCase;
+   }
+   }
+
+   // Test cases for different formats (for one item)
foreach ( self::$goodFormats as $formatData ) {
-   $testCase = $testCases[0];
+   $testCase = reset( self::$goodItems );
$testCase['p']['format'] = $formatData;
$testCases[] = $testCase;
}

-- 
To view, visit https://gerrit.wikimedia.org/r/150798
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2ca21d0632d42c88bec88e299be6b958a2faf71d
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler 
Gerrit-Reviewer: Addshore 
Gerrit-Reviewer: Aude 
Gerrit-Reviewer: Hoo man 
Gerrit-Reviewer: Jeroen De Dauw 
Gerrit-Reviewer: Thiemo Mättig (WMDE) 
Gerrit-Reviewer: WikidataJenkins 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lis