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
3558cfa8
Commit
3558cfa8
authored
Jun 18, 2015
by
Derick Rethans
Committed by
Jeremy Mikola
Jun 19, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compare all arrays of documents by setting the typemap for documents to 'array'.
parent
b419611f
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
55 additions
and
49 deletions
+55
-49
BulkWriteFunctionalTest.php
tests/Collection/BulkWriteFunctionalTest.php
+4
-4
AggregateFunctionalTest.php
tests/Collection/CrudSpec/AggregateFunctionalTest.php
+3
-3
DeleteManyFunctionalTest.php
tests/Collection/CrudSpec/DeleteManyFunctionalTest.php
+2
-2
DeleteOneFunctionalTest.php
tests/Collection/CrudSpec/DeleteOneFunctionalTest.php
+3
-3
FindFunctionalTest.php
tests/Collection/CrudSpec/FindFunctionalTest.php
+3
-3
FindOneAndDeleteFunctionalTest.php
tests/Collection/CrudSpec/FindOneAndDeleteFunctionalTest.php
+3
-3
FindOneAndReplaceFunctionalTest.php
...s/Collection/CrudSpec/FindOneAndReplaceFunctionalTest.php
+8
-8
FindOneAndUpdateFunctionalTest.php
tests/Collection/CrudSpec/FindOneAndUpdateFunctionalTest.php
+8
-8
InsertManyFunctionalTest.php
tests/Collection/CrudSpec/InsertManyFunctionalTest.php
+1
-1
InsertOneFunctionalTest.php
tests/Collection/CrudSpec/InsertOneFunctionalTest.php
+1
-1
ReplaceOneFunctionalTest.php
tests/Collection/CrudSpec/ReplaceOneFunctionalTest.php
+5
-5
UpdateManyFunctionalTest.php
tests/Collection/CrudSpec/UpdateManyFunctionalTest.php
+4
-4
UpdateOneFunctionalTest.php
tests/Collection/CrudSpec/UpdateOneFunctionalTest.php
+4
-4
FunctionalTestCase.php
tests/FunctionalTestCase.php
+6
-0
No files found.
tests/Collection/BulkWriteFunctionalTest.php
View file @
3558cfa8
...
@@ -35,7 +35,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
...
@@ -35,7 +35,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
$insertedIds
[
1
],
'x'
=>
22
),
array
(
'_id'
=>
$insertedIds
[
1
],
'x'
=>
22
),
);
);
$this
->
assert
Equals
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assert
SameDocuments
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testUpdates
()
public
function
testUpdates
()
...
@@ -69,7 +69,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
...
@@ -69,7 +69,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
$upsertedIds
[
3
],
'x'
=>
67
),
array
(
'_id'
=>
$upsertedIds
[
3
],
'x'
=>
67
),
);
);
$this
->
assert
Equals
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assert
SameDocuments
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testDeletes
()
public
function
testDeletes
()
...
@@ -89,7 +89,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
...
@@ -89,7 +89,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
2
,
'x'
=>
22
),
array
(
'_id'
=>
2
,
'x'
=>
22
),
);
);
$this
->
assert
Equals
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assert
SameDocuments
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testMixedOrderedOperations
()
public
function
testMixedOrderedOperations
()
...
@@ -123,7 +123,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
...
@@ -123,7 +123,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
4
,
'x'
=>
44
),
array
(
'_id'
=>
4
,
'x'
=>
44
),
);
);
$this
->
assert
Equals
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assert
SameDocuments
(
$expected
,
$this
->
collection
->
find
());
}
}
/**
/**
...
...
tests/Collection/CrudSpec/AggregateFunctionalTest.php
View file @
3558cfa8
...
@@ -32,8 +32,8 @@ class AggregateFunctionalTest extends FunctionalTestCase
...
@@ -32,8 +32,8 @@ class AggregateFunctionalTest extends FunctionalTestCase
);
);
$expected
=
array
(
$expected
=
array
(
array
(
'_id'
=>
2
,
'x'
=>
22
),
(
object
)
array
(
'_id'
=>
2
,
'x'
=>
22
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
(
object
)
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
// Use iterator_to_array() here since aggregate() may return an ArrayIterator
// Use iterator_to_array() here since aggregate() may return an ArrayIterator
...
@@ -64,7 +64,7 @@ class AggregateFunctionalTest extends FunctionalTestCase
...
@@ -64,7 +64,7 @@ class AggregateFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assert
Equals
(
$expected
,
$outputCollection
->
find
()
->
toArray
());
$this
->
assert
SameDocuments
(
$expected
,
$outputCollection
->
find
());
// Manually clean up our output collection
// Manually clean up our output collection
$this
->
dropCollectionIfItExists
(
$outputCollection
);
$this
->
dropCollectionIfItExists
(
$outputCollection
);
...
...
tests/Collection/CrudSpec/DeleteManyFunctionalTest.php
View file @
3558cfa8
...
@@ -27,7 +27,7 @@ class DeleteManyFunctionalTest extends FunctionalTestCase
...
@@ -27,7 +27,7 @@ class DeleteManyFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
1
,
'x'
=>
11
),
array
(
'_id'
=>
1
,
'x'
=>
11
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testDeleteManyWhenNoDocumentsMatch
()
public
function
testDeleteManyWhenNoDocumentsMatch
()
...
@@ -43,6 +43,6 @@ class DeleteManyFunctionalTest extends FunctionalTestCase
...
@@ -43,6 +43,6 @@ class DeleteManyFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
}
}
tests/Collection/CrudSpec/DeleteOneFunctionalTest.php
View file @
3558cfa8
...
@@ -28,7 +28,7 @@ class DeleteOneFunctionalTest extends FunctionalTestCase
...
@@ -28,7 +28,7 @@ class DeleteOneFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testDeleteOneWhenOneDocumentMatches
()
public
function
testDeleteOneWhenOneDocumentMatches
()
...
@@ -43,7 +43,7 @@ class DeleteOneFunctionalTest extends FunctionalTestCase
...
@@ -43,7 +43,7 @@ class DeleteOneFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testDeleteOneWhenNoDocumentsMatch
()
public
function
testDeleteOneWhenNoDocumentsMatch
()
...
@@ -59,6 +59,6 @@ class DeleteOneFunctionalTest extends FunctionalTestCase
...
@@ -59,6 +59,6 @@ class DeleteOneFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
}
}
tests/Collection/CrudSpec/FindFunctionalTest.php
View file @
3558cfa8
...
@@ -24,7 +24,7 @@ class FindFunctionalTest extends FunctionalTestCase
...
@@ -24,7 +24,7 @@ class FindFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
1
,
'x'
=>
11
),
array
(
'_id'
=>
1
,
'x'
=>
11
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
(
$filter
)
->
toArray
(
));
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
(
$filter
));
}
}
public
function
testFindWithFilterSortSkipAndLimit
()
public
function
testFindWithFilterSortSkipAndLimit
()
...
@@ -40,7 +40,7 @@ class FindFunctionalTest extends FunctionalTestCase
...
@@ -40,7 +40,7 @@ class FindFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
5
,
'x'
=>
55
),
array
(
'_id'
=>
5
,
'x'
=>
55
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
(
$filter
,
$options
)
->
toArray
(
));
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
(
$filter
,
$options
));
}
}
public
function
testFindWithLimitSortAndBatchSize
()
public
function
testFindWithLimitSortAndBatchSize
()
...
@@ -59,6 +59,6 @@ class FindFunctionalTest extends FunctionalTestCase
...
@@ -59,6 +59,6 @@ class FindFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
4
,
'x'
=>
44
),
array
(
'_id'
=>
4
,
'x'
=>
44
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
(
$filter
,
$options
)
->
toArray
(
));
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
(
$filter
,
$options
));
}
}
}
}
tests/Collection/CrudSpec/FindOneAndDeleteFunctionalTest.php
View file @
3558cfa8
...
@@ -32,7 +32,7 @@ class FindOneAndDeleteFunctionalTest extends FunctionalTestCase
...
@@ -32,7 +32,7 @@ class FindOneAndDeleteFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndDeleteWhenOneDocumentMatches
()
public
function
testFindOneAndDeleteWhenOneDocumentMatches
()
...
@@ -51,7 +51,7 @@ class FindOneAndDeleteFunctionalTest extends FunctionalTestCase
...
@@ -51,7 +51,7 @@ class FindOneAndDeleteFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndDeleteWhenNoDocumentsMatch
()
public
function
testFindOneAndDeleteWhenNoDocumentsMatch
()
...
@@ -71,6 +71,6 @@ class FindOneAndDeleteFunctionalTest extends FunctionalTestCase
...
@@ -71,6 +71,6 @@ class FindOneAndDeleteFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
}
}
tests/Collection/CrudSpec/FindOneAndReplaceFunctionalTest.php
View file @
3558cfa8
...
@@ -37,7 +37,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
...
@@ -37,7 +37,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndReplaceWhenManyDocumentsMatchReturningDocumentAfterModification
()
public
function
testFindOneAndReplaceWhenManyDocumentsMatchReturningDocumentAfterModification
()
...
@@ -59,7 +59,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
...
@@ -59,7 +59,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndReplaceWhenOneDocumentMatchesReturningDocumentBeforeModification
()
public
function
testFindOneAndReplaceWhenOneDocumentMatchesReturningDocumentBeforeModification
()
...
@@ -80,7 +80,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
...
@@ -80,7 +80,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndReplaceWhenOneDocumentMatchesReturningDocumentAfterModification
()
public
function
testFindOneAndReplaceWhenOneDocumentMatchesReturningDocumentAfterModification
()
...
@@ -102,7 +102,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
...
@@ -102,7 +102,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndReplaceWhenNoDocumentsMatchReturningDocumentBeforeModification
()
public
function
testFindOneAndReplaceWhenNoDocumentsMatchReturningDocumentBeforeModification
()
...
@@ -123,7 +123,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
...
@@ -123,7 +123,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndReplaceWithUpsertWhenNoDocumentsMatchReturningDocumentBeforeModification
()
public
function
testFindOneAndReplaceWithUpsertWhenNoDocumentsMatchReturningDocumentBeforeModification
()
...
@@ -147,7 +147,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
...
@@ -147,7 +147,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
4
,
'x'
=>
44
),
array
(
'_id'
=>
4
,
'x'
=>
44
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndReplaceWhenNoDocumentsMatchReturningDocumentAfterModification
()
public
function
testFindOneAndReplaceWhenNoDocumentsMatchReturningDocumentAfterModification
()
...
@@ -169,7 +169,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
...
@@ -169,7 +169,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndReplaceWithUpsertWhenNoDocumentsMatchReturningDocumentAfterModification
()
public
function
testFindOneAndReplaceWithUpsertWhenNoDocumentsMatchReturningDocumentAfterModification
()
...
@@ -194,6 +194,6 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
...
@@ -194,6 +194,6 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
4
,
'x'
=>
44
),
array
(
'_id'
=>
4
,
'x'
=>
44
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
}
}
tests/Collection/CrudSpec/FindOneAndUpdateFunctionalTest.php
View file @
3558cfa8
...
@@ -37,7 +37,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
...
@@ -37,7 +37,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndUpdateWhenManyDocumentsMatchReturningDocumentAfterModification
()
public
function
testFindOneAndUpdateWhenManyDocumentsMatchReturningDocumentAfterModification
()
...
@@ -59,7 +59,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
...
@@ -59,7 +59,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndUpdateWhenOneDocumentMatchesReturningDocumentBeforeModification
()
public
function
testFindOneAndUpdateWhenOneDocumentMatchesReturningDocumentBeforeModification
()
...
@@ -80,7 +80,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
...
@@ -80,7 +80,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndUpdateWhenOneDocumentMatchesReturningDocumentAfterModification
()
public
function
testFindOneAndUpdateWhenOneDocumentMatchesReturningDocumentAfterModification
()
...
@@ -102,7 +102,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
...
@@ -102,7 +102,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndUpdateWhenNoDocumentsMatchReturningDocumentBeforeModification
()
public
function
testFindOneAndUpdateWhenNoDocumentsMatchReturningDocumentBeforeModification
()
...
@@ -123,7 +123,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
...
@@ -123,7 +123,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndUpdateWithUpsertWhenNoDocumentsMatchReturningDocumentBeforeModification
()
public
function
testFindOneAndUpdateWithUpsertWhenNoDocumentsMatchReturningDocumentBeforeModification
()
...
@@ -146,7 +146,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
...
@@ -146,7 +146,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
4
,
'x'
=>
1
),
array
(
'_id'
=>
4
,
'x'
=>
1
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndUpdateWhenNoDocumentsMatchReturningDocumentAfterModification
()
public
function
testFindOneAndUpdateWhenNoDocumentsMatchReturningDocumentAfterModification
()
...
@@ -168,7 +168,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
...
@@ -168,7 +168,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testFindOneAndUpdateWithUpsertWhenNoDocumentsMatchReturningDocumentAfterModification
()
public
function
testFindOneAndUpdateWithUpsertWhenNoDocumentsMatchReturningDocumentAfterModification
()
...
@@ -192,6 +192,6 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
...
@@ -192,6 +192,6 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
4
,
'x'
=>
1
),
array
(
'_id'
=>
4
,
'x'
=>
1
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
}
}
tests/Collection/CrudSpec/InsertManyFunctionalTest.php
View file @
3558cfa8
...
@@ -33,6 +33,6 @@ class InsertManyFunctionalTest extends FunctionalTestCase
...
@@ -33,6 +33,6 @@ class InsertManyFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
}
}
tests/Collection/CrudSpec/InsertOneFunctionalTest.php
View file @
3558cfa8
...
@@ -29,6 +29,6 @@ class InsertOneFunctionalTest extends FunctionalTestCase
...
@@ -29,6 +29,6 @@ class InsertOneFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
2
,
'x'
=>
22
),
array
(
'_id'
=>
2
,
'x'
=>
22
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
}
}
tests/Collection/CrudSpec/ReplaceOneFunctionalTest.php
View file @
3558cfa8
...
@@ -35,7 +35,7 @@ class ReplaceOneFunctionalTest extends FunctionalTestCase
...
@@ -35,7 +35,7 @@ class ReplaceOneFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testReplaceOneWhenOneDocumentMatches
()
public
function
testReplaceOneWhenOneDocumentMatches
()
...
@@ -53,7 +53,7 @@ class ReplaceOneFunctionalTest extends FunctionalTestCase
...
@@ -53,7 +53,7 @@ class ReplaceOneFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testReplaceOneWhenNoDocumentsMatch
()
public
function
testReplaceOneWhenNoDocumentsMatch
()
...
@@ -71,7 +71,7 @@ class ReplaceOneFunctionalTest extends FunctionalTestCase
...
@@ -71,7 +71,7 @@ class ReplaceOneFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testReplaceOneWithUpsertWhenNoDocumentsMatchWithAnIdSpecified
()
public
function
testReplaceOneWithUpsertWhenNoDocumentsMatchWithAnIdSpecified
()
...
@@ -92,7 +92,7 @@ class ReplaceOneFunctionalTest extends FunctionalTestCase
...
@@ -92,7 +92,7 @@ class ReplaceOneFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
4
,
'x'
=>
1
),
array
(
'_id'
=>
4
,
'x'
=>
1
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testReplaceOneWithUpsertWhenNoDocumentsMatchWithoutAnIdSpecified
()
public
function
testReplaceOneWithUpsertWhenNoDocumentsMatchWithoutAnIdSpecified
()
...
@@ -114,6 +114,6 @@ class ReplaceOneFunctionalTest extends FunctionalTestCase
...
@@ -114,6 +114,6 @@ class ReplaceOneFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
4
,
'x'
=>
1
),
array
(
'_id'
=>
4
,
'x'
=>
1
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
}
}
tests/Collection/CrudSpec/UpdateManyFunctionalTest.php
View file @
3558cfa8
...
@@ -35,7 +35,7 @@ class UpdateManyFunctionalTest extends FunctionalTestCase
...
@@ -35,7 +35,7 @@ class UpdateManyFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
34
),
array
(
'_id'
=>
3
,
'x'
=>
34
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testUpdateManyWhenOneDocumentMatches
()
public
function
testUpdateManyWhenOneDocumentMatches
()
...
@@ -53,7 +53,7 @@ class UpdateManyFunctionalTest extends FunctionalTestCase
...
@@ -53,7 +53,7 @@ class UpdateManyFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testUpdateManyWhenNoDocumentsMatch
()
public
function
testUpdateManyWhenNoDocumentsMatch
()
...
@@ -71,7 +71,7 @@ class UpdateManyFunctionalTest extends FunctionalTestCase
...
@@ -71,7 +71,7 @@ class UpdateManyFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testUpdateManyWithUpsertWhenNoDocumentsMatch
()
public
function
testUpdateManyWithUpsertWhenNoDocumentsMatch
()
...
@@ -92,6 +92,6 @@ class UpdateManyFunctionalTest extends FunctionalTestCase
...
@@ -92,6 +92,6 @@ class UpdateManyFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
4
,
'x'
=>
1
),
array
(
'_id'
=>
4
,
'x'
=>
1
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
}
}
tests/Collection/CrudSpec/UpdateOneFunctionalTest.php
View file @
3558cfa8
...
@@ -35,7 +35,7 @@ class UpdateOneFunctionalTest extends FunctionalTestCase
...
@@ -35,7 +35,7 @@ class UpdateOneFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testUpdateOneWhenOneDocumentMatches
()
public
function
testUpdateOneWhenOneDocumentMatches
()
...
@@ -53,7 +53,7 @@ class UpdateOneFunctionalTest extends FunctionalTestCase
...
@@ -53,7 +53,7 @@ class UpdateOneFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testUpdateOneWhenNoDocumentsMatch
()
public
function
testUpdateOneWhenNoDocumentsMatch
()
...
@@ -71,7 +71,7 @@ class UpdateOneFunctionalTest extends FunctionalTestCase
...
@@ -71,7 +71,7 @@ class UpdateOneFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
3
,
'x'
=>
33
),
array
(
'_id'
=>
3
,
'x'
=>
33
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
public
function
testUpdateOneWithUpsertWhenNoDocumentsMatch
()
public
function
testUpdateOneWithUpsertWhenNoDocumentsMatch
()
...
@@ -92,6 +92,6 @@ class UpdateOneFunctionalTest extends FunctionalTestCase
...
@@ -92,6 +92,6 @@ class UpdateOneFunctionalTest extends FunctionalTestCase
array
(
'_id'
=>
4
,
'x'
=>
1
),
array
(
'_id'
=>
4
,
'x'
=>
1
),
);
);
$this
->
assertSame
(
$expected
,
$this
->
collection
->
find
()
->
toArray
());
$this
->
assertSame
Documents
(
$expected
,
$this
->
collection
->
find
());
}
}
}
}
tests/FunctionalTestCase.php
View file @
3558cfa8
...
@@ -38,6 +38,12 @@ abstract class FunctionalTestCase extends TestCase
...
@@ -38,6 +38,12 @@ abstract class FunctionalTestCase extends TestCase
$this
->
assertEquals
(
1
,
$document
[
'ok'
]);
$this
->
assertEquals
(
1
,
$document
[
'ok'
]);
}
}
protected
function
assertSameDocuments
(
array
$expected
,
$cursor
)
{
$cursor
->
setTypeMap
(
array
(
'document'
=>
'array'
));
$this
->
assertEquals
(
$expected
,
iterator_to_array
(
$cursor
));
}
protected
function
getServerVersion
(
ReadPreference
$readPreference
=
null
)
protected
function
getServerVersion
(
ReadPreference
$readPreference
=
null
)
{
{
$cursor
=
$this
->
manager
->
executeCommand
(
$cursor
=
$this
->
manager
->
executeCommand
(
...
...
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