Skip to content

Commit 278c8e9

Browse files
committed
Use array_filter for dataProvider
1 parent 71f8ae6 commit 278c8e9

File tree

5 files changed

+18
-23
lines changed

5 files changed

+18
-23
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"ext-mongodb": "^1.4.0"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "^6.4"
19+
"phpunit/phpunit": "^4.8.36 || ^6.4"
2020
},
2121
"autoload": {
2222
"psr-4": { "MongoDB\\": "src/" },

tests/GridFS/BucketFunctionalTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,18 @@
1717
*/
1818
class BucketFunctionalTest extends FunctionalTestCase
1919
{
20+
/*
21+
* @doesNotPerformAssertions
22+
*/
2023
public function testValidConstructorOptions()
2124
{
22-
$bucket = new Bucket($this->manager, $this->getDatabaseName(), [
25+
new Bucket($this->manager, $this->getDatabaseName(), [
2326
'bucketName' => 'test',
2427
'chunkSizeBytes' => 8192,
2528
'readConcern' => new ReadConcern(ReadConcern::LOCAL),
2629
'readPreference' => new ReadPreference(ReadPreference::RP_PRIMARY),
2730
'writeConcern' => new WriteConcern(WriteConcern::MAJORITY, 1000),
2831
]);
29-
$this->assertSame('test', $bucket->getBucketName());
3032
}
3133

3234
/**

tests/GridFS/ReadableStreamFunctionalTest.php

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,12 @@ public function provideFileIdAndExpectedBytes()
112112

113113
public function provideFilteredFileIdAndExpectedBytes()
114114
{
115-
return [
116-
['length-0', 2, ''],
117-
['length-0-with-empty-chunk', 2, ''],
118-
['length-2', 2, 'ab'],
119-
['length-2', 4, 'ab'],
120-
['length-8', 2, 'ab'],
121-
['length-8', 4, 'abcd'],
122-
['length-8', 6, 'abcdef'],
123-
['length-8', 8, 'abcdefgh'],
124-
['length-8', 10, 'abcdefgh'],
125-
['length-10', 2, 'ab'],
126-
['length-10', 4, 'abcd'],
127-
['length-10', 6, 'abcdef'],
128-
['length-10', 8, 'abcdefgh'],
129-
['length-10', 10, 'abcdefghij'],
130-
['length-10', 12, 'abcdefghij'],
131-
];
115+
$filteredFiles = array_filter($this->provideFileIdAndExpectedBytes(),
116+
function(array $args) {
117+
return $args[1] > 0;
118+
}
119+
);
120+
return $filteredFiles;
132121
}
133122

134123
/**

tests/GridFS/WritableStreamFunctionalTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ public function setUp()
1919
$this->collectionWrapper = new CollectionWrapper($this->manager, $this->getDatabaseName(), 'fs');
2020
}
2121

22+
/*
23+
* @doesNotPerformAssertions
24+
*/
2225
public function testValidConstructorOptions()
2326
{
24-
$stream = new WritableStream($this->collectionWrapper, 'filename', [
27+
new WritableStream($this->collectionWrapper, 'filename', [
2528
'_id' => 'custom-id',
2629
'chunkSizeBytes' => 2,
2730
'metadata' => ['foo' => 'bar'],
2831
]);
29-
$this->assertSame(0, $stream->getSize());
3032
}
3133

3234
/**

tests/bootstrap.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@
1010
throw new Exception('Can\'t find autoload.php. Did you install dependencies with Composer?');
1111
}
1212

13-
class_alias("PHPUnit\Framework\Error\Warning", "PHPUnit_Framework_Error_Warning");
13+
if ( ! class_exists('PHPUnit\Framework\Error\Warning')) {
14+
class_alias('PHPUnit_Framework_Error_Warning', 'PHPUnit\Framework\Error\Warning');
15+
}

0 commit comments

Comments
 (0)