Skip to content

Commit 9a7e242

Browse files
committed
Merge pull request #650
2 parents b86fae4 + 0ab1782 commit 9a7e242

File tree

7 files changed

+28
-42
lines changed

7 files changed

+28
-42
lines changed

tests/Collection/CrudSpecFunctionalTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ public function setUp()
3434
*/
3535
public function testSpecification(array $initialData, array $test, $minServerVersion, $maxServerVersion)
3636
{
37-
$this->setName(str_replace(' ', '_', $test['description']));
38-
3937
if (isset($minServerVersion) || isset($maxServerVersion)) {
4038
$this->checkServerVersion($minServerVersion, $maxServerVersion);
4139
}
@@ -71,7 +69,8 @@ public function provideSpecificationTests()
7169
$maxServerVersion = isset($json['maxServerVersion']) ? $json['maxServerVersion'] : null;
7270

7371
foreach ($json['tests'] as $test) {
74-
$testArgs[] = [$json['data'], $test, $minServerVersion, $maxServerVersion];
72+
$name = str_replace(' ', '_', $test['description']);
73+
$testArgs[$name] = [$json['data'], $test, $minServerVersion, $maxServerVersion];
7574
}
7675
}
7776

tests/GridFS/SpecFunctionalTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public function setUp()
4040
*/
4141
public function testSpecification(array $initialData, array $test)
4242
{
43-
$this->setName(str_replace(' ', '_', $test['description']));
4443
$this->initializeData($initialData);
4544

4645
if (isset($test['arrange'])) {
@@ -77,7 +76,8 @@ public function provideSpecificationTests()
7776
$json = json_decode(file_get_contents($filename), true);
7877

7978
foreach ($json['tests'] as $test) {
80-
$testArgs[] = [$json['data'], $test];
79+
$name = str_replace(' ', '_', $test['description']);
80+
$testArgs[$name] = [$json['data'], $test];
8181
}
8282
}
8383

tests/SpecTests/ChangeStreamsSpecTest.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,14 @@ public static function assertResult(array $expectedDocuments, array $actualDocum
5858
* Execute an individual test case from the specification.
5959
*
6060
* @dataProvider provideTests
61-
* @param string $name Test name
62-
* @param stdClass $test Individual "tests[]" document
63-
* @param string $databaseName Name of database under test
64-
* @param string $collectionName Name of collection under test
65-
* @param string $database2Name Name of alternate database under test
66-
* @param string $collection2Name Name of alternate collection under test
61+
* @param stdClass $test Individual "tests[]" document
62+
* @param string $databaseName Name of database under test
63+
* @param string $collectionName Name of collection under test
64+
* @param string $database2Name Name of alternate database under test
65+
* @param string $collection2Name Name of alternate collection under test
6766
*/
68-
public function testChangeStreams($name, stdClass $test, $databaseName = null, $collectionName = null, $database2Name = null, $collection2Name = null)
67+
public function testChangeStreams(stdClass $test, $databaseName = null, $collectionName = null, $database2Name = null, $collection2Name = null)
6968
{
70-
$this->setName($name);
71-
7269
$this->checkServerRequirements($this->createRunOn($test));
7370

7471
if (!isset($databaseName, $collectionName, $database2Name, $collection2Name)) {
@@ -151,7 +148,7 @@ public function provideTests()
151148

152149
foreach ($json->tests as $test) {
153150
$name = $group . ': ' . $test->description;
154-
$testArgs[] = [$name, $test, $databaseName, $collectionName, $database2Name, $collection2Name];
151+
$testArgs[$name] = [$test, $databaseName, $collectionName, $database2Name, $collection2Name];
155152
}
156153
}
157154

tests/SpecTests/CommandMonitoringSpecTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,13 @@ public static function assertCommandReplyMatches(stdClass $expected, stdClass $a
130130
* Execute an individual test case from the specification.
131131
*
132132
* @dataProvider provideTests
133-
* @param string $name Test name
134133
* @param stdClass $test Individual "tests[]" document
135134
* @param array $data Top-level "data" array to initialize collection
136135
* @param string $databaseName Name of database under test
137136
* @param string $collectionName Name of collection under test
138137
*/
139-
public function testCommandMonitoring($name, stdClass $test, array $data, $databaseName = null, $collectionName = null)
138+
public function testCommandMonitoring(stdClass $test, array $data, $databaseName = null, $collectionName = null)
140139
{
141-
$this->setName($name);
142-
143140
$this->checkServerRequirements($this->createRunOn($test));
144141

145142
$databaseName = isset($databaseName) ? $databaseName : $this->getDatabaseName();
@@ -177,7 +174,7 @@ public function provideTests()
177174

178175
foreach ($json->tests as $test) {
179176
$name = $group . ': ' . $test->description;
180-
$testArgs[] = [$name, $test, $data, $databaseName, $collectionName];
177+
$testArgs[$name] = [$test, $data, $databaseName, $collectionName];
181178
}
182179
}
183180

tests/SpecTests/CrudSpecTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,16 @@ public static function assertCommandMatches(stdClass $expected, stdClass $actual
3737
* Execute an individual test case from the specification.
3838
*
3939
* @dataProvider provideTests
40-
* @param string $name Test name
4140
* @param stdClass $test Individual "tests[]" document
4241
* @param array $runOn Top-level "runOn" array with server requirements
4342
* @param array $data Top-level "data" array to initialize collection
4443
* @param string $databaseName Name of database under test
4544
* @param string $collectionName Name of collection under test
4645
*/
47-
public function testCrud($name, stdClass $test, array $runOn = null, array $data, $databaseName = null, $collectionName = null)
46+
public function testCrud(stdClass $test, array $runOn = null, array $data, $databaseName = null, $collectionName = null)
4847
{
49-
if (isset(self::$incompleteTests[$name])) {
50-
$this->markTestIncomplete(self::$incompleteTests[$name]);
48+
if (isset(self::$incompleteTests[$this->dataDescription()])) {
49+
$this->markTestIncomplete(self::$incompleteTests[$this->dataDescription()]);
5150
}
5251

5352
if (isset($runOn)) {
@@ -104,7 +103,7 @@ public function provideTests()
104103

105104
foreach ($json->tests as $test) {
106105
$name = $group . ': ' . $test->description;
107-
$testArgs[$name] = [$name, $test, $runOn, $data, $databaseName, $collectionName];
106+
$testArgs[$name] = [$test, $runOn, $data, $databaseName, $collectionName];
108107
}
109108
}
110109

tests/SpecTests/RetryableWritesSpecTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@ class RetryableWritesSpecTest extends FunctionalTestCase
1616
* Execute an individual test case from the specification.
1717
*
1818
* @dataProvider provideTests
19-
* @param string $name Test name
2019
* @param stdClass $test Individual "tests[]" document
2120
* @param array $runOn Top-level "runOn" array with server requirements
2221
* @param array $data Top-level "data" array to initialize collection
2322
*/
24-
public function testRetryableWrites($name, stdClass $test, array $runOn = null, array $data)
23+
public function testRetryableWrites(stdClass $test, array $runOn = null, array $data)
2524
{
26-
$this->setName($name);
27-
2825
// TODO: Revise this once a test environment with multiple mongos nodes is available (see: PHPLIB-430)
2926
if (isset($test->useMultipleMongoses) && $test->useMultipleMongoses && $this->isShardedCluster()) {
3027
$this->markTestSkipped('"useMultipleMongoses" is not supported');
@@ -63,7 +60,7 @@ public function provideTests()
6360

6461
foreach ($json->tests as $test) {
6562
$name = $group . ': ' . $test->description;
66-
$testArgs[] = [$name, $test, $runOn, $data];
63+
$testArgs[$name] = [$test, $runOn, $data];
6764
}
6865
}
6966

tests/SpecTests/TransactionsSpecTest.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,16 @@ public static function assertCommandMatches(stdClass $expected, stdClass $actual
113113
* Execute an individual test case from the specification.
114114
*
115115
* @dataProvider provideTests
116-
* @param string $name Test name
117-
* @param stdClass $test Individual "tests[]" document
118-
* @param array $runOn Top-level "runOn" array with server requirements
119-
* @param array $data Top-level "data" array to initialize collection
120-
* @param string $databaseName Name of database under test
121-
* @param string $collectionName Name of collection under test
116+
* @param stdClass $test Individual "tests[]" document
117+
* @param array $runOn Top-level "runOn" array with server requirements
118+
* @param array $data Top-level "data" array to initialize collection
119+
* @param string $databaseName Name of database under test
120+
* @param string $collectionName Name of collection under test
122121
*/
123-
public function testTransactions($name, stdClass $test, array $runOn = null, array $data, $databaseName = null, $collectionName = null)
122+
public function testTransactions(stdClass $test, array $runOn = null, array $data, $databaseName = null, $collectionName = null)
124123
{
125-
$this->setName($name);
126-
127-
if (isset(self::$incompleteTests[$name])) {
128-
$this->markTestIncomplete(self::$incompleteTests[$name]);
124+
if (isset(self::$incompleteTests[$this->dataDescription()])) {
125+
$this->markTestIncomplete(self::$incompleteTests[$this->dataDescription()]);
129126
}
130127

131128
// TODO: Revise this once a test environment with multiple mongos nodes is available (see: PHPLIB-430)
@@ -192,7 +189,7 @@ public function provideTests()
192189

193190
foreach ($json->tests as $test) {
194191
$name = $group . ': ' . $test->description;
195-
$testArgs[] = [$name, $test, $runOn, $data, $databaseName, $collectionName];
192+
$testArgs[$name] = [$test, $runOn, $data, $databaseName, $collectionName];
196193
}
197194
}
198195

0 commit comments

Comments
 (0)