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
76b24d7c
Unverified
Commit
76b24d7c
authored
Jul 25, 2019
by
Andreas Braun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-362: Prefer class name constant over string literals
parent
3b21801e
Hide whitespace changes
Inline
Side-by-side
Showing
58 changed files
with
210 additions
and
209 deletions
+210
-209
Client.php
src/Client.php
+3
-3
Collection.php
src/Collection.php
+6
-6
Database.php
src/Database.php
+6
-6
Bucket.php
src/GridFS/Bucket.php
+7
-7
Aggregate.php
src/Operation/Aggregate.php
+4
-4
BulkWrite.php
src/Operation/BulkWrite.php
+2
-2
Count.php
src/Operation/Count.php
+3
-3
CountDocuments.php
src/Operation/CountDocuments.php
+3
-3
CreateCollection.php
src/Operation/CreateCollection.php
+2
-2
CreateIndexes.php
src/Operation/CreateIndexes.php
+2
-2
DatabaseCommand.php
src/Operation/DatabaseCommand.php
+2
-2
Delete.php
src/Operation/Delete.php
+2
-2
Distinct.php
src/Operation/Distinct.php
+3
-3
DropCollection.php
src/Operation/DropCollection.php
+2
-2
DropDatabase.php
src/Operation/DropDatabase.php
+2
-2
DropIndexes.php
src/Operation/DropIndexes.php
+2
-2
EstimatedDocumentCount.php
src/Operation/EstimatedDocumentCount.php
+3
-3
Explain.php
src/Operation/Explain.php
+2
-2
Find.php
src/Operation/Find.php
+3
-3
FindAndModify.php
src/Operation/FindAndModify.php
+2
-2
InsertMany.php
src/Operation/InsertMany.php
+2
-2
InsertOne.php
src/Operation/InsertOne.php
+2
-2
ListCollections.php
src/Operation/ListCollections.php
+1
-1
ListDatabases.php
src/Operation/ListDatabases.php
+1
-1
ListIndexes.php
src/Operation/ListIndexes.php
+1
-1
MapReduce.php
src/Operation/MapReduce.php
+5
-5
ModifyCollection.php
src/Operation/ModifyCollection.php
+2
-2
Update.php
src/Operation/Update.php
+2
-2
ClientFunctionalTest.php
tests/ClientFunctionalTest.php
+4
-4
ClientTest.php
tests/ClientTest.php
+13
-13
CollectionFunctionalTest.php
tests/Collection/CollectionFunctionalTest.php
+7
-7
CrudSpecFunctionalTest.php
tests/Collection/CrudSpecFunctionalTest.php
+5
-5
CollectionManagementFunctionalTest.php
tests/Database/CollectionManagementFunctionalTest.php
+4
-4
DatabaseFunctionalTest.php
tests/Database/DatabaseFunctionalTest.php
+21
-21
DocumentationExamplesTest.php
tests/DocumentationExamplesTest.php
+15
-15
FunctionalTestCase.php
tests/FunctionalTestCase.php
+2
-2
FunctionsTest.php
tests/FunctionsTest.php
+3
-3
BucketFunctionalTest.php
tests/GridFS/BucketFunctionalTest.php
+7
-7
SpecFunctionalTest.php
tests/GridFS/SpecFunctionalTest.php
+2
-2
BSONArrayTest.php
tests/Model/BSONArrayTest.php
+1
-1
BSONDocumentTest.php
tests/Model/BSONDocumentTest.php
+1
-1
CollectionInfoTest.php
tests/Model/CollectionInfoTest.php
+2
-2
DatabaseInfoTest.php
tests/Model/DatabaseInfoTest.php
+2
-2
IndexInfoTest.php
tests/Model/IndexInfoTest.php
+2
-2
IndexInputTest.php
tests/Model/IndexInputTest.php
+1
-1
TypeMapArrayIteratorTest.php
tests/Model/TypeMapArrayIteratorTest.php
+1
-1
BulkWriteFunctionalTest.php
tests/Operation/BulkWriteFunctionalTest.php
+6
-6
DeleteFunctionalTest.php
tests/Operation/DeleteFunctionalTest.php
+2
-2
ExplainTest.php
tests/Operation/ExplainTest.php
+2
-1
FindAndModifyFunctionalTest.php
tests/Operation/FindAndModifyFunctionalTest.php
+1
-1
InsertManyFunctionalTest.php
tests/Operation/InsertManyFunctionalTest.php
+3
-3
InsertOneFunctionalTest.php
tests/Operation/InsertOneFunctionalTest.php
+4
-4
ListCollectionsFunctionalTest.php
tests/Operation/ListCollectionsFunctionalTest.php
+4
-4
ListDatabasesFunctionalTest.php
tests/Operation/ListDatabasesFunctionalTest.php
+4
-4
ListIndexesFunctionalTest.php
tests/Operation/ListIndexesFunctionalTest.php
+2
-2
MapReduceFunctionalTest.php
tests/Operation/MapReduceFunctionalTest.php
+3
-3
UpdateFunctionalTest.php
tests/Operation/UpdateFunctionalTest.php
+5
-5
bootstrap.php
tests/bootstrap.php
+4
-4
No files found.
src/Client.php
View file @
76b24d7c
...
@@ -35,9 +35,9 @@ use MongoDB\Operation\Watch;
...
@@ -35,9 +35,9 @@ use MongoDB\Operation\Watch;
class
Client
class
Client
{
{
private
static
$defaultTypeMap
=
[
private
static
$defaultTypeMap
=
[
'array'
=>
'MongoDB\Model\BSONArray'
,
'array'
=>
\MongoDB\Model\BSONArray
::
class
,
'document'
=>
'MongoDB\Model\BSONDocument'
,
'document'
=>
\MongoDB\Model\BSONDocument
::
class
,
'root'
=>
'MongoDB\Model\BSONDocument'
,
'root'
=>
\MongoDB\Model\BSONDocument
::
class
,
];
];
private
static
$wireVersionForReadConcern
=
4
;
private
static
$wireVersionForReadConcern
=
4
;
private
static
$wireVersionForWritableCommandWriteConcern
=
5
;
private
static
$wireVersionForWritableCommandWriteConcern
=
5
;
...
...
src/Collection.php
View file @
76b24d7c
...
@@ -62,9 +62,9 @@ use Traversable;
...
@@ -62,9 +62,9 @@ use Traversable;
class
Collection
class
Collection
{
{
private
static
$defaultTypeMap
=
[
private
static
$defaultTypeMap
=
[
'array'
=>
'MongoDB\Model\BSONArray'
,
'array'
=>
\MongoDB\Model\BSONArray
::
class
,
'document'
=>
'MongoDB\Model\BSONDocument'
,
'document'
=>
\MongoDB\Model\BSONDocument
::
class
,
'root'
=>
'MongoDB\Model\BSONDocument'
,
'root'
=>
\MongoDB\Model\BSONDocument
::
class
,
];
];
private
static
$wireVersionForFindAndModifyWriteConcern
=
4
;
private
static
$wireVersionForFindAndModifyWriteConcern
=
4
;
private
static
$wireVersionForReadConcern
=
4
;
private
static
$wireVersionForReadConcern
=
4
;
...
@@ -117,11 +117,11 @@ class Collection
...
@@ -117,11 +117,11 @@ class Collection
}
}
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
'MongoDB\Driver\ReadConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
ReadConcern
::
class
);
}
}
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
'MongoDB\Driver\ReadPreference'
);
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
ReadPreference
::
class
);
}
}
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
...
@@ -129,7 +129,7 @@ class Collection
...
@@ -129,7 +129,7 @@ class Collection
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
$this
->
manager
=
$manager
;
$this
->
manager
=
$manager
;
...
...
src/Database.php
View file @
76b24d7c
...
@@ -42,9 +42,9 @@ use Traversable;
...
@@ -42,9 +42,9 @@ use Traversable;
class
Database
class
Database
{
{
private
static
$defaultTypeMap
=
[
private
static
$defaultTypeMap
=
[
'array'
=>
'MongoDB\Model\BSONArray'
,
'array'
=>
\MongoDB\Model\BSONArray
::
class
,
'document'
=>
'MongoDB\Model\BSONDocument'
,
'document'
=>
\MongoDB\Model\BSONDocument
::
class
,
'root'
=>
'MongoDB\Model\BSONDocument'
,
'root'
=>
\MongoDB\Model\BSONDocument
::
class
,
];
];
private
static
$wireVersionForReadConcern
=
4
;
private
static
$wireVersionForReadConcern
=
4
;
private
static
$wireVersionForWritableCommandWriteConcern
=
5
;
private
static
$wireVersionForWritableCommandWriteConcern
=
5
;
...
@@ -91,11 +91,11 @@ class Database
...
@@ -91,11 +91,11 @@ class Database
}
}
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
'MongoDB\Driver\ReadConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
ReadConcern
::
class
);
}
}
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
'MongoDB\Driver\ReadPreference'
);
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
ReadPreference
::
class
);
}
}
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
...
@@ -103,7 +103,7 @@ class Database
...
@@ -103,7 +103,7 @@ class Database
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
$this
->
manager
=
$manager
;
$this
->
manager
=
$manager
;
...
...
src/GridFS/Bucket.php
View file @
76b24d7c
...
@@ -42,9 +42,9 @@ class Bucket
...
@@ -42,9 +42,9 @@ class Bucket
private
static
$defaultBucketName
=
'fs'
;
private
static
$defaultBucketName
=
'fs'
;
private
static
$defaultChunkSizeBytes
=
261120
;
private
static
$defaultChunkSizeBytes
=
261120
;
private
static
$defaultTypeMap
=
[
private
static
$defaultTypeMap
=
[
'array'
=>
'MongoDB\Model\BSONArray'
,
'array'
=>
\MongoDB\Model\BSONArray
::
class
,
'document'
=>
'MongoDB\Model\BSONDocument'
,
'document'
=>
\MongoDB\Model\BSONDocument
::
class
,
'root'
=>
'MongoDB\Model\BSONDocument'
,
'root'
=>
\MongoDB\Model\BSONDocument
::
class
,
];
];
private
static
$streamWrapperProtocol
=
'gridfs'
;
private
static
$streamWrapperProtocol
=
'gridfs'
;
...
@@ -111,11 +111,11 @@ class Bucket
...
@@ -111,11 +111,11 @@ class Bucket
}
}
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
'MongoDB\Driver\ReadConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
ReadConcern
::
class
);
}
}
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
'MongoDB\Driver\ReadPreference'
);
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
ReadPreference
::
class
);
}
}
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
...
@@ -123,7 +123,7 @@ class Bucket
...
@@ -123,7 +123,7 @@ class Bucket
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
$this
->
manager
=
$manager
;
$this
->
manager
=
$manager
;
...
@@ -639,7 +639,7 @@ class Bucket
...
@@ -639,7 +639,7 @@ class Bucket
$metadata
=
stream_get_meta_data
(
$stream
);
$metadata
=
stream_get_meta_data
(
$stream
);
if
(
!
isset
(
$metadata
[
'wrapper_data'
])
||
!
$metadata
[
'wrapper_data'
]
instanceof
StreamWrapper
)
{
if
(
!
isset
(
$metadata
[
'wrapper_data'
])
||
!
$metadata
[
'wrapper_data'
]
instanceof
StreamWrapper
)
{
throw
InvalidArgumentException
::
invalidType
(
'$stream wrapper data'
,
isset
(
$metadata
[
'wrapper_data'
])
?
$metadata
[
'wrapper_data'
]
:
null
,
'MongoDB\Driver\GridFS\StreamWrapper'
);
throw
InvalidArgumentException
::
invalidType
(
'$stream wrapper data'
,
isset
(
$metadata
[
'wrapper_data'
])
?
$metadata
[
'wrapper_data'
]
:
null
,
StreamWrapper
::
class
);
}
}
return
$metadata
[
'wrapper_data'
]
->
getFile
();
return
$metadata
[
'wrapper_data'
]
->
getFile
();
...
...
src/Operation/Aggregate.php
View file @
76b24d7c
...
@@ -182,15 +182,15 @@ class Aggregate implements Executable
...
@@ -182,15 +182,15 @@ class Aggregate implements Executable
}
}
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
'MongoDB\Driver\ReadConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
ReadConcern
::
class
);
}
}
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
'MongoDB\Driver\ReadPreference'
);
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
ReadPreference
::
class
);
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
...
@@ -202,7 +202,7 @@ class Aggregate implements Executable
...
@@ -202,7 +202,7 @@ class Aggregate implements Executable
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
if
(
isset
(
$options
[
'batchSize'
])
&&
!
$options
[
'useCursor'
])
{
if
(
isset
(
$options
[
'batchSize'
])
&&
!
$options
[
'useCursor'
])
{
...
...
src/Operation/BulkWrite.php
View file @
76b24d7c
...
@@ -286,11 +286,11 @@ class BulkWrite implements Executable
...
@@ -286,11 +286,11 @@ class BulkWrite implements Executable
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
...
...
src/Operation/Count.php
View file @
76b24d7c
...
@@ -106,15 +106,15 @@ class Count implements Executable, Explainable
...
@@ -106,15 +106,15 @@ class Count implements Executable, Explainable
}
}
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
'MongoDB\Driver\ReadConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
ReadConcern
::
class
);
}
}
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
'MongoDB\Driver\ReadPreference'
);
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
ReadPreference
::
class
);
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'skip'
])
&&
!
is_integer
(
$options
[
'skip'
]))
{
if
(
isset
(
$options
[
'skip'
])
&&
!
is_integer
(
$options
[
'skip'
]))
{
...
...
src/Operation/CountDocuments.php
View file @
76b24d7c
...
@@ -106,15 +106,15 @@ class CountDocuments implements Executable
...
@@ -106,15 +106,15 @@ class CountDocuments implements Executable
}
}
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
'MongoDB\Driver\ReadConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
ReadConcern
::
class
);
}
}
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
'MongoDB\Driver\ReadPreference'
);
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
ReadPreference
::
class
);
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'skip'
])
&&
!
is_integer
(
$options
[
'skip'
]))
{
if
(
isset
(
$options
[
'skip'
])
&&
!
is_integer
(
$options
[
'skip'
]))
{
...
...
src/Operation/CreateCollection.php
View file @
76b24d7c
...
@@ -139,7 +139,7 @@ class CreateCollection implements Executable
...
@@ -139,7 +139,7 @@ class CreateCollection implements Executable
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'size'
])
&&
!
is_integer
(
$options
[
'size'
]))
{
if
(
isset
(
$options
[
'size'
])
&&
!
is_integer
(
$options
[
'size'
]))
{
...
@@ -167,7 +167,7 @@ class CreateCollection implements Executable
...
@@ -167,7 +167,7 @@ class CreateCollection implements Executable
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
...
...
src/Operation/CreateIndexes.php
View file @
76b24d7c
...
@@ -104,11 +104,11 @@ class CreateIndexes implements Executable
...
@@ -104,11 +104,11 @@ class CreateIndexes implements Executable
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
...
...
src/Operation/DatabaseCommand.php
View file @
76b24d7c
...
@@ -66,11 +66,11 @@ class DatabaseCommand implements Executable
...
@@ -66,11 +66,11 @@ class DatabaseCommand implements Executable
}
}
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
'MongoDB\Driver\ReadPreference'
);
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
ReadPreference
::
class
);
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
...
...
src/Operation/Delete.php
View file @
76b24d7c
...
@@ -85,11 +85,11 @@ class Delete implements Executable, Explainable
...
@@ -85,11 +85,11 @@ class Delete implements Executable, Explainable
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
...
...
src/Operation/Distinct.php
View file @
76b24d7c
...
@@ -91,15 +91,15 @@ class Distinct implements Executable, Explainable
...
@@ -91,15 +91,15 @@ class Distinct implements Executable, Explainable
}
}
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
'MongoDB\Driver\ReadConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
ReadConcern
::
class
);
}
}
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
'MongoDB\Driver\ReadPreference'
);
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
ReadPreference
::
class
);
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'readConcern'
])
&&
$options
[
'readConcern'
]
->
isDefault
())
{
if
(
isset
(
$options
[
'readConcern'
])
&&
$options
[
'readConcern'
]
->
isDefault
())
{
...
...
src/Operation/DropCollection.php
View file @
76b24d7c
...
@@ -67,7 +67,7 @@ class DropCollection implements Executable
...
@@ -67,7 +67,7 @@ class DropCollection implements Executable
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$options
=
[])
{
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
...
@@ -75,7 +75,7 @@ class DropCollection implements Executable
...
@@ -75,7 +75,7 @@ class DropCollection implements Executable
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
...
...
src/Operation/DropDatabase.php
View file @
76b24d7c
...
@@ -64,7 +64,7 @@ class DropDatabase implements Executable
...
@@ -64,7 +64,7 @@ class DropDatabase implements Executable
public
function
__construct
(
$databaseName
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
array
$options
=
[])
{
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
...
@@ -72,7 +72,7 @@ class DropDatabase implements Executable
...
@@ -72,7 +72,7 @@ class DropDatabase implements Executable
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
...
...
src/Operation/DropIndexes.php
View file @
76b24d7c
...
@@ -80,7 +80,7 @@ class DropIndexes implements Executable
...
@@ -80,7 +80,7 @@ class DropIndexes implements Executable
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
...
@@ -88,7 +88,7 @@ class DropIndexes implements Executable
...
@@ -88,7 +88,7 @@ class DropIndexes implements Executable
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
...
...
src/Operation/EstimatedDocumentCount.php
View file @
76b24d7c
...
@@ -74,15 +74,15 @@ class EstimatedDocumentCount implements Executable, Explainable
...
@@ -74,15 +74,15 @@ class EstimatedDocumentCount implements Executable, Explainable
}
}
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
'MongoDB\Driver\ReadConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
ReadConcern
::
class
);
}
}
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
'MongoDB\Driver\ReadPreference'
);
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
ReadPreference
::
class
);
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'readConcern'
])
&&
$options
[
'readConcern'
]
->
isDefault
())
{
if
(
isset
(
$options
[
'readConcern'
])
&&
$options
[
'readConcern'
]
->
isDefault
())
{
...
...
src/Operation/Explain.php
View file @
76b24d7c
...
@@ -67,11 +67,11 @@ class Explain implements Executable
...
@@ -67,11 +67,11 @@ class Explain implements Executable
public
function
__construct
(
$databaseName
,
Explainable
$explainable
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
Explainable
$explainable
,
array
$options
=
[])
{
{
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
'MongoDB\Driver\ReadPreference'
);
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
ReadPreference
::
class
);
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
...
...
src/Operation/Find.php
View file @
76b24d7c
...
@@ -224,11 +224,11 @@ class Find implements Executable, Explainable
...
@@ -224,11 +224,11 @@ class Find implements Executable, Explainable
}
}
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
'MongoDB\Driver\ReadConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
ReadConcern
::
class
);
}
}
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
'MongoDB\Driver\ReadPreference'
);
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
ReadPreference
::
class
);
}
}
if
(
isset
(
$options
[
'returnKey'
])
&&
!
is_bool
(
$options
[
'returnKey'
]))
{
if
(
isset
(
$options
[
'returnKey'
])
&&
!
is_bool
(
$options
[
'returnKey'
]))
{
...
@@ -236,7 +236,7 @@ class Find implements Executable, Explainable
...
@@ -236,7 +236,7 @@ class Find implements Executable, Explainable
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'showRecordId'
])
&&
!
is_bool
(
$options
[
'showRecordId'
]))
{
if
(
isset
(
$options
[
'showRecordId'
])
&&
!
is_bool
(
$options
[
'showRecordId'
]))
{
...
...
src/Operation/FindAndModify.php
View file @
76b24d7c
...
@@ -150,7 +150,7 @@ class FindAndModify implements Executable, Explainable
...
@@ -150,7 +150,7 @@ class FindAndModify implements Executable, Explainable
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'sort'
])
&&
!
is_array
(
$options
[
'sort'
])
&&
!
is_object
(
$options
[
'sort'
]))
{
if
(
isset
(
$options
[
'sort'
])
&&
!
is_array
(
$options
[
'sort'
])
&&
!
is_object
(
$options
[
'sort'
]))
{
...
@@ -166,7 +166,7 @@ class FindAndModify implements Executable, Explainable
...
@@ -166,7 +166,7 @@ class FindAndModify implements Executable, Explainable
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
if
(
!
is_bool
(
$options
[
'upsert'
]))
{
if
(
!
is_bool
(
$options
[
'upsert'
]))
{
...
...
src/Operation/InsertMany.php
View file @
76b24d7c
...
@@ -100,11 +100,11 @@ class InsertMany implements Executable
...
@@ -100,11 +100,11 @@ class InsertMany implements Executable
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
...
...
src/Operation/InsertOne.php
View file @
76b24d7c
...
@@ -76,11 +76,11 @@ class InsertOne implements Executable
...
@@ -76,11 +76,11 @@ class InsertOne implements Executable
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
...
...
src/Operation/ListCollections.php
View file @
76b24d7c
...
@@ -67,7 +67,7 @@ class ListCollections implements Executable
...
@@ -67,7 +67,7 @@ class ListCollections implements Executable
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
$this
->
databaseName
=
(
string
)
$databaseName
;
$this
->
databaseName
=
(
string
)
$databaseName
;
...
...
src/Operation/ListDatabases.php
View file @
76b24d7c
...
@@ -67,7 +67,7 @@ class ListDatabases implements Executable
...
@@ -67,7 +67,7 @@ class ListDatabases implements Executable
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
$this
->
options
=
$options
;
$this
->
options
=
$options
;
...
...
src/Operation/ListIndexes.php
View file @
76b24d7c
...
@@ -68,7 +68,7 @@ class ListIndexes implements Executable
...
@@ -68,7 +68,7 @@ class ListIndexes implements Executable
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
$this
->
databaseName
=
(
string
)
$databaseName
;
$this
->
databaseName
=
(
string
)
$databaseName
;
...
...
src/Operation/MapReduce.php
View file @
76b24d7c
...
@@ -157,7 +157,7 @@ class MapReduce implements Executable
...
@@ -157,7 +157,7 @@ class MapReduce implements Executable
}
}
if
(
isset
(
$options
[
'finalize'
])
&&
!
$options
[
'finalize'
]
instanceof
JavascriptInterface
)
{
if
(
isset
(
$options
[
'finalize'
])
&&
!
$options
[
'finalize'
]
instanceof
JavascriptInterface
)
{
throw
InvalidArgumentException
::
invalidType
(
'"finalize" option'
,
$options
[
'finalize'
],
'MongoDB\Driver\Javascript'
);
throw
InvalidArgumentException
::
invalidType
(
'"finalize" option'
,
$options
[
'finalize'
],
Javascript
::
class
);
}
}
if
(
isset
(
$options
[
'jsMode'
])
&&
!
is_bool
(
$options
[
'jsMode'
]))
{
if
(
isset
(
$options
[
'jsMode'
])
&&
!
is_bool
(
$options
[
'jsMode'
]))
{
...
@@ -177,11 +177,11 @@ class MapReduce implements Executable
...
@@ -177,11 +177,11 @@ class MapReduce implements Executable
}
}
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
if
(
isset
(
$options
[
'readConcern'
])
&&
!
$options
[
'readConcern'
]
instanceof
ReadConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
'MongoDB\Driver\ReadConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"readConcern" option'
,
$options
[
'readConcern'
],
ReadConcern
::
class
);
}
}
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
if
(
isset
(
$options
[
'readPreference'
])
&&
!
$options
[
'readPreference'
]
instanceof
ReadPreference
)
{
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
'MongoDB\Driver\ReadPreference'
);
throw
InvalidArgumentException
::
invalidType
(
'"readPreference" option'
,
$options
[
'readPreference'
],
ReadPreference
::
class
);
}
}
if
(
isset
(
$options
[
'scope'
])
&&
!
is_array
(
$options
[
'scope'
])
&&
!
is_object
(
$options
[
'scope'
]))
{
if
(
isset
(
$options
[
'scope'
])
&&
!
is_array
(
$options
[
'scope'
])
&&
!
is_object
(
$options
[
'scope'
]))
{
...
@@ -189,7 +189,7 @@ class MapReduce implements Executable
...
@@ -189,7 +189,7 @@ class MapReduce implements Executable
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'sort'
])
&&
!
is_array
(
$options
[
'sort'
])
&&
!
is_object
(
$options
[
'sort'
]))
{
if
(
isset
(
$options
[
'sort'
])
&&
!
is_array
(
$options
[
'sort'
])
&&
!
is_object
(
$options
[
'sort'
]))
{
...
@@ -205,7 +205,7 @@ class MapReduce implements Executable
...
@@ -205,7 +205,7 @@ class MapReduce implements Executable
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
if
(
isset
(
$options
[
'readConcern'
])
&&
$options
[
'readConcern'
]
->
isDefault
())
{
if
(
isset
(
$options
[
'readConcern'
])
&&
$options
[
'readConcern'
]
->
isDefault
())
{
...
...
src/Operation/ModifyCollection.php
View file @
76b24d7c
...
@@ -69,7 +69,7 @@ class ModifyCollection implements Executable
...
@@ -69,7 +69,7 @@ class ModifyCollection implements Executable
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
if
(
isset
(
$options
[
'typeMap'
])
&&
!
is_array
(
$options
[
'typeMap'
]))
{
...
@@ -77,7 +77,7 @@ class ModifyCollection implements Executable
...
@@ -77,7 +77,7 @@ class ModifyCollection implements Executable
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
...
...
src/Operation/Update.php
View file @
76b24d7c
...
@@ -126,7 +126,7 @@ class Update implements Executable, Explainable
...
@@ -126,7 +126,7 @@ class Update implements Executable, Explainable
}
}
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
if
(
isset
(
$options
[
'session'
])
&&
!
$options
[
'session'
]
instanceof
Session
)
{
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
'MongoDB\Driver\Session'
);
throw
InvalidArgumentException
::
invalidType
(
'"session" option'
,
$options
[
'session'
],
Session
::
class
);
}
}
if
(
!
is_bool
(
$options
[
'upsert'
]))
{
if
(
!
is_bool
(
$options
[
'upsert'
]))
{
...
@@ -134,7 +134,7 @@ class Update implements Executable, Explainable
...
@@ -134,7 +134,7 @@ class Update implements Executable, Explainable
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
!
$options
[
'writeConcern'
]
instanceof
WriteConcern
)
{
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
'MongoDB\Driver\WriteConcern'
);
throw
InvalidArgumentException
::
invalidType
(
'"writeConcern" option'
,
$options
[
'writeConcern'
],
WriteConcern
::
class
);
}
}
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
if
(
isset
(
$options
[
'writeConcern'
])
&&
$options
[
'writeConcern'
]
->
isDefault
())
{
...
...
tests/ClientFunctionalTest.php
View file @
76b24d7c
...
@@ -24,7 +24,7 @@ class ClientFunctionalTest extends FunctionalTestCase
...
@@ -24,7 +24,7 @@ class ClientFunctionalTest extends FunctionalTestCase
public
function
testGetManager
()
public
function
testGetManager
()
{
{
$this
->
assertInstanceOf
(
'MongoDB\Driver\Manager'
,
$this
->
client
->
getManager
());
$this
->
assertInstanceOf
(
\MongoDB\Driver\Manager
::
class
,
$this
->
client
->
getManager
());
}
}
public
function
testDropDatabase
()
public
function
testDropDatabase
()
...
@@ -50,10 +50,10 @@ class ClientFunctionalTest extends FunctionalTestCase
...
@@ -50,10 +50,10 @@ class ClientFunctionalTest extends FunctionalTestCase
$databases
=
$this
->
client
->
listDatabases
();
$databases
=
$this
->
client
->
listDatabases
();
$this
->
assertInstanceOf
(
'MongoDB\Model\DatabaseInfoIterator'
,
$databases
);
$this
->
assertInstanceOf
(
\MongoDB\Model\DatabaseInfoIterator
::
class
,
$databases
);
foreach
(
$databases
as
$database
)
{
foreach
(
$databases
as
$database
)
{
$this
->
assertInstanceOf
(
'MongoDB\Model\DatabaseInfo'
,
$database
);
$this
->
assertInstanceOf
(
\MongoDB\Model\DatabaseInfo
::
class
,
$database
);
}
}
$that
=
$this
;
$that
=
$this
;
...
@@ -103,6 +103,6 @@ class ClientFunctionalTest extends FunctionalTestCase
...
@@ -103,6 +103,6 @@ class ClientFunctionalTest extends FunctionalTestCase
if
(
version_compare
(
$this
->
getFeatureCompatibilityVersion
(),
'3.6'
,
'<'
))
{
if
(
version_compare
(
$this
->
getFeatureCompatibilityVersion
(),
'3.6'
,
'<'
))
{
$this
->
markTestSkipped
(
'startSession() is only supported on FCV 3.6 or higher'
);
$this
->
markTestSkipped
(
'startSession() is only supported on FCV 3.6 or higher'
);
}
}
$this
->
assertInstanceOf
(
'MongoDB\Driver\Session'
,
$this
->
client
->
startSession
());
$this
->
assertInstanceOf
(
\MongoDB\Driver\Session
::
class
,
$this
->
client
->
startSession
());
}
}
}
}
tests/ClientTest.php
View file @
76b24d7c
...
@@ -63,13 +63,13 @@ class ClientTest extends TestCase
...
@@ -63,13 +63,13 @@ class ClientTest extends TestCase
$collection
=
$client
->
selectCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$collection
=
$client
->
selectCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$debug
=
$collection
->
__debugInfo
();
$debug
=
$collection
->
__debugInfo
();
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadConcern'
,
$debug
[
'readConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadConcern
::
class
,
$debug
[
'readConcern'
]);
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadPreference'
,
$debug
[
'readPreference'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$debug
[
'readPreference'
]);
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\WriteConcern'
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
}
}
...
@@ -86,13 +86,13 @@ class ClientTest extends TestCase
...
@@ -86,13 +86,13 @@ class ClientTest extends TestCase
$collection
=
$client
->
selectCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$collectionOptions
);
$collection
=
$client
->
selectCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$collectionOptions
);
$debug
=
$collection
->
__debugInfo
();
$debug
=
$collection
->
__debugInfo
();
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadConcern'
,
$debug
[
'readConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadConcern
::
class
,
$debug
[
'readConcern'
]);
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadPreference'
,
$debug
[
'readPreference'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$debug
[
'readPreference'
]);
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\WriteConcern'
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
}
}
...
@@ -105,7 +105,7 @@ class ClientTest extends TestCase
...
@@ -105,7 +105,7 @@ class ClientTest extends TestCase
$debug
=
$database
->
__debugInfo
();
$debug
=
$database
->
__debugInfo
();
$this
->
assertSame
(
$this
->
getDatabaseName
(),
$debug
[
'databaseName'
]);
$this
->
assertSame
(
$this
->
getDatabaseName
(),
$debug
[
'databaseName'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\WriteConcern'
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
}
}
...
@@ -125,13 +125,13 @@ class ClientTest extends TestCase
...
@@ -125,13 +125,13 @@ class ClientTest extends TestCase
$database
=
$client
->
selectDatabase
(
$this
->
getDatabaseName
());
$database
=
$client
->
selectDatabase
(
$this
->
getDatabaseName
());
$debug
=
$database
->
__debugInfo
();
$debug
=
$database
->
__debugInfo
();
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadConcern'
,
$debug
[
'readConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadConcern
::
class
,
$debug
[
'readConcern'
]);
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadPreference'
,
$debug
[
'readPreference'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$debug
[
'readPreference'
]);
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\WriteConcern'
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
}
}
...
@@ -148,13 +148,13 @@ class ClientTest extends TestCase
...
@@ -148,13 +148,13 @@ class ClientTest extends TestCase
$database
=
$client
->
selectDatabase
(
$this
->
getDatabaseName
(),
$databaseOptions
);
$database
=
$client
->
selectDatabase
(
$this
->
getDatabaseName
(),
$databaseOptions
);
$debug
=
$database
->
__debugInfo
();
$debug
=
$database
->
__debugInfo
();
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadConcern'
,
$debug
[
'readConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadConcern
::
class
,
$debug
[
'readConcern'
]);
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadPreference'
,
$debug
[
'readPreference'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$debug
[
'readPreference'
]);
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\WriteConcern'
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
}
}
}
}
tests/Collection/CollectionFunctionalTest.php
View file @
76b24d7c
...
@@ -258,13 +258,13 @@ class CollectionFunctionalTest extends FunctionalTestCase
...
@@ -258,13 +258,13 @@ class CollectionFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
$this
->
manager
,
$debug
[
'manager'
]);
$this
->
assertSame
(
$this
->
manager
,
$debug
[
'manager'
]);
$this
->
assertSame
(
$this
->
getDatabaseName
(),
$debug
[
'databaseName'
]);
$this
->
assertSame
(
$this
->
getDatabaseName
(),
$debug
[
'databaseName'
]);
$this
->
assertSame
(
$this
->
getCollectionName
(),
$debug
[
'collectionName'
]);
$this
->
assertSame
(
$this
->
getCollectionName
(),
$debug
[
'collectionName'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadConcern'
,
$debug
[
'readConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadConcern
::
class
,
$debug
[
'readConcern'
]);
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadPreference'
,
$debug
[
'readPreference'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$debug
[
'readPreference'
]);
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\WriteConcern'
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
}
}
...
@@ -280,13 +280,13 @@ class CollectionFunctionalTest extends FunctionalTestCase
...
@@ -280,13 +280,13 @@ class CollectionFunctionalTest extends FunctionalTestCase
$clone
=
$this
->
collection
->
withOptions
(
$collectionOptions
);
$clone
=
$this
->
collection
->
withOptions
(
$collectionOptions
);
$debug
=
$clone
->
__debugInfo
();
$debug
=
$clone
->
__debugInfo
();
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadConcern'
,
$debug
[
'readConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadConcern
::
class
,
$debug
[
'readConcern'
]);
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadPreference'
,
$debug
[
'readPreference'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$debug
[
'readPreference'
]);
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\WriteConcern'
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
}
}
...
@@ -300,7 +300,7 @@ class CollectionFunctionalTest extends FunctionalTestCase
...
@@ -300,7 +300,7 @@ class CollectionFunctionalTest extends FunctionalTestCase
$result
=
$this
->
collection
->
mapReduce
(
$map
,
$reduce
,
$out
);
$result
=
$this
->
collection
->
mapReduce
(
$map
,
$reduce
,
$out
);
$this
->
assertInstanceOf
(
'MongoDB\MapReduceResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\MapReduceResult
::
class
,
$result
);
$expected
=
[
$expected
=
[
[
'_id'
=>
1.0
,
'value'
=>
66.0
],
[
'_id'
=>
1.0
,
'value'
=>
66.0
],
];
];
...
...
tests/Collection/CrudSpecFunctionalTest.php
View file @
76b24d7c
...
@@ -299,7 +299,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
...
@@ -299,7 +299,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
case
'bulkWrite'
:
case
'bulkWrite'
:
$this
->
assertInternalType
(
'array'
,
$expectedResult
);
$this
->
assertInternalType
(
'array'
,
$expectedResult
);
$this
->
assertInstanceOf
(
'MongoDB\BulkWriteResult'
,
$actualResult
);
$this
->
assertInstanceOf
(
\MongoDB\BulkWriteResult
::
class
,
$actualResult
);
if
(
isset
(
$expectedResult
[
'deletedCount'
]))
{
if
(
isset
(
$expectedResult
[
'deletedCount'
]))
{
$this
->
assertSame
(
$expectedResult
[
'deletedCount'
],
$actualResult
->
getDeletedCount
());
$this
->
assertSame
(
$expectedResult
[
'deletedCount'
],
$actualResult
->
getDeletedCount
());
...
@@ -356,7 +356,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
...
@@ -356,7 +356,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
case
'deleteMany'
:
case
'deleteMany'
:
case
'deleteOne'
:
case
'deleteOne'
:
$this
->
assertInternalType
(
'array'
,
$expectedResult
);
$this
->
assertInternalType
(
'array'
,
$expectedResult
);
$this
->
assertInstanceOf
(
'MongoDB\DeleteResult'
,
$actualResult
);
$this
->
assertInstanceOf
(
\MongoDB\DeleteResult
::
class
,
$actualResult
);
if
(
isset
(
$expectedResult
[
'deletedCount'
]))
{
if
(
isset
(
$expectedResult
[
'deletedCount'
]))
{
$this
->
assertSame
(
$expectedResult
[
'deletedCount'
],
$actualResult
->
getDeletedCount
());
$this
->
assertSame
(
$expectedResult
[
'deletedCount'
],
$actualResult
->
getDeletedCount
());
...
@@ -374,7 +374,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
...
@@ -374,7 +374,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
case
'insertMany'
:
case
'insertMany'
:
$this
->
assertInternalType
(
'array'
,
$expectedResult
);
$this
->
assertInternalType
(
'array'
,
$expectedResult
);
$this
->
assertInstanceOf
(
'MongoDB\InsertManyResult'
,
$actualResult
);
$this
->
assertInstanceOf
(
\MongoDB\InsertManyResult
::
class
,
$actualResult
);
if
(
isset
(
$expectedResult
[
'insertedCount'
]))
{
if
(
isset
(
$expectedResult
[
'insertedCount'
]))
{
$this
->
assertSame
(
$expectedResult
[
'insertedCount'
],
$actualResult
->
getInsertedCount
());
$this
->
assertSame
(
$expectedResult
[
'insertedCount'
],
$actualResult
->
getInsertedCount
());
...
@@ -390,7 +390,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
...
@@ -390,7 +390,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
case
'insertOne'
:
case
'insertOne'
:
$this
->
assertInternalType
(
'array'
,
$expectedResult
);
$this
->
assertInternalType
(
'array'
,
$expectedResult
);
$this
->
assertInstanceOf
(
'MongoDB\InsertOneResult'
,
$actualResult
);
$this
->
assertInstanceOf
(
\MongoDB\InsertOneResult
::
class
,
$actualResult
);
if
(
isset
(
$expectedResult
[
'insertedCount'
]))
{
if
(
isset
(
$expectedResult
[
'insertedCount'
]))
{
$this
->
assertSame
(
$expectedResult
[
'insertedCount'
],
$actualResult
->
getInsertedCount
());
$this
->
assertSame
(
$expectedResult
[
'insertedCount'
],
$actualResult
->
getInsertedCount
());
...
@@ -408,7 +408,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
...
@@ -408,7 +408,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
case
'updateMany'
:
case
'updateMany'
:
case
'updateOne'
:
case
'updateOne'
:
$this
->
assertInternalType
(
'array'
,
$expectedResult
);
$this
->
assertInternalType
(
'array'
,
$expectedResult
);
$this
->
assertInstanceOf
(
'MongoDB\UpdateResult'
,
$actualResult
);
$this
->
assertInstanceOf
(
\MongoDB\UpdateResult
::
class
,
$actualResult
);
if
(
isset
(
$expectedResult
[
'matchedCount'
]))
{
if
(
isset
(
$expectedResult
[
'matchedCount'
]))
{
$this
->
assertSame
(
$expectedResult
[
'matchedCount'
],
$actualResult
->
getMatchedCount
());
$this
->
assertSame
(
$expectedResult
[
'matchedCount'
],
$actualResult
->
getMatchedCount
());
...
...
tests/Database/CollectionManagementFunctionalTest.php
View file @
76b24d7c
...
@@ -57,10 +57,10 @@ class CollectionManagementFunctionalTest extends FunctionalTestCase
...
@@ -57,10 +57,10 @@ class CollectionManagementFunctionalTest extends FunctionalTestCase
$this
->
assertCommandSucceeded
(
$commandResult
);
$this
->
assertCommandSucceeded
(
$commandResult
);
$collections
=
$this
->
database
->
listCollections
();
$collections
=
$this
->
database
->
listCollections
();
$this
->
assertInstanceOf
(
'MongoDB\Model\CollectionInfoIterator'
,
$collections
);
$this
->
assertInstanceOf
(
\MongoDB\Model\CollectionInfoIterator
::
class
,
$collections
);
foreach
(
$collections
as
$collection
)
{
foreach
(
$collections
as
$collection
)
{
$this
->
assertInstanceOf
(
'MongoDB\Model\CollectionInfo'
,
$collection
);
$this
->
assertInstanceOf
(
\MongoDB\Model\CollectionInfo
::
class
,
$collection
);
}
}
}
}
...
@@ -73,10 +73,10 @@ class CollectionManagementFunctionalTest extends FunctionalTestCase
...
@@ -73,10 +73,10 @@ class CollectionManagementFunctionalTest extends FunctionalTestCase
$options
=
[
'filter'
=>
[
'name'
=>
$collectionName
]];
$options
=
[
'filter'
=>
[
'name'
=>
$collectionName
]];
$collections
=
$this
->
database
->
listCollections
(
$options
);
$collections
=
$this
->
database
->
listCollections
(
$options
);
$this
->
assertInstanceOf
(
'MongoDB\Model\CollectionInfoIterator'
,
$collections
);
$this
->
assertInstanceOf
(
\MongoDB\Model\CollectionInfoIterator
::
class
,
$collections
);
foreach
(
$collections
as
$collection
)
{
foreach
(
$collections
as
$collection
)
{
$this
->
assertInstanceOf
(
'MongoDB\Model\CollectionInfo'
,
$collection
);
$this
->
assertInstanceOf
(
\MongoDB\Model\CollectionInfo
::
class
,
$collection
);
$this
->
assertEquals
(
$collectionName
,
$collection
->
getName
());
$this
->
assertEquals
(
$collectionName
,
$collection
->
getName
());
}
}
}
}
...
...
tests/Database/DatabaseFunctionalTest.php
View file @
76b24d7c
...
@@ -89,7 +89,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
...
@@ -89,7 +89,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$cursor
=
$this
->
database
->
command
(
$command
,
$options
);
$cursor
=
$this
->
database
->
command
(
$command
,
$options
);
$this
->
assertInstanceOf
(
'MongoDB\Driver\Cursor'
,
$cursor
);
$this
->
assertInstanceOf
(
\MongoDB\Driver\Cursor
::
class
,
$cursor
);
$commandResult
=
current
(
$cursor
->
toArray
());
$commandResult
=
current
(
$cursor
->
toArray
());
$this
->
assertCommandSucceeded
(
$commandResult
);
$this
->
assertCommandSucceeded
(
$commandResult
);
...
@@ -107,7 +107,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
...
@@ -107,7 +107,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$cursor
=
$this
->
database
->
command
(
$command
,
$options
);
$cursor
=
$this
->
database
->
command
(
$command
,
$options
);
$this
->
assertInstanceOf
(
'MongoDB\Driver\Cursor'
,
$cursor
);
$this
->
assertInstanceOf
(
\MongoDB\Driver\Cursor
::
class
,
$cursor
);
$commandResult
=
current
(
$cursor
->
toArray
());
$commandResult
=
current
(
$cursor
->
toArray
());
$this
->
assertCommandSucceeded
(
$commandResult
);
$this
->
assertCommandSucceeded
(
$commandResult
);
...
@@ -149,7 +149,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
...
@@ -149,7 +149,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
$this
->
manager
,
$debug
[
'manager'
]);
$this
->
assertSame
(
$this
->
manager
,
$debug
[
'manager'
]);
$this
->
assertSame
(
$this
->
getDatabaseName
(),
$debug
[
'databaseName'
]);
$this
->
assertSame
(
$this
->
getDatabaseName
(),
$debug
[
'databaseName'
]);
$this
->
assertSame
(
$this
->
getCollectionName
(),
$debug
[
'collectionName'
]);
$this
->
assertSame
(
$this
->
getCollectionName
(),
$debug
[
'collectionName'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\WriteConcern'
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
}
}
...
@@ -203,13 +203,13 @@ class DatabaseFunctionalTest extends FunctionalTestCase
...
@@ -203,13 +203,13 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
$this
->
manager
,
$debug
[
'manager'
]);
$this
->
assertSame
(
$this
->
manager
,
$debug
[
'manager'
]);
$this
->
assertSame
(
$this
->
getDatabaseName
(),
$debug
[
'databaseName'
]);
$this
->
assertSame
(
$this
->
getDatabaseName
(),
$debug
[
'databaseName'
]);
$this
->
assertSame
(
$this
->
getCollectionName
(),
$debug
[
'collectionName'
]);
$this
->
assertSame
(
$this
->
getCollectionName
(),
$debug
[
'collectionName'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadConcern'
,
$debug
[
'readConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadConcern
::
class
,
$debug
[
'readConcern'
]);
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadPreference'
,
$debug
[
'readPreference'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$debug
[
'readPreference'
]);
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\WriteConcern'
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
}
}
...
@@ -225,13 +225,13 @@ class DatabaseFunctionalTest extends FunctionalTestCase
...
@@ -225,13 +225,13 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$collection
=
$this
->
database
->
selectCollection
(
$this
->
getCollectionName
(),
$collectionOptions
);
$collection
=
$this
->
database
->
selectCollection
(
$this
->
getCollectionName
(),
$collectionOptions
);
$debug
=
$collection
->
__debugInfo
();
$debug
=
$collection
->
__debugInfo
();
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadConcern'
,
$debug
[
'readConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadConcern
::
class
,
$debug
[
'readConcern'
]);
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadPreference'
,
$debug
[
'readPreference'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$debug
[
'readPreference'
]);
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\WriteConcern'
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
}
}
...
@@ -251,11 +251,11 @@ class DatabaseFunctionalTest extends FunctionalTestCase
...
@@ -251,11 +251,11 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
$this
->
getDatabaseName
(),
$debug
[
'databaseName'
]);
$this
->
assertSame
(
$this
->
getDatabaseName
(),
$debug
[
'databaseName'
]);
$this
->
assertSame
(
'fs'
,
$debug
[
'bucketName'
]);
$this
->
assertSame
(
'fs'
,
$debug
[
'bucketName'
]);
$this
->
assertSame
(
261120
,
$debug
[
'chunkSizeBytes'
]);
$this
->
assertSame
(
261120
,
$debug
[
'chunkSizeBytes'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadConcern'
,
$debug
[
'readConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadConcern
::
class
,
$debug
[
'readConcern'
]);
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadPreference'
,
$debug
[
'readPreference'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$debug
[
'readPreference'
]);
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertInstanceOf
(
'MongoDB\Driver\WriteConcern'
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
}
}
...
@@ -276,11 +276,11 @@ class DatabaseFunctionalTest extends FunctionalTestCase
...
@@ -276,11 +276,11 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
$this
->
getDatabaseName
(),
$debug
[
'databaseName'
]);
$this
->
assertSame
(
$this
->
getDatabaseName
(),
$debug
[
'databaseName'
]);
$this
->
assertSame
(
'custom_fs'
,
$debug
[
'bucketName'
]);
$this
->
assertSame
(
'custom_fs'
,
$debug
[
'bucketName'
]);
$this
->
assertSame
(
8192
,
$debug
[
'chunkSizeBytes'
]);
$this
->
assertSame
(
8192
,
$debug
[
'chunkSizeBytes'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadConcern'
,
$debug
[
'readConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadConcern
::
class
,
$debug
[
'readConcern'
]);
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadPreference'
,
$debug
[
'readPreference'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$debug
[
'readPreference'
]);
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertInstanceOf
(
'MongoDB\Driver\WriteConcern'
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
}
}
...
@@ -299,13 +299,13 @@ class DatabaseFunctionalTest extends FunctionalTestCase
...
@@ -299,13 +299,13 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
$this
->
manager
,
$debug
[
'manager'
]);
$this
->
assertSame
(
$this
->
manager
,
$debug
[
'manager'
]);
$this
->
assertSame
(
$this
->
getDatabaseName
(),
$debug
[
'databaseName'
]);
$this
->
assertSame
(
$this
->
getDatabaseName
(),
$debug
[
'databaseName'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadConcern'
,
$debug
[
'readConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadConcern
::
class
,
$debug
[
'readConcern'
]);
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadPreference'
,
$debug
[
'readPreference'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$debug
[
'readPreference'
]);
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\WriteConcern'
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
}
}
...
@@ -321,13 +321,13 @@ class DatabaseFunctionalTest extends FunctionalTestCase
...
@@ -321,13 +321,13 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$clone
=
$this
->
database
->
withOptions
(
$databaseOptions
);
$clone
=
$this
->
database
->
withOptions
(
$databaseOptions
);
$debug
=
$clone
->
__debugInfo
();
$debug
=
$clone
->
__debugInfo
();
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadConcern'
,
$debug
[
'readConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadConcern
::
class
,
$debug
[
'readConcern'
]);
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
'MongoDB\Driver\ReadPreference'
,
$debug
[
'readPreference'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$debug
[
'readPreference'
]);
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertSame
(
ReadPreference
::
RP_SECONDARY_PREFERRED
,
$debug
[
'readPreference'
]
->
getMode
());
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertInternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
'MongoDB\Driver\WriteConcern'
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
}
}
}
}
tests/DocumentationExamplesTest.php
View file @
76b24d7c
...
@@ -51,7 +51,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -51,7 +51,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
// End Example 1
// End Example 1
$this
->
assertSame
(
1
,
$insertOneResult
->
getInsertedCount
());
$this
->
assertSame
(
1
,
$insertOneResult
->
getInsertedCount
());
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$insertOneResult
->
getInsertedId
());
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$insertOneResult
->
getInsertedId
());
$this
->
assertInventoryCount
(
1
);
$this
->
assertInventoryCount
(
1
);
// Start Example 2
// Start Example 2
...
@@ -90,7 +90,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -90,7 +90,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this
->
assertSame
(
3
,
$insertManyResult
->
getInsertedCount
());
$this
->
assertSame
(
3
,
$insertManyResult
->
getInsertedCount
());
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$id
);
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$id
);
}
}
$this
->
assertInventoryCount
(
3
);
$this
->
assertInventoryCount
(
3
);
}
}
...
@@ -136,7 +136,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -136,7 +136,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this
->
assertSame
(
5
,
$insertManyResult
->
getInsertedCount
());
$this
->
assertSame
(
5
,
$insertManyResult
->
getInsertedCount
());
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$id
);
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$id
);
}
}
$this
->
assertInventoryCount
(
5
);
$this
->
assertInventoryCount
(
5
);
...
@@ -239,7 +239,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -239,7 +239,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this
->
assertSame
(
5
,
$insertManyResult
->
getInsertedCount
());
$this
->
assertSame
(
5
,
$insertManyResult
->
getInsertedCount
());
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$id
);
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$id
);
}
}
$this
->
assertInventoryCount
(
5
);
$this
->
assertInventoryCount
(
5
);
...
@@ -319,7 +319,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -319,7 +319,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this
->
assertSame
(
5
,
$insertManyResult
->
getInsertedCount
());
$this
->
assertSame
(
5
,
$insertManyResult
->
getInsertedCount
());
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$id
);
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$id
);
}
}
$this
->
assertInventoryCount
(
5
);
$this
->
assertInventoryCount
(
5
);
...
@@ -429,7 +429,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -429,7 +429,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this
->
assertSame
(
5
,
$insertManyResult
->
getInsertedCount
());
$this
->
assertSame
(
5
,
$insertManyResult
->
getInsertedCount
());
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$id
);
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$id
);
}
}
$this
->
assertInventoryCount
(
5
);
$this
->
assertInventoryCount
(
5
);
...
@@ -570,7 +570,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -570,7 +570,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this
->
assertSame
(
5
,
$insertManyResult
->
getInsertedCount
());
$this
->
assertSame
(
5
,
$insertManyResult
->
getInsertedCount
());
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$id
);
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$id
);
}
}
$this
->
assertInventoryCount
(
5
);
$this
->
assertInventoryCount
(
5
);
...
@@ -786,7 +786,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -786,7 +786,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this
->
assertSame
(
10
,
$insertManyResult
->
getInsertedCount
());
$this
->
assertSame
(
10
,
$insertManyResult
->
getInsertedCount
());
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$id
);
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$id
);
}
}
$this
->
assertInventoryCount
(
10
);
$this
->
assertInventoryCount
(
10
);
...
@@ -896,7 +896,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -896,7 +896,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this
->
assertSame
(
5
,
$insertManyResult
->
getInsertedCount
());
$this
->
assertSame
(
5
,
$insertManyResult
->
getInsertedCount
());
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$id
);
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$id
);
}
}
$this
->
assertInventoryCount
(
5
);
$this
->
assertInventoryCount
(
5
);
...
@@ -1033,7 +1033,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -1033,7 +1033,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
]);
]);
// End Aggregation Example 1
// End Aggregation Example 1
$this
->
assertInstanceOf
(
'MongoDB\Driver\Cursor'
,
$cursor
);
$this
->
assertInstanceOf
(
\MongoDB\Driver\Cursor
::
class
,
$cursor
);
}
}
public
function
testAggregation_example_2
()
public
function
testAggregation_example_2
()
...
@@ -1059,7 +1059,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -1059,7 +1059,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
]);
]);
// End Aggregation Example 2
// End Aggregation Example 2
$this
->
assertInstanceOf
(
'MongoDB\Driver\Cursor'
,
$cursor
);
$this
->
assertInstanceOf
(
\MongoDB\Driver\Cursor
::
class
,
$cursor
);
}
}
public
function
testAggregation_example_3
()
public
function
testAggregation_example_3
()
...
@@ -1093,7 +1093,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -1093,7 +1093,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
]);
]);
// End Aggregation Example 3
// End Aggregation Example 3
$this
->
assertInstanceOf
(
'MongoDB\Driver\Cursor'
,
$cursor
);
$this
->
assertInstanceOf
(
\MongoDB\Driver\Cursor
::
class
,
$cursor
);
}
}
public
function
testAggregation_example_4
()
public
function
testAggregation_example_4
()
...
@@ -1128,7 +1128,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -1128,7 +1128,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
]);
]);
// End Aggregation Example 4
// End Aggregation Example 4
$this
->
assertInstanceOf
(
'MongoDB\Driver\Cursor'
,
$cursor
);
$this
->
assertInstanceOf
(
\MongoDB\Driver\Cursor
::
class
,
$cursor
);
}
}
public
function
testRunCommand_example_1
()
public
function
testRunCommand_example_1
()
...
@@ -1140,7 +1140,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -1140,7 +1140,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$result
=
$cursor
->
toArray
()[
0
];
$result
=
$cursor
->
toArray
()[
0
];
// End runCommand Example 1
// End runCommand Example 1
$this
->
assertInstanceOf
(
'MongoDB\Driver\Cursor'
,
$cursor
);
$this
->
assertInstanceOf
(
\MongoDB\Driver\Cursor
::
class
,
$cursor
);
}
}
public
function
testRunCommand_example_2
()
public
function
testRunCommand_example_2
()
...
@@ -1154,7 +1154,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -1154,7 +1154,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$result
=
$cursor
->
toArray
()[
0
];
$result
=
$cursor
->
toArray
()[
0
];
// End runCommand Example 2
// End runCommand Example 2
$this
->
assertInstanceOf
(
'MongoDB\Driver\Cursor'
,
$cursor
);
$this
->
assertInstanceOf
(
\MongoDB\Driver\Cursor
::
class
,
$cursor
);
}
}
public
function
testIndex_example_1
()
public
function
testIndex_example_1
()
...
...
tests/FunctionalTestCase.php
View file @
76b24d7c
...
@@ -60,8 +60,8 @@ abstract class FunctionalTestCase extends TestCase
...
@@ -60,8 +60,8 @@ abstract class FunctionalTestCase extends TestCase
protected
function
assertSameObjectId
(
$expectedObjectId
,
$actualObjectId
)
protected
function
assertSameObjectId
(
$expectedObjectId
,
$actualObjectId
)
{
{
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$expectedObjectId
);
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$expectedObjectId
);
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$actualObjectId
);
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$actualObjectId
);
$this
->
assertEquals
((
string
)
$expectedObjectId
,
(
string
)
$actualObjectId
);
$this
->
assertEquals
((
string
)
$expectedObjectId
,
(
string
)
$actualObjectId
);
}
}
...
...
tests/FunctionsTest.php
View file @
76b24d7c
...
@@ -48,9 +48,9 @@ class FunctionsTest extends TestCase
...
@@ -48,9 +48,9 @@ class FunctionsTest extends TestCase
'z'
=>
[
1
,
2
,
3
],
'z'
=>
[
1
,
2
,
3
],
],
],
[
[
'root'
=>
'MongoDB\Model\BSONDocument'
,
'root'
=>
BSONDocument
::
class
,
'document'
=>
'MongoDB\Model\BSONDocument'
,
'document'
=>
BSONDocument
::
class
,
'array'
=>
'MongoDB\Model\BSONArray'
,
'array'
=>
BSONArray
::
class
,
],
],
new
BSONDocument
([
new
BSONDocument
([
'x'
=>
1
,
'x'
=>
1
,
...
...
tests/GridFS/BucketFunctionalTest.php
View file @
76b24d7c
...
@@ -323,7 +323,7 @@ class BucketFunctionalTest extends FunctionalTestCase
...
@@ -323,7 +323,7 @@ class BucketFunctionalTest extends FunctionalTestCase
$cursor
=
$this
->
bucket
->
find
();
$cursor
=
$this
->
bucket
->
find
();
$fileDocument
=
current
(
$cursor
->
toArray
());
$fileDocument
=
current
(
$cursor
->
toArray
());
$this
->
assertInstanceOf
(
'MongoDB\Model\BSONDocument'
,
$fileDocument
);
$this
->
assertInstanceOf
(
\MongoDB\Model\BSONDocument
::
class
,
$fileDocument
);
}
}
public
function
testFindOne
()
public
function
testFindOne
()
...
@@ -344,7 +344,7 @@ class BucketFunctionalTest extends FunctionalTestCase
...
@@ -344,7 +344,7 @@ class BucketFunctionalTest extends FunctionalTestCase
]
]
);
);
$this
->
assertInstanceOf
(
'MongoDB\Model\BSONDocument'
,
$fileDocument
);
$this
->
assertInstanceOf
(
\MongoDB\Model\BSONDocument
::
class
,
$fileDocument
);
$this
->
assertSameDocument
([
'filename'
=>
'b'
,
'length'
=>
6
],
$fileDocument
);
$this
->
assertSameDocument
([
'filename'
=>
'b'
,
'length'
=>
6
],
$fileDocument
);
}
}
...
@@ -364,7 +364,7 @@ class BucketFunctionalTest extends FunctionalTestCase
...
@@ -364,7 +364,7 @@ class BucketFunctionalTest extends FunctionalTestCase
{
{
$chunksCollection
=
$this
->
bucket
->
getChunksCollection
();
$chunksCollection
=
$this
->
bucket
->
getChunksCollection
();
$this
->
assertInstanceOf
(
'MongoDB\Collection'
,
$chunksCollection
);
$this
->
assertInstanceOf
(
\MongoDB\Collection
::
class
,
$chunksCollection
);
$this
->
assertEquals
(
'fs.chunks'
,
$chunksCollection
->
getCollectionName
());
$this
->
assertEquals
(
'fs.chunks'
,
$chunksCollection
->
getCollectionName
());
}
}
...
@@ -392,8 +392,8 @@ class BucketFunctionalTest extends FunctionalTestCase
...
@@ -392,8 +392,8 @@ class BucketFunctionalTest extends FunctionalTestCase
$fileDocument
=
$this
->
bucket
->
getFileDocumentForStream
(
$stream
);
$fileDocument
=
$this
->
bucket
->
getFileDocumentForStream
(
$stream
);
$this
->
assertInstanceOf
(
'MongoDB\Model\BSONDocument'
,
$fileDocument
);
$this
->
assertInstanceOf
(
\MongoDB\Model\BSONDocument
::
class
,
$fileDocument
);
$this
->
assertInstanceOf
(
'MongoDB\Model\BSONDocument'
,
$fileDocument
[
'metadata'
]);
$this
->
assertInstanceOf
(
\MongoDB\Model\BSONDocument
::
class
,
$fileDocument
[
'metadata'
]);
$this
->
assertSame
([
'foo'
=>
'bar'
],
$fileDocument
[
'metadata'
]
->
getArrayCopy
());
$this
->
assertSame
([
'foo'
=>
'bar'
],
$fileDocument
[
'metadata'
]
->
getArrayCopy
());
}
}
...
@@ -443,7 +443,7 @@ class BucketFunctionalTest extends FunctionalTestCase
...
@@ -443,7 +443,7 @@ class BucketFunctionalTest extends FunctionalTestCase
$id
=
$this
->
bucket
->
getFileIdForStream
(
$stream
);
$id
=
$this
->
bucket
->
getFileIdForStream
(
$stream
);
$this
->
assertInstanceOf
(
'MongoDB\Model\BSONDocument'
,
$id
);
$this
->
assertInstanceOf
(
\MongoDB\Model\BSONDocument
::
class
,
$id
);
$this
->
assertSame
([
'x'
=>
1
],
$id
->
getArrayCopy
());
$this
->
assertSame
([
'x'
=>
1
],
$id
->
getArrayCopy
());
}
}
...
@@ -475,7 +475,7 @@ class BucketFunctionalTest extends FunctionalTestCase
...
@@ -475,7 +475,7 @@ class BucketFunctionalTest extends FunctionalTestCase
{
{
$filesCollection
=
$this
->
bucket
->
getFilesCollection
();
$filesCollection
=
$this
->
bucket
->
getFilesCollection
();
$this
->
assertInstanceOf
(
'MongoDB\Collection'
,
$filesCollection
);
$this
->
assertInstanceOf
(
\MongoDB\Collection
::
class
,
$filesCollection
);
$this
->
assertEquals
(
'fs.files'
,
$filesCollection
->
getCollectionName
());
$this
->
assertEquals
(
'fs.files'
,
$filesCollection
->
getCollectionName
());
}
}
...
...
tests/GridFS/SpecFunctionalTest.php
View file @
76b24d7c
...
@@ -337,14 +337,14 @@ class SpecFunctionalTest extends FunctionalTestCase
...
@@ -337,14 +337,14 @@ class SpecFunctionalTest extends FunctionalTestCase
switch
(
$error
)
{
switch
(
$error
)
{
case
'FileNotFound'
:
case
'FileNotFound'
:
case
'RevisionNotFound'
:
case
'RevisionNotFound'
:
return
'MongoDB\GridFS\Exception\FileNotFoundException'
;
return
\MongoDB\GridFS\Exception\FileNotFoundException
::
class
;
case
'ChunkIsMissing'
:
case
'ChunkIsMissing'
:
case
'ChunkIsWrongSize'
:
case
'ChunkIsWrongSize'
:
/* Although ReadableStream throws a CorruptFileException, the
/* Although ReadableStream throws a CorruptFileException, the
* stream wrapper will convert it to a PHP error of type
* stream wrapper will convert it to a PHP error of type
* E_USER_WARNING. */
* E_USER_WARNING. */
return
'PHPUnit\Framework\Error\Warning'
;
return
\PHPUnit\Framework\Error\Warning
::
class
;
default
:
default
:
throw
new
LogicException
(
'Unsupported error: '
.
$error
);
throw
new
LogicException
(
'Unsupported error: '
.
$error
);
...
...
tests/Model/BSONArrayTest.php
View file @
76b24d7c
...
@@ -103,7 +103,7 @@ class BSONArrayTest extends TestCase
...
@@ -103,7 +103,7 @@ class BSONArrayTest extends TestCase
$data
=
[
'foo'
,
'bar'
];
$data
=
[
'foo'
,
'bar'
];
$array
=
BSONArray
::
__set_state
(
$data
);
$array
=
BSONArray
::
__set_state
(
$data
);
$this
->
assertInstanceOf
(
'MongoDB\Model\BSONArray'
,
$array
);
$this
->
assertInstanceOf
(
\MongoDB\Model\BSONArray
::
class
,
$array
);
$this
->
assertSame
(
$data
,
$array
->
getArrayCopy
());
$this
->
assertSame
(
$data
,
$array
->
getArrayCopy
());
}
}
}
}
tests/Model/BSONDocumentTest.php
View file @
76b24d7c
...
@@ -111,7 +111,7 @@ class BSONDocumentTest extends TestCase
...
@@ -111,7 +111,7 @@ class BSONDocumentTest extends TestCase
$data
=
[
'foo'
=>
'bar'
];
$data
=
[
'foo'
=>
'bar'
];
$document
=
BSONDocument
::
__set_state
(
$data
);
$document
=
BSONDocument
::
__set_state
(
$data
);
$this
->
assertInstanceOf
(
'MongoDB\Model\BSONDocument'
,
$document
);
$this
->
assertInstanceOf
(
\MongoDB\Model\BSONDocument
::
class
,
$document
);
$this
->
assertSame
(
$data
,
$document
->
getArrayCopy
());
$this
->
assertSame
(
$data
,
$document
->
getArrayCopy
());
}
}
}
}
tests/Model/CollectionInfoTest.php
View file @
76b24d7c
...
@@ -64,7 +64,7 @@ class CollectionInfoTest extends TestCase
...
@@ -64,7 +64,7 @@ class CollectionInfoTest extends TestCase
{
{
$info
=
new
CollectionInfo
([
'name'
=>
'foo'
,
'options'
=>
[
'capped'
=>
true
,
'size'
=>
1048576
]]);
$info
=
new
CollectionInfo
([
'name'
=>
'foo'
,
'options'
=>
[
'capped'
=>
true
,
'size'
=>
1048576
]]);
$this
->
expectException
(
BadMethodCallException
::
class
);
$this
->
expectException
(
BadMethodCallException
::
class
);
$this
->
expectExceptionMessage
(
'MongoDB\Model\CollectionInfo
is immutable'
);
$this
->
expectExceptionMessage
(
CollectionInfo
::
class
.
'
is immutable'
);
$info
[
'options'
]
=
[
'capped'
=>
false
];
$info
[
'options'
]
=
[
'capped'
=>
false
];
}
}
...
@@ -72,7 +72,7 @@ class CollectionInfoTest extends TestCase
...
@@ -72,7 +72,7 @@ class CollectionInfoTest extends TestCase
{
{
$info
=
new
CollectionInfo
([
'name'
=>
'foo'
,
'options'
=>
[
'capped'
=>
true
,
'size'
=>
1048576
]]);
$info
=
new
CollectionInfo
([
'name'
=>
'foo'
,
'options'
=>
[
'capped'
=>
true
,
'size'
=>
1048576
]]);
$this
->
expectException
(
BadMethodCallException
::
class
);
$this
->
expectException
(
BadMethodCallException
::
class
);
$this
->
expectExceptionMessage
(
'MongoDB\Model\CollectionInfo
is immutable'
);
$this
->
expectExceptionMessage
(
CollectionInfo
::
class
.
'
is immutable'
);
unset
(
$info
[
'options'
]);
unset
(
$info
[
'options'
]);
}
}
}
}
tests/Model/DatabaseInfoTest.php
View file @
76b24d7c
...
@@ -53,7 +53,7 @@ class DatabaseInfoTest extends TestCase
...
@@ -53,7 +53,7 @@ class DatabaseInfoTest extends TestCase
{
{
$info
=
new
DatabaseInfo
([
'name'
=>
'foo'
,
'sizeOnDisk'
=>
1048576
,
'empty'
=>
false
]);
$info
=
new
DatabaseInfo
([
'name'
=>
'foo'
,
'sizeOnDisk'
=>
1048576
,
'empty'
=>
false
]);
$this
->
expectException
(
BadMethodCallException
::
class
);
$this
->
expectException
(
BadMethodCallException
::
class
);
$this
->
expectExceptionMessage
(
'MongoDB\Model\DatabaseInfo
is immutable'
);
$this
->
expectExceptionMessage
(
DatabaseInfo
::
class
.
'
is immutable'
);
$info
[
'empty'
]
=
true
;
$info
[
'empty'
]
=
true
;
}
}
...
@@ -61,7 +61,7 @@ class DatabaseInfoTest extends TestCase
...
@@ -61,7 +61,7 @@ class DatabaseInfoTest extends TestCase
{
{
$info
=
new
DatabaseInfo
([
'name'
=>
'foo'
,
'sizeOnDisk'
=>
1048576
,
'empty'
=>
false
]);
$info
=
new
DatabaseInfo
([
'name'
=>
'foo'
,
'sizeOnDisk'
=>
1048576
,
'empty'
=>
false
]);
$this
->
expectException
(
BadMethodCallException
::
class
);
$this
->
expectException
(
BadMethodCallException
::
class
);
$this
->
expectExceptionMessage
(
'MongoDB\Model\DatabaseInfo
is immutable'
);
$this
->
expectExceptionMessage
(
DatabaseInfo
::
class
.
'
is immutable'
);
unset
(
$info
[
'empty'
]);
unset
(
$info
[
'empty'
]);
}
}
}
}
tests/Model/IndexInfoTest.php
View file @
76b24d7c
...
@@ -134,7 +134,7 @@ class IndexInfoTest extends TestCase
...
@@ -134,7 +134,7 @@ class IndexInfoTest extends TestCase
]);
]);
$this
->
expectException
(
BadMethodCallException
::
class
);
$this
->
expectException
(
BadMethodCallException
::
class
);
$this
->
expectExceptionMessage
(
'MongoDB\Model\IndexInfo
is immutable'
);
$this
->
expectExceptionMessage
(
IndexInfo
::
class
.
'
is immutable'
);
$info
[
'v'
]
=
2
;
$info
[
'v'
]
=
2
;
}
}
...
@@ -148,7 +148,7 @@ class IndexInfoTest extends TestCase
...
@@ -148,7 +148,7 @@ class IndexInfoTest extends TestCase
]);
]);
$this
->
expectException
(
BadMethodCallException
::
class
);
$this
->
expectException
(
BadMethodCallException
::
class
);
$this
->
expectExceptionMessage
(
'MongoDB\Model\IndexInfo
is immutable'
);
$this
->
expectExceptionMessage
(
IndexInfo
::
class
.
'
is immutable'
);
unset
(
$info
[
'v'
]);
unset
(
$info
[
'v'
]);
}
}
...
...
tests/Model/IndexInputTest.php
View file @
76b24d7c
...
@@ -85,7 +85,7 @@ class IndexInputTest extends TestCase
...
@@ -85,7 +85,7 @@ class IndexInputTest extends TestCase
'ns'
=>
'foo.bar'
,
'ns'
=>
'foo.bar'
,
]);
]);
$this
->
assertInstanceOf
(
'MongoDB\BSON\Serializable'
,
$indexInput
);
$this
->
assertInstanceOf
(
\MongoDB\BSON\Serializable
::
class
,
$indexInput
);
$this
->
assertEquals
(
$expected
,
$indexInput
->
bsonSerialize
());
$this
->
assertEquals
(
$expected
,
$indexInput
->
bsonSerialize
());
}
}
}
}
tests/Model/TypeMapArrayIteratorTest.php
View file @
76b24d7c
...
@@ -79,7 +79,7 @@ class TypeMapArrayIteratorTest extends TestCase
...
@@ -79,7 +79,7 @@ class TypeMapArrayIteratorTest extends TestCase
$iterator
->
rewind
();
$iterator
->
rewind
();
$this
->
expectException
(
BadMethodCallException
::
class
);
$this
->
expectException
(
BadMethodCallException
::
class
);
$this
->
expectExceptionMessage
(
'MongoDB\Model\TypeMapArrayIterator
is immutable'
);
$this
->
expectExceptionMessage
(
TypeMapArrayIterator
::
class
.
'
is immutable'
);
call_user_func_array
([
$iterator
,
$method
],
$args
);
call_user_func_array
([
$iterator
,
$method
],
$args
);
}
}
...
...
tests/Operation/BulkWriteFunctionalTest.php
View file @
76b24d7c
...
@@ -36,12 +36,12 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
...
@@ -36,12 +36,12 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
$operation
=
new
BulkWrite
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$ops
);
$operation
=
new
BulkWrite
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$ops
);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\BulkWriteResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\BulkWriteResult
::
class
,
$result
);
$this
->
assertSame
(
4
,
$result
->
getInsertedCount
());
$this
->
assertSame
(
4
,
$result
->
getInsertedCount
());
$insertedIds
=
$result
->
getInsertedIds
();
$insertedIds
=
$result
->
getInsertedIds
();
$this
->
assertSame
(
1
,
$insertedIds
[
0
]);
$this
->
assertSame
(
1
,
$insertedIds
[
0
]);
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$insertedIds
[
1
]);
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$insertedIds
[
1
]);
$this
->
assertSame
(
'foo'
,
$insertedIds
[
2
]);
$this
->
assertSame
(
'foo'
,
$insertedIds
[
2
]);
$this
->
assertSame
(
'bar'
,
$insertedIds
[
3
]);
$this
->
assertSame
(
'bar'
,
$insertedIds
[
3
]);
...
@@ -70,14 +70,14 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
...
@@ -70,14 +70,14 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
$operation
=
new
BulkWrite
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$ops
);
$operation
=
new
BulkWrite
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$ops
);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\BulkWriteResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\BulkWriteResult
::
class
,
$result
);
$this
->
assertSame
(
5
,
$result
->
getMatchedCount
());
$this
->
assertSame
(
5
,
$result
->
getMatchedCount
());
$this
->
assertSame
(
5
,
$result
->
getModifiedCount
());
$this
->
assertSame
(
5
,
$result
->
getModifiedCount
());
$this
->
assertSame
(
2
,
$result
->
getUpsertedCount
());
$this
->
assertSame
(
2
,
$result
->
getUpsertedCount
());
$upsertedIds
=
$result
->
getUpsertedIds
();
$upsertedIds
=
$result
->
getUpsertedIds
();
$this
->
assertSame
(
5
,
$upsertedIds
[
2
]);
$this
->
assertSame
(
5
,
$upsertedIds
[
2
]);
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$upsertedIds
[
3
]);
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$upsertedIds
[
3
]);
$expected
=
[
$expected
=
[
[
'_id'
=>
1
,
'x'
=>
11
],
[
'_id'
=>
1
,
'x'
=>
11
],
...
@@ -103,7 +103,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
...
@@ -103,7 +103,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
$operation
=
new
BulkWrite
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$ops
);
$operation
=
new
BulkWrite
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$ops
);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\BulkWriteResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\BulkWriteResult
::
class
,
$result
);
$this
->
assertSame
(
3
,
$result
->
getDeletedCount
());
$this
->
assertSame
(
3
,
$result
->
getDeletedCount
());
$expected
=
[
$expected
=
[
...
@@ -128,7 +128,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
...
@@ -128,7 +128,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
$operation
=
new
BulkWrite
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$ops
);
$operation
=
new
BulkWrite
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$ops
);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\BulkWriteResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\BulkWriteResult
::
class
,
$result
);
$this
->
assertSame
(
1
,
$result
->
getInsertedCount
());
$this
->
assertSame
(
1
,
$result
->
getInsertedCount
());
$this
->
assertSame
([
2
=>
4
],
$result
->
getInsertedIds
());
$this
->
assertSame
([
2
=>
4
],
$result
->
getInsertedIds
());
...
...
tests/Operation/DeleteFunctionalTest.php
View file @
76b24d7c
...
@@ -31,7 +31,7 @@ class DeleteFunctionalTest extends FunctionalTestCase
...
@@ -31,7 +31,7 @@ class DeleteFunctionalTest extends FunctionalTestCase
$operation
=
new
Delete
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$filter
,
1
);
$operation
=
new
Delete
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$filter
,
1
);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\DeleteResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\DeleteResult
::
class
,
$result
);
$this
->
assertSame
(
1
,
$result
->
getDeletedCount
());
$this
->
assertSame
(
1
,
$result
->
getDeletedCount
());
$expected
=
[
$expected
=
[
...
@@ -51,7 +51,7 @@ class DeleteFunctionalTest extends FunctionalTestCase
...
@@ -51,7 +51,7 @@ class DeleteFunctionalTest extends FunctionalTestCase
$operation
=
new
Delete
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$filter
,
0
);
$operation
=
new
Delete
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$filter
,
0
);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\DeleteResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\DeleteResult
::
class
,
$result
);
$this
->
assertSame
(
2
,
$result
->
getDeletedCount
());
$this
->
assertSame
(
2
,
$result
->
getDeletedCount
());
$expected
=
[
$expected
=
[
...
...
tests/Operation/ExplainTest.php
View file @
76b24d7c
...
@@ -6,6 +6,7 @@ use MongoDB\Exception\InvalidArgumentException;
...
@@ -6,6 +6,7 @@ use MongoDB\Exception\InvalidArgumentException;
use
MongoDB\Operation\Count
;
use
MongoDB\Operation\Count
;
use
MongoDB\Operation\Distinct
;
use
MongoDB\Operation\Distinct
;
use
MongoDB\Operation\Explain
;
use
MongoDB\Operation\Explain
;
use
MongoDB\Operation\Explainable
;
class
ExplainTest
extends
TestCase
class
ExplainTest
extends
TestCase
{
{
...
@@ -14,7 +15,7 @@ class ExplainTest extends TestCase
...
@@ -14,7 +15,7 @@ class ExplainTest extends TestCase
*/
*/
public
function
testConstructorOptionTypeChecks
(
array
$options
)
public
function
testConstructorOptionTypeChecks
(
array
$options
)
{
{
$explainable
=
$this
->
getMockBuilder
(
'MongoDB\Operation\Explainable'
)
->
getMock
();
$explainable
=
$this
->
getMockBuilder
(
Explainable
::
class
)
->
getMock
();
$this
->
expectException
(
InvalidArgumentException
::
class
);
$this
->
expectException
(
InvalidArgumentException
::
class
);
new
Explain
(
$this
->
getDatabaseName
(),
$explainable
,
$options
);
new
Explain
(
$this
->
getDatabaseName
(),
$explainable
,
$options
);
}
}
...
...
tests/Operation/FindAndModifyFunctionalTest.php
View file @
76b24d7c
...
@@ -161,7 +161,7 @@ class FindAndModifyFunctionalTest extends FunctionalTestCase
...
@@ -161,7 +161,7 @@ class FindAndModifyFunctionalTest extends FunctionalTestCase
[
'_id'
=>
1
,
'x'
=>
(
object
)
[
'foo'
=>
'bar'
]],
[
'_id'
=>
1
,
'x'
=>
(
object
)
[
'foo'
=>
'bar'
]],
],
],
[
[
[
'root'
=>
'MongoDB\Model\BSONDocument'
,
'document'
=>
'object'
],
[
'root'
=>
BSONDocument
::
class
,
'document'
=>
'object'
],
new
BSONDocument
([
'_id'
=>
1
,
'x'
=>
(
object
)
[
'foo'
=>
'bar'
]]),
new
BSONDocument
([
'_id'
=>
1
,
'x'
=>
(
object
)
[
'foo'
=>
'bar'
]]),
],
],
];
];
...
...
tests/Operation/InsertManyFunctionalTest.php
View file @
76b24d7c
...
@@ -34,12 +34,12 @@ class InsertManyFunctionalTest extends FunctionalTestCase
...
@@ -34,12 +34,12 @@ class InsertManyFunctionalTest extends FunctionalTestCase
$operation
=
new
InsertMany
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$documents
);
$operation
=
new
InsertMany
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$documents
);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\InsertManyResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\InsertManyResult
::
class
,
$result
);
$this
->
assertSame
(
4
,
$result
->
getInsertedCount
());
$this
->
assertSame
(
4
,
$result
->
getInsertedCount
());
$insertedIds
=
$result
->
getInsertedIds
();
$insertedIds
=
$result
->
getInsertedIds
();
$this
->
assertSame
(
'foo'
,
$insertedIds
[
0
]);
$this
->
assertSame
(
'foo'
,
$insertedIds
[
0
]);
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$insertedIds
[
1
]);
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$insertedIds
[
1
]);
$this
->
assertSame
(
'bar'
,
$insertedIds
[
2
]);
$this
->
assertSame
(
'bar'
,
$insertedIds
[
2
]);
$this
->
assertSame
(
'baz'
,
$insertedIds
[
3
]);
$this
->
assertSame
(
'baz'
,
$insertedIds
[
3
]);
...
@@ -151,6 +151,6 @@ class InsertManyFunctionalTest extends FunctionalTestCase
...
@@ -151,6 +151,6 @@ class InsertManyFunctionalTest extends FunctionalTestCase
*/
*/
public
function
testUnacknowledgedWriteConcernAccessesInsertedId
(
InsertManyResult
$result
)
public
function
testUnacknowledgedWriteConcernAccessesInsertedId
(
InsertManyResult
$result
)
{
{
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$result
->
getInsertedIds
()[
0
]);
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$result
->
getInsertedIds
()[
0
]);
}
}
}
}
tests/Operation/InsertOneFunctionalTest.php
View file @
76b24d7c
...
@@ -30,7 +30,7 @@ class InsertOneFunctionalTest extends FunctionalTestCase
...
@@ -30,7 +30,7 @@ class InsertOneFunctionalTest extends FunctionalTestCase
$operation
=
new
InsertOne
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$document
);
$operation
=
new
InsertOne
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$document
);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\InsertOneResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\InsertOneResult
::
class
,
$result
);
$this
->
assertSame
(
1
,
$result
->
getInsertedCount
());
$this
->
assertSame
(
1
,
$result
->
getInsertedCount
());
$this
->
assertSame
(
'foo'
,
$result
->
getInsertedId
());
$this
->
assertSame
(
'foo'
,
$result
->
getInsertedId
());
...
@@ -57,9 +57,9 @@ class InsertOneFunctionalTest extends FunctionalTestCase
...
@@ -57,9 +57,9 @@ class InsertOneFunctionalTest extends FunctionalTestCase
$operation
=
new
InsertOne
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$document
);
$operation
=
new
InsertOne
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$document
);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\InsertOneResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\InsertOneResult
::
class
,
$result
);
$this
->
assertSame
(
1
,
$result
->
getInsertedCount
());
$this
->
assertSame
(
1
,
$result
->
getInsertedCount
());
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$result
->
getInsertedId
());
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$result
->
getInsertedId
());
$expected
=
[
$expected
=
[
[
'_id'
=>
$result
->
getInsertedId
(),
'x'
=>
11
],
[
'_id'
=>
$result
->
getInsertedId
(),
'x'
=>
11
],
...
@@ -166,6 +166,6 @@ class InsertOneFunctionalTest extends FunctionalTestCase
...
@@ -166,6 +166,6 @@ class InsertOneFunctionalTest extends FunctionalTestCase
*/
*/
public
function
testUnacknowledgedWriteConcernAccessesInsertedId
(
InsertOneResult
$result
)
public
function
testUnacknowledgedWriteConcernAccessesInsertedId
(
InsertOneResult
$result
)
{
{
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$result
->
getInsertedId
());
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$result
->
getInsertedId
());
}
}
}
}
tests/Operation/ListCollectionsFunctionalTest.php
View file @
76b24d7c
...
@@ -24,12 +24,12 @@ class ListCollectionsFunctionalTest extends FunctionalTestCase
...
@@ -24,12 +24,12 @@ class ListCollectionsFunctionalTest extends FunctionalTestCase
$operation
=
new
ListCollections
(
$this
->
getDatabaseName
(),
[
'filter'
=>
[
'name'
=>
$this
->
getCollectionName
()]]);
$operation
=
new
ListCollections
(
$this
->
getDatabaseName
(),
[
'filter'
=>
[
'name'
=>
$this
->
getCollectionName
()]]);
$collections
=
$operation
->
execute
(
$server
);
$collections
=
$operation
->
execute
(
$server
);
$this
->
assertInstanceOf
(
'MongoDB\Model\CollectionInfoIterator'
,
$collections
);
$this
->
assertInstanceOf
(
\MongoDB\Model\CollectionInfoIterator
::
class
,
$collections
);
$this
->
assertCount
(
1
,
$collections
);
$this
->
assertCount
(
1
,
$collections
);
foreach
(
$collections
as
$collection
)
{
foreach
(
$collections
as
$collection
)
{
$this
->
assertInstanceOf
(
'MongoDB\Model\CollectionInfo'
,
$collection
);
$this
->
assertInstanceOf
(
\MongoDB\Model\CollectionInfo
::
class
,
$collection
);
$this
->
assertEquals
(
$this
->
getCollectionName
(),
$collection
->
getName
());
$this
->
assertEquals
(
$this
->
getCollectionName
(),
$collection
->
getName
());
}
}
}
}
...
@@ -49,10 +49,10 @@ class ListCollectionsFunctionalTest extends FunctionalTestCase
...
@@ -49,10 +49,10 @@ class ListCollectionsFunctionalTest extends FunctionalTestCase
$operation
=
new
ListCollections
(
$this
->
getDatabaseName
(),
[
'filter'
=>
[
'name'
=>
$this
->
getCollectionName
()]]);
$operation
=
new
ListCollections
(
$this
->
getDatabaseName
(),
[
'filter'
=>
[
'name'
=>
$this
->
getCollectionName
()]]);
$collections
=
$operation
->
execute
(
$server
);
$collections
=
$operation
->
execute
(
$server
);
$this
->
assertInstanceOf
(
'MongoDB\Model\CollectionInfoIterator'
,
$collections
);
$this
->
assertInstanceOf
(
\MongoDB\Model\CollectionInfoIterator
::
class
,
$collections
);
foreach
(
$collections
as
$collection
)
{
foreach
(
$collections
as
$collection
)
{
$this
->
assertInstanceOf
(
'MongoDB\Model\CollectionInfo'
,
$collection
);
$this
->
assertInstanceOf
(
\MongoDB\Model\CollectionInfo
::
class
,
$collection
);
$this
->
assertArrayHasKey
(
'readOnly'
,
$collection
[
'info'
]);
$this
->
assertArrayHasKey
(
'readOnly'
,
$collection
[
'info'
]);
$this
->
assertEquals
([
'v'
=>
2
,
'key'
=>
[
'_id'
=>
1
],
'name'
=>
'_id_'
,
'ns'
=>
$this
->
getNamespace
()],
$collection
[
'idIndex'
]);
$this
->
assertEquals
([
'v'
=>
2
,
'key'
=>
[
'_id'
=>
1
],
'name'
=>
'_id_'
,
'ns'
=>
$this
->
getNamespace
()],
$collection
[
'idIndex'
]);
}
}
...
...
tests/Operation/ListDatabasesFunctionalTest.php
View file @
76b24d7c
...
@@ -20,10 +20,10 @@ class ListDatabasesFunctionalTest extends FunctionalTestCase
...
@@ -20,10 +20,10 @@ class ListDatabasesFunctionalTest extends FunctionalTestCase
$operation
=
new
ListDatabases
();
$operation
=
new
ListDatabases
();
$databases
=
$operation
->
execute
(
$server
);
$databases
=
$operation
->
execute
(
$server
);
$this
->
assertInstanceOf
(
'MongoDB\Model\DatabaseInfoIterator'
,
$databases
);
$this
->
assertInstanceOf
(
\MongoDB\Model\DatabaseInfoIterator
::
class
,
$databases
);
foreach
(
$databases
as
$database
)
{
foreach
(
$databases
as
$database
)
{
$this
->
assertInstanceOf
(
'MongoDB\Model\DatabaseInfo'
,
$database
);
$this
->
assertInstanceOf
(
\MongoDB\Model\DatabaseInfo
::
class
,
$database
);
}
}
}
}
...
@@ -42,12 +42,12 @@ class ListDatabasesFunctionalTest extends FunctionalTestCase
...
@@ -42,12 +42,12 @@ class ListDatabasesFunctionalTest extends FunctionalTestCase
$operation
=
new
ListDatabases
([
'filter'
=>
[
'name'
=>
$this
->
getDatabaseName
()]]);
$operation
=
new
ListDatabases
([
'filter'
=>
[
'name'
=>
$this
->
getDatabaseName
()]]);
$databases
=
$operation
->
execute
(
$server
);
$databases
=
$operation
->
execute
(
$server
);
$this
->
assertInstanceOf
(
'MongoDB\Model\DatabaseInfoIterator'
,
$databases
);
$this
->
assertInstanceOf
(
\MongoDB\Model\DatabaseInfoIterator
::
class
,
$databases
);
$this
->
assertCount
(
1
,
$databases
);
$this
->
assertCount
(
1
,
$databases
);
foreach
(
$databases
as
$database
)
{
foreach
(
$databases
as
$database
)
{
$this
->
assertInstanceOf
(
'MongoDB\Model\DatabaseInfo'
,
$database
);
$this
->
assertInstanceOf
(
\MongoDB\Model\DatabaseInfo
::
class
,
$database
);
$this
->
assertEquals
(
$this
->
getDatabaseName
(),
$database
->
getName
());
$this
->
assertEquals
(
$this
->
getDatabaseName
(),
$database
->
getName
());
}
}
}
}
...
...
tests/Operation/ListIndexesFunctionalTest.php
View file @
76b24d7c
...
@@ -22,12 +22,12 @@ class ListIndexesFunctionalTest extends FunctionalTestCase
...
@@ -22,12 +22,12 @@ class ListIndexesFunctionalTest extends FunctionalTestCase
$operation
=
new
ListIndexes
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$operation
=
new
ListIndexes
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$indexes
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$indexes
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\Model\IndexInfoIterator'
,
$indexes
);
$this
->
assertInstanceOf
(
\MongoDB\Model\IndexInfoIterator
::
class
,
$indexes
);
$this
->
assertCount
(
1
,
$indexes
);
$this
->
assertCount
(
1
,
$indexes
);
foreach
(
$indexes
as
$index
)
{
foreach
(
$indexes
as
$index
)
{
$this
->
assertInstanceOf
(
'MongoDB\Model\IndexInfo'
,
$index
);
$this
->
assertInstanceOf
(
\MongoDB\Model\IndexInfo
::
class
,
$index
);
$this
->
assertEquals
([
'_id'
=>
1
],
$index
->
getKey
());
$this
->
assertEquals
([
'_id'
=>
1
],
$index
->
getKey
());
}
}
}
}
...
...
tests/Operation/MapReduceFunctionalTest.php
View file @
76b24d7c
...
@@ -89,7 +89,7 @@ class MapReduceFunctionalTest extends FunctionalTestCase
...
@@ -89,7 +89,7 @@ class MapReduceFunctionalTest extends FunctionalTestCase
$operation
=
new
MapReduce
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$map
,
$reduce
,
$out
);
$operation
=
new
MapReduce
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$map
,
$reduce
,
$out
);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\MapReduceResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\MapReduceResult
::
class
,
$result
);
$this
->
assertGreaterThanOrEqual
(
0
,
$result
->
getExecutionTimeMS
());
$this
->
assertGreaterThanOrEqual
(
0
,
$result
->
getExecutionTimeMS
());
$this
->
assertNotEmpty
(
$result
->
getCounts
());
$this
->
assertNotEmpty
(
$result
->
getCounts
());
}
}
...
@@ -105,7 +105,7 @@ class MapReduceFunctionalTest extends FunctionalTestCase
...
@@ -105,7 +105,7 @@ class MapReduceFunctionalTest extends FunctionalTestCase
$operation
=
new
MapReduce
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$map
,
$reduce
,
$out
,
[
'verbose'
=>
true
]);
$operation
=
new
MapReduce
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$map
,
$reduce
,
$out
,
[
'verbose'
=>
true
]);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\MapReduceResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\MapReduceResult
::
class
,
$result
);
$this
->
assertGreaterThanOrEqual
(
0
,
$result
->
getExecutionTimeMS
());
$this
->
assertGreaterThanOrEqual
(
0
,
$result
->
getExecutionTimeMS
());
$this
->
assertNotEmpty
(
$result
->
getCounts
());
$this
->
assertNotEmpty
(
$result
->
getCounts
());
$this
->
assertNotEmpty
(
$result
->
getTiming
());
$this
->
assertNotEmpty
(
$result
->
getTiming
());
...
@@ -122,7 +122,7 @@ class MapReduceFunctionalTest extends FunctionalTestCase
...
@@ -122,7 +122,7 @@ class MapReduceFunctionalTest extends FunctionalTestCase
$operation
=
new
MapReduce
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$map
,
$reduce
,
$out
,
[
'verbose'
=>
false
]);
$operation
=
new
MapReduce
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$map
,
$reduce
,
$out
,
[
'verbose'
=>
false
]);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\MapReduceResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\MapReduceResult
::
class
,
$result
);
$this
->
assertGreaterThanOrEqual
(
0
,
$result
->
getExecutionTimeMS
());
$this
->
assertGreaterThanOrEqual
(
0
,
$result
->
getExecutionTimeMS
());
$this
->
assertNotEmpty
(
$result
->
getCounts
());
$this
->
assertNotEmpty
(
$result
->
getCounts
());
$this
->
assertEmpty
(
$result
->
getTiming
());
$this
->
assertEmpty
(
$result
->
getTiming
());
...
...
tests/Operation/UpdateFunctionalTest.php
View file @
76b24d7c
...
@@ -105,7 +105,7 @@ class UpdateFunctionalTest extends FunctionalTestCase
...
@@ -105,7 +105,7 @@ class UpdateFunctionalTest extends FunctionalTestCase
$operation
=
new
Update
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$filter
,
$update
);
$operation
=
new
Update
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$filter
,
$update
);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\UpdateResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\UpdateResult
::
class
,
$result
);
$this
->
assertSame
(
1
,
$result
->
getMatchedCount
());
$this
->
assertSame
(
1
,
$result
->
getMatchedCount
());
$this
->
assertSame
(
1
,
$result
->
getModifiedCount
());
$this
->
assertSame
(
1
,
$result
->
getModifiedCount
());
$this
->
assertSame
(
0
,
$result
->
getUpsertedCount
());
$this
->
assertSame
(
0
,
$result
->
getUpsertedCount
());
...
@@ -131,7 +131,7 @@ class UpdateFunctionalTest extends FunctionalTestCase
...
@@ -131,7 +131,7 @@ class UpdateFunctionalTest extends FunctionalTestCase
$operation
=
new
Update
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$filter
,
$update
,
$options
);
$operation
=
new
Update
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$filter
,
$update
,
$options
);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\UpdateResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\UpdateResult
::
class
,
$result
);
$this
->
assertSame
(
2
,
$result
->
getMatchedCount
());
$this
->
assertSame
(
2
,
$result
->
getMatchedCount
());
$this
->
assertSame
(
2
,
$result
->
getModifiedCount
());
$this
->
assertSame
(
2
,
$result
->
getModifiedCount
());
$this
->
assertSame
(
0
,
$result
->
getUpsertedCount
());
$this
->
assertSame
(
0
,
$result
->
getUpsertedCount
());
...
@@ -157,7 +157,7 @@ class UpdateFunctionalTest extends FunctionalTestCase
...
@@ -157,7 +157,7 @@ class UpdateFunctionalTest extends FunctionalTestCase
$operation
=
new
Update
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$filter
,
$update
,
$options
);
$operation
=
new
Update
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$filter
,
$update
,
$options
);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\UpdateResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\UpdateResult
::
class
,
$result
);
$this
->
assertSame
(
0
,
$result
->
getMatchedCount
());
$this
->
assertSame
(
0
,
$result
->
getMatchedCount
());
$this
->
assertSame
(
0
,
$result
->
getModifiedCount
());
$this
->
assertSame
(
0
,
$result
->
getModifiedCount
());
$this
->
assertSame
(
1
,
$result
->
getUpsertedCount
());
$this
->
assertSame
(
1
,
$result
->
getUpsertedCount
());
...
@@ -184,11 +184,11 @@ class UpdateFunctionalTest extends FunctionalTestCase
...
@@ -184,11 +184,11 @@ class UpdateFunctionalTest extends FunctionalTestCase
$operation
=
new
Update
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$filter
,
$update
,
$options
);
$operation
=
new
Update
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$filter
,
$update
,
$options
);
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$result
=
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
assertInstanceOf
(
'MongoDB\UpdateResult'
,
$result
);
$this
->
assertInstanceOf
(
\MongoDB\UpdateResult
::
class
,
$result
);
$this
->
assertSame
(
0
,
$result
->
getMatchedCount
());
$this
->
assertSame
(
0
,
$result
->
getMatchedCount
());
$this
->
assertSame
(
0
,
$result
->
getModifiedCount
());
$this
->
assertSame
(
0
,
$result
->
getModifiedCount
());
$this
->
assertSame
(
1
,
$result
->
getUpsertedCount
());
$this
->
assertSame
(
1
,
$result
->
getUpsertedCount
());
$this
->
assertInstanceOf
(
'MongoDB\BSON\ObjectId'
,
$result
->
getUpsertedId
());
$this
->
assertInstanceOf
(
\MongoDB\BSON\ObjectId
::
class
,
$result
->
getUpsertedId
());
$expected
=
[
$expected
=
[
[
'_id'
=>
1
,
'x'
=>
11
],
[
'_id'
=>
1
,
'x'
=>
11
],
...
...
tests/bootstrap.php
View file @
76b24d7c
...
@@ -10,10 +10,10 @@ if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
...
@@ -10,10 +10,10 @@ if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
throw
new
Exception
(
'Can\'t find autoload.php. Did you install dependencies with Composer?'
);
throw
new
Exception
(
'Can\'t find autoload.php. Did you install dependencies with Composer?'
);
}
}
if
(
!
class_exists
(
'PHPUnit\Framework\Error\Warning'
))
{
if
(
!
class_exists
(
PHPUnit\Framework\Error\Warning
::
class
))
{
class_alias
(
'PHPUnit_Framework_Error_Warning'
,
'PHPUnit\Framework\Error\Warning'
);
class_alias
(
PHPUnit_Framework_Error_Warning
::
class
,
PHPUnit\Framework\Error\Warning
::
class
);
}
}
if
(
!
class_exists
(
'PHPUnit\Framework\Constraint\Constraint'
))
{
if
(
!
class_exists
(
PHPUnit\Framework\Constraint\Constraint
::
class
))
{
class_alias
(
'PHPUnit_Framework_Constraint'
,
'PHPUnit\Framework\Constraint\Constraint'
);
class_alias
(
PHPUnit_Framework_Constraint
::
class
,
PHPUnit\Framework\Constraint\Constraint
::
class
);
}
}
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