Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-php-library
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
mongo-php-library
Commits
9d50aa33
Commit
9d50aa33
authored
Feb 22, 2019
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #593
parents
b50e1435
5145112c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
SpecFunctionalTest.php
tests/GridFS/SpecFunctionalTest.php
+15
-1
No files found.
tests/GridFS/SpecFunctionalTest.php
View file @
9d50aa33
...
@@ -6,6 +6,7 @@ use MongoDB\Collection;
...
@@ -6,6 +6,7 @@ use MongoDB\Collection;
use
MongoDB\BSON\Binary
;
use
MongoDB\BSON\Binary
;
use
MongoDB\BSON\ObjectId
;
use
MongoDB\BSON\ObjectId
;
use
MongoDB\BSON\UTCDateTime
;
use
MongoDB\BSON\UTCDateTime
;
use
MongoDB\GridFS\Exception\FileNotFoundException
;
use
MongoDB\Operation\BulkWrite
;
use
MongoDB\Operation\BulkWrite
;
use
DateTime
;
use
DateTime
;
use
Exception
;
use
Exception
;
...
@@ -54,6 +55,15 @@ class SpecFunctionalTest extends FunctionalTestCase
...
@@ -54,6 +55,15 @@ class SpecFunctionalTest extends FunctionalTestCase
$result
=
$e
;
$result
=
$e
;
}
}
/* Per the GridFS spec: "Drivers MAY attempt to delete any orphaned
* chunks with files_id equal to id before raising the error." The spec
* tests do not expect orphaned chunks to be removed, so we manually
* remove those chunks from the expected collection. */
if
(
$test
[
'act'
][
'operation'
]
===
'delete'
&&
$result
instanceof
FileNotFoundException
)
{
$filesId
=
$this
->
convertTypes
(
$test
[
'act'
])[
'arguments'
][
'id'
];
$this
->
expectedChunksCollection
->
deleteMany
([
'files_id'
=>
$filesId
]);
}
if
(
isset
(
$test
[
'assert'
]))
{
if
(
isset
(
$test
[
'assert'
]))
{
$this
->
executeAssert
(
$test
[
'assert'
],
$result
);
$this
->
executeAssert
(
$test
[
'assert'
],
$result
);
}
}
...
@@ -90,7 +100,7 @@ class SpecFunctionalTest extends FunctionalTestCase
...
@@ -90,7 +100,7 @@ class SpecFunctionalTest extends FunctionalTestCase
*/
*/
private
function
assertEquivalentCollections
(
$expectedCollection
,
$actualCollection
,
$actualResult
)
private
function
assertEquivalentCollections
(
$expectedCollection
,
$actualCollection
,
$actualResult
)
{
{
$mi
=
new
MultipleIterator
;
$mi
=
new
MultipleIterator
(
MultipleIterator
::
MIT_NEED_ANY
)
;
$mi
->
attachIterator
(
new
IteratorIterator
(
$expectedCollection
->
find
()));
$mi
->
attachIterator
(
new
IteratorIterator
(
$expectedCollection
->
find
()));
$mi
->
attachIterator
(
new
IteratorIterator
(
$actualCollection
->
find
()));
$mi
->
attachIterator
(
new
IteratorIterator
(
$actualCollection
->
find
()));
...
@@ -269,6 +279,10 @@ class SpecFunctionalTest extends FunctionalTestCase
...
@@ -269,6 +279,10 @@ class SpecFunctionalTest extends FunctionalTestCase
*/
*/
private
function
executeDataModification
(
array
$dataModification
)
private
function
executeDataModification
(
array
$dataModification
)
{
{
if
(
empty
(
$dataModification
))
{
throw
new
LogicException
(
'Command for data modification is empty'
);
}
foreach
(
$dataModification
as
$type
=>
$collectionName
)
{
foreach
(
$dataModification
as
$type
=>
$collectionName
)
{
break
;
break
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment