Skip to content

Commit 17da06f

Browse files
committed
Merge pull request #489
2 parents 3f82285 + a8b4862 commit 17da06f

9 files changed

+32
-9
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": "^4.8.36"
19+
"phpunit/phpunit": "^4.8.36 || ^6.4"
2020
},
2121
"autoload": {
2222
"psr-4": { "MongoDB\\": "src/" },

tests/GridFS/BucketFunctionalTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
*/
1818
class BucketFunctionalTest extends FunctionalTestCase
1919
{
20+
/**
21+
* @doesNotPerformAssertions
22+
*/
2023
public function testValidConstructorOptions()
2124
{
2225
new Bucket($this->manager, $this->getDatabaseName(), [
@@ -138,7 +141,7 @@ public function testDeleteStillRemovesChunksIfFileDoesNotExist($input, $expected
138141
}
139142

140143
/**
141-
* @expectedException PHPUnit_Framework_Error_Warning
144+
* @expectedException PHPUnit\Framework\Error\Warning
142145
*/
143146
public function testDownloadingFileWithMissingChunk()
144147
{
@@ -150,7 +153,7 @@ public function testDownloadingFileWithMissingChunk()
150153
}
151154

152155
/**
153-
* @expectedException PHPUnit_Framework_Error_Warning
156+
* @expectedException PHPUnit\Framework\Error\Warning
154157
*/
155158
public function testDownloadingFileWithUnexpectedChunkIndex()
156159
{
@@ -165,7 +168,7 @@ public function testDownloadingFileWithUnexpectedChunkIndex()
165168
}
166169

167170
/**
168-
* @expectedException PHPUnit_Framework_Error_Warning
171+
* @expectedException PHPUnit\Framework\Error\Warning
169172
*/
170173
public function testDownloadingFileWithUnexpectedChunkSize()
171174
{

tests/GridFS/ReadableStreamFunctionalTest.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ public function setUp()
3838
]);
3939
}
4040

41-
public function testValidConstructorFileDocument()
41+
public function testGetFile()
4242
{
43-
new ReadableStream($this->collectionWrapper, (object) ['_id' => null, 'chunkSize' => 1, 'length' => 0]);
43+
$fileDocument = (object) ['_id' => null, 'chunkSize' => 1, 'length' => 0];
44+
$stream = new ReadableStream($this->collectionWrapper, $fileDocument);
45+
$this->assertSame($fileDocument, $stream->getFile());
4446
}
4547

4648
/**
@@ -108,14 +110,22 @@ public function provideFileIdAndExpectedBytes()
108110
];
109111
}
110112

113+
public function provideFilteredFileIdAndExpectedBytes()
114+
{
115+
return array_filter($this->provideFileIdAndExpectedBytes(),
116+
function(array $args) {
117+
return $args[1] > 0;
118+
}
119+
);
120+
}
121+
111122
/**
112-
* @dataProvider provideFileIdAndExpectedBytes
123+
* @dataProvider provideFilteredFileIdAndExpectedBytes
113124
*/
114125
public function testReadBytesCalledMultipleTimes($fileId, $length, $expectedBytes)
115126
{
116127
$fileDocument = $this->collectionWrapper->findFileById($fileId);
117128
$stream = new ReadableStream($this->collectionWrapper, $fileDocument);
118-
119129
for ($i = 0; $i < $length; $i++) {
120130
$expectedByte = isset($expectedBytes[$i]) ? $expectedBytes[$i] : '';
121131
$this->assertSame($expectedByte, $stream->readBytes(1));

tests/GridFS/SpecFunctionalTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ private function getExceptionClassForError($error)
330330
/* Although ReadableStream throws a CorruptFileException, the
331331
* stream wrapper will convert it to a PHP error of type
332332
* E_USER_WARNING. */
333-
return 'PHPUnit_Framework_Error_Warning';
333+
return 'PHPUnit\Framework\Error\Warning';
334334

335335
default:
336336
throw new LogicException('Unsupported error: ' . $error);

tests/GridFS/WritableStreamFunctionalTest.php

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

22+
/**
23+
* @doesNotPerformAssertions
24+
*/
2225
public function testValidConstructorOptions()
2326
{
2427
new WritableStream($this->collectionWrapper, 'filename', [

tests/Operation/ReplaceOneTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function testConstructorReplacementArgumentTypeCheck($replacement)
2727

2828
/**
2929
* @dataProvider provideReplacementDocuments
30+
* @doesNotPerformAssertions
3031
*/
3132
public function testConstructorReplacementArgument($replacement)
3233
{

tests/Operation/UpdateManyTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function testConstructorUpdateArgumentTypeCheck($update)
2727

2828
/**
2929
* @dataProvider provideUpdateDocuments
30+
* @doesNotPerformAssertions
3031
*/
3132
public function testConstructorUpdateArgument($update)
3233
{

tests/Operation/UpdateOneTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function testConstructorUpdateArgumentTypeCheck($update)
2727

2828
/**
2929
* @dataProvider provideUpdateDocuments
30+
* @doesNotPerformAssertions
3031
*/
3132
public function testConstructorUpdateArgument($update)
3233
{

tests/bootstrap.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@
99
} else {
1010
throw new Exception('Can\'t find autoload.php. Did you install dependencies with Composer?');
1111
}
12+
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)