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
4f7986af
Unverified
Commit
4f7986af
authored
Aug 09, 2019
by
Andreas Braun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-462: Replace assertInternalType with type-specific methods
parent
82418090
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
34 additions
and
34 deletions
+34
-34
ClientTest.php
tests/ClientTest.php
+4
-4
CollectionFunctionalTest.php
tests/Collection/CollectionFunctionalTest.php
+2
-2
CrudSpecFunctionalTest.php
tests/Collection/CrudSpecFunctionalTest.php
+5
-5
DatabaseFunctionalTest.php
tests/Database/DatabaseFunctionalTest.php
+5
-5
DocumentationExamplesTest.php
tests/DocumentationExamplesTest.php
+1
-1
BucketFunctionalTest.php
tests/GridFS/BucketFunctionalTest.php
+1
-1
FunctionalTestCase.php
tests/GridFS/FunctionalTestCase.php
+1
-1
WatchFunctionalTest.php
tests/Operation/WatchFunctionalTest.php
+5
-5
CommandMonitoringSpecTest.php
tests/SpecTests/CommandMonitoringSpecTest.php
+6
-6
ResultExpectation.php
tests/SpecTests/ResultExpectation.php
+2
-2
TransactionsSpecTest.php
tests/SpecTests/TransactionsSpecTest.php
+2
-2
No files found.
tests/ClientTest.php
View file @
4f7986af
...
@@ -67,7 +67,7 @@ class ClientTest extends TestCase
...
@@ -67,7 +67,7 @@ class ClientTest extends TestCase
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$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
->
assertI
nternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertI
sArray
(
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
...
@@ -90,7 +90,7 @@ class ClientTest extends TestCase
...
@@ -90,7 +90,7 @@ class ClientTest extends TestCase
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$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
->
assertI
nternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertI
sArray
(
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
...
@@ -129,7 +129,7 @@ class ClientTest extends TestCase
...
@@ -129,7 +129,7 @@ class ClientTest extends TestCase
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$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
->
assertI
nternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertI
sArray
(
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
...
@@ -152,7 +152,7 @@ class ClientTest extends TestCase
...
@@ -152,7 +152,7 @@ class ClientTest extends TestCase
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$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
->
assertI
nternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertI
sArray
(
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$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 @
4f7986af
...
@@ -262,7 +262,7 @@ class CollectionFunctionalTest extends FunctionalTestCase
...
@@ -262,7 +262,7 @@ class CollectionFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$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
->
assertI
nternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertI
sArray
(
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
...
@@ -284,7 +284,7 @@ class CollectionFunctionalTest extends FunctionalTestCase
...
@@ -284,7 +284,7 @@ class CollectionFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$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
->
assertI
nternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertI
sArray
(
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$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/CrudSpecFunctionalTest.php
View file @
4f7986af
...
@@ -300,7 +300,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
...
@@ -300,7 +300,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
break
;
break
;
case
'bulkWrite'
:
case
'bulkWrite'
:
$this
->
assertI
nternalType
(
'array'
,
$expectedResult
);
$this
->
assertI
sArray
(
$expectedResult
);
$this
->
assertInstanceOf
(
\MongoDB\BulkWriteResult
::
class
,
$actualResult
);
$this
->
assertInstanceOf
(
\MongoDB\BulkWriteResult
::
class
,
$actualResult
);
if
(
isset
(
$expectedResult
[
'deletedCount'
]))
{
if
(
isset
(
$expectedResult
[
'deletedCount'
]))
{
...
@@ -357,7 +357,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
...
@@ -357,7 +357,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
case
'deleteMany'
:
case
'deleteMany'
:
case
'deleteOne'
:
case
'deleteOne'
:
$this
->
assertI
nternalType
(
'array'
,
$expectedResult
);
$this
->
assertI
sArray
(
$expectedResult
);
$this
->
assertInstanceOf
(
\MongoDB\DeleteResult
::
class
,
$actualResult
);
$this
->
assertInstanceOf
(
\MongoDB\DeleteResult
::
class
,
$actualResult
);
if
(
isset
(
$expectedResult
[
'deletedCount'
]))
{
if
(
isset
(
$expectedResult
[
'deletedCount'
]))
{
...
@@ -375,7 +375,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
...
@@ -375,7 +375,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
break
;
break
;
case
'insertMany'
:
case
'insertMany'
:
$this
->
assertI
nternalType
(
'array'
,
$expectedResult
);
$this
->
assertI
sArray
(
$expectedResult
);
$this
->
assertInstanceOf
(
\MongoDB\InsertManyResult
::
class
,
$actualResult
);
$this
->
assertInstanceOf
(
\MongoDB\InsertManyResult
::
class
,
$actualResult
);
if
(
isset
(
$expectedResult
[
'insertedCount'
]))
{
if
(
isset
(
$expectedResult
[
'insertedCount'
]))
{
...
@@ -391,7 +391,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
...
@@ -391,7 +391,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
break
;
break
;
case
'insertOne'
:
case
'insertOne'
:
$this
->
assertI
nternalType
(
'array'
,
$expectedResult
);
$this
->
assertI
sArray
(
$expectedResult
);
$this
->
assertInstanceOf
(
\MongoDB\InsertOneResult
::
class
,
$actualResult
);
$this
->
assertInstanceOf
(
\MongoDB\InsertOneResult
::
class
,
$actualResult
);
if
(
isset
(
$expectedResult
[
'insertedCount'
]))
{
if
(
isset
(
$expectedResult
[
'insertedCount'
]))
{
...
@@ -409,7 +409,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
...
@@ -409,7 +409,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
case
'replaceOne'
:
case
'replaceOne'
:
case
'updateMany'
:
case
'updateMany'
:
case
'updateOne'
:
case
'updateOne'
:
$this
->
assertI
nternalType
(
'array'
,
$expectedResult
);
$this
->
assertI
sArray
(
$expectedResult
);
$this
->
assertInstanceOf
(
\MongoDB\UpdateResult
::
class
,
$actualResult
);
$this
->
assertInstanceOf
(
\MongoDB\UpdateResult
::
class
,
$actualResult
);
if
(
isset
(
$expectedResult
[
'matchedCount'
]))
{
if
(
isset
(
$expectedResult
[
'matchedCount'
]))
{
...
...
tests/Database/DatabaseFunctionalTest.php
View file @
4f7986af
...
@@ -111,7 +111,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
...
@@ -111,7 +111,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$commandResult
=
current
(
$cursor
->
toArray
());
$commandResult
=
current
(
$cursor
->
toArray
());
$this
->
assertCommandSucceeded
(
$commandResult
);
$this
->
assertCommandSucceeded
(
$commandResult
);
$this
->
assertI
nternalType
(
'array'
,
$commandResult
);
$this
->
assertI
sArray
(
$commandResult
);
$this
->
assertArrayHasKey
(
'ismaster'
,
$commandResult
);
$this
->
assertArrayHasKey
(
'ismaster'
,
$commandResult
);
$this
->
assertTrue
(
$commandResult
[
'ismaster'
]);
$this
->
assertTrue
(
$commandResult
[
'ismaster'
]);
}
}
...
@@ -207,7 +207,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
...
@@ -207,7 +207,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$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
->
assertI
nternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertI
sArray
(
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
...
@@ -229,7 +229,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
...
@@ -229,7 +229,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$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
->
assertI
nternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertI
sArray
(
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
...
@@ -303,7 +303,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
...
@@ -303,7 +303,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$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
->
assertI
nternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertI
sArray
(
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$debug
[
'writeConcern'
]);
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
$this
->
assertSame
(
WriteConcern
::
MAJORITY
,
$debug
[
'writeConcern'
]
->
getW
());
...
@@ -325,7 +325,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
...
@@ -325,7 +325,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertSame
(
ReadConcern
::
LOCAL
,
$debug
[
'readConcern'
]
->
getLevel
());
$this
->
assertInstanceOf
(
\MongoDB\Driver\ReadPreference
::
class
,
$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
->
assertI
nternalType
(
'array'
,
$debug
[
'typeMap'
]);
$this
->
assertI
sArray
(
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertSame
([
'root'
=>
'array'
],
$debug
[
'typeMap'
]);
$this
->
assertInstanceOf
(
\MongoDB\Driver\WriteConcern
::
class
,
$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 @
4f7986af
...
@@ -498,7 +498,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
...
@@ -498,7 +498,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this
->
assertSame
(
2
,
$insertManyResult
->
getInsertedCount
());
$this
->
assertSame
(
2
,
$insertManyResult
->
getInsertedCount
());
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
foreach
(
$insertManyResult
->
getInsertedIds
()
as
$id
)
{
$this
->
assertI
nternalType
(
'int'
,
$id
);
$this
->
assertI
sInt
(
$id
);
}
}
$this
->
assertInventoryCount
(
2
);
$this
->
assertInventoryCount
(
2
);
...
...
tests/GridFS/BucketFunctionalTest.php
View file @
4f7986af
...
@@ -502,7 +502,7 @@ class BucketFunctionalTest extends FunctionalTestCase
...
@@ -502,7 +502,7 @@ class BucketFunctionalTest extends FunctionalTestCase
$expectedReadLength
=
min
(
4096
,
strlen
(
$input
)
-
strlen
(
$buffer
));
$expectedReadLength
=
min
(
4096
,
strlen
(
$input
)
-
strlen
(
$buffer
));
$buffer
.=
$read
=
fread
(
$stream
,
4096
);
$buffer
.=
$read
=
fread
(
$stream
,
4096
);
$this
->
assertI
nternalType
(
'string'
,
$read
);
$this
->
assertI
sString
(
$read
);
$this
->
assertEquals
(
$expectedReadLength
,
strlen
(
$read
));
$this
->
assertEquals
(
$expectedReadLength
,
strlen
(
$read
));
}
}
...
...
tests/GridFS/FunctionalTestCase.php
View file @
4f7986af
...
@@ -39,7 +39,7 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase
...
@@ -39,7 +39,7 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase
*/
*/
protected
function
assertStreamContents
(
$expectedContents
,
$stream
)
protected
function
assertStreamContents
(
$expectedContents
,
$stream
)
{
{
$this
->
assertI
nternalType
(
'resource'
,
$stream
);
$this
->
assertI
sResource
(
$stream
);
$this
->
assertSame
(
'stream'
,
get_resource_type
(
$stream
));
$this
->
assertSame
(
'stream'
,
get_resource_type
(
$stream
));
$this
->
assertEquals
(
$expectedContents
,
stream_get_contents
(
$stream
,
-
1
,
0
));
$this
->
assertEquals
(
$expectedContents
,
stream_get_contents
(
$stream
,
-
1
,
0
));
}
}
...
...
tests/Operation/WatchFunctionalTest.php
View file @
4f7986af
...
@@ -277,7 +277,7 @@ class WatchFunctionalTest extends FunctionalTestCase
...
@@ -277,7 +277,7 @@ class WatchFunctionalTest extends FunctionalTestCase
private
function
assertResumeAfter
(
$expectedResumeToken
,
stdClass
$command
)
private
function
assertResumeAfter
(
$expectedResumeToken
,
stdClass
$command
)
{
{
$this
->
assertObjectHasAttribute
(
'pipeline'
,
$command
);
$this
->
assertObjectHasAttribute
(
'pipeline'
,
$command
);
$this
->
assertI
nternalType
(
'array'
,
$command
->
pipeline
);
$this
->
assertI
sArray
(
$command
->
pipeline
);
$this
->
assertArrayHasKey
(
0
,
$command
->
pipeline
);
$this
->
assertArrayHasKey
(
0
,
$command
->
pipeline
);
$this
->
assertObjectHasAttribute
(
'$changeStream'
,
$command
->
pipeline
[
0
]);
$this
->
assertObjectHasAttribute
(
'$changeStream'
,
$command
->
pipeline
[
0
]);
$this
->
assertObjectHasAttribute
(
'resumeAfter'
,
$command
->
pipeline
[
0
]
->
{
'$changeStream'
});
$this
->
assertObjectHasAttribute
(
'resumeAfter'
,
$command
->
pipeline
[
0
]
->
{
'$changeStream'
});
...
@@ -354,7 +354,7 @@ class WatchFunctionalTest extends FunctionalTestCase
...
@@ -354,7 +354,7 @@ class WatchFunctionalTest extends FunctionalTestCase
private
function
assertStartAtOperationTime
(
TimestampInterface
$expectedOperationTime
,
stdClass
$command
)
private
function
assertStartAtOperationTime
(
TimestampInterface
$expectedOperationTime
,
stdClass
$command
)
{
{
$this
->
assertObjectHasAttribute
(
'pipeline'
,
$command
);
$this
->
assertObjectHasAttribute
(
'pipeline'
,
$command
);
$this
->
assertI
nternalType
(
'array'
,
$command
->
pipeline
);
$this
->
assertI
sArray
(
$command
->
pipeline
);
$this
->
assertArrayHasKey
(
0
,
$command
->
pipeline
);
$this
->
assertArrayHasKey
(
0
,
$command
->
pipeline
);
$this
->
assertObjectHasAttribute
(
'$changeStream'
,
$command
->
pipeline
[
0
]);
$this
->
assertObjectHasAttribute
(
'$changeStream'
,
$command
->
pipeline
[
0
]);
$this
->
assertObjectHasAttribute
(
'startAtOperationTime'
,
$command
->
pipeline
[
0
]
->
{
'$changeStream'
});
$this
->
assertObjectHasAttribute
(
'startAtOperationTime'
,
$command
->
pipeline
[
0
]
->
{
'$changeStream'
});
...
@@ -1183,7 +1183,7 @@ class WatchFunctionalTest extends FunctionalTestCase
...
@@ -1183,7 +1183,7 @@ class WatchFunctionalTest extends FunctionalTestCase
$rp
=
$rc
->
getProperty
(
'resumeCallable'
);
$rp
=
$rc
->
getProperty
(
'resumeCallable'
);
$rp
->
setAccessible
(
true
);
$rp
->
setAccessible
(
true
);
$this
->
assertI
nternalType
(
'callable'
,
$rp
->
getValue
(
$changeStream
));
$this
->
assertI
sCallable
(
$rp
->
getValue
(
$changeStream
));
// Invalidate the cursor to verify that resumeCallable is unset when the cursor is exhausted.
// Invalidate the cursor to verify that resumeCallable is unset when the cursor is exhausted.
$this
->
dropCollection
();
$this
->
dropCollection
();
...
@@ -1210,9 +1210,9 @@ class WatchFunctionalTest extends FunctionalTestCase
...
@@ -1210,9 +1210,9 @@ class WatchFunctionalTest extends FunctionalTestCase
private
function
getPostBatchResumeTokenFromReply
(
stdClass
$reply
)
private
function
getPostBatchResumeTokenFromReply
(
stdClass
$reply
)
{
{
$this
->
assertObjectHasAttribute
(
'cursor'
,
$reply
);
$this
->
assertObjectHasAttribute
(
'cursor'
,
$reply
);
$this
->
assertI
nternalType
(
'object'
,
$reply
->
cursor
);
$this
->
assertI
sObject
(
$reply
->
cursor
);
$this
->
assertObjectHasAttribute
(
'postBatchResumeToken'
,
$reply
->
cursor
);
$this
->
assertObjectHasAttribute
(
'postBatchResumeToken'
,
$reply
->
cursor
);
$this
->
assertI
nternalType
(
'object'
,
$reply
->
cursor
->
postBatchResumeToken
);
$this
->
assertI
sObject
(
$reply
->
cursor
->
postBatchResumeToken
);
return
$reply
->
cursor
->
postBatchResumeToken
;
return
$reply
->
cursor
->
postBatchResumeToken
;
}
}
...
...
tests/SpecTests/CommandMonitoringSpecTest.php
View file @
4f7986af
...
@@ -32,7 +32,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase
...
@@ -32,7 +32,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase
if
(
isset
(
$expected
->
killCursors
)
&&
isset
(
$expected
->
cursors
)
&&
is_array
(
$expected
->
cursors
))
{
if
(
isset
(
$expected
->
killCursors
)
&&
isset
(
$expected
->
cursors
)
&&
is_array
(
$expected
->
cursors
))
{
static
::
assertObjectHasAttribute
(
'cursors'
,
$actual
);
static
::
assertObjectHasAttribute
(
'cursors'
,
$actual
);
static
::
assertI
nternalType
(
'array'
,
$actual
->
cursors
);
static
::
assertI
sArray
(
$actual
->
cursors
);
foreach
(
$expected
->
cursors
as
$i
=>
$cursorId
)
{
foreach
(
$expected
->
cursors
as
$i
=>
$cursorId
)
{
static
::
assertArrayHasKey
(
$i
,
$actual
->
cursors
);
static
::
assertArrayHasKey
(
$i
,
$actual
->
cursors
);
...
@@ -63,7 +63,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase
...
@@ -63,7 +63,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase
{
{
if
(
isset
(
$expected
->
cursor
->
id
)
&&
$expected
->
cursor
->
id
===
42
)
{
if
(
isset
(
$expected
->
cursor
->
id
)
&&
$expected
->
cursor
->
id
===
42
)
{
static
::
assertObjectHasAttribute
(
'cursor'
,
$actual
);
static
::
assertObjectHasAttribute
(
'cursor'
,
$actual
);
static
::
assertI
nternalType
(
'object'
,
$actual
->
cursor
);
static
::
assertI
sObject
(
$actual
->
cursor
);
static
::
assertObjectHasAttribute
(
'id'
,
$actual
->
cursor
);
static
::
assertObjectHasAttribute
(
'id'
,
$actual
->
cursor
);
static
::
assertThat
(
$actual
->
cursor
->
id
,
static
::
logicalOr
(
static
::
assertThat
(
$actual
->
cursor
->
id
,
static
::
logicalOr
(
static
::
isInstanceOf
(
Int64
::
class
),
static
::
isInstanceOf
(
Int64
::
class
),
...
@@ -74,7 +74,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase
...
@@ -74,7 +74,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase
if
(
isset
(
$expected
->
cursorsUnknown
)
&&
is_array
(
$expected
->
cursorsUnknown
))
{
if
(
isset
(
$expected
->
cursorsUnknown
)
&&
is_array
(
$expected
->
cursorsUnknown
))
{
static
::
assertObjectHasAttribute
(
'cursorsUnknown'
,
$actual
);
static
::
assertObjectHasAttribute
(
'cursorsUnknown'
,
$actual
);
static
::
assertI
nternalType
(
'array'
,
$actual
->
cursorsUnknown
);
static
::
assertI
sArray
(
$actual
->
cursorsUnknown
);
foreach
(
$expected
->
cursorsUnknown
as
$i
=>
$cursorId
)
{
foreach
(
$expected
->
cursorsUnknown
as
$i
=>
$cursorId
)
{
static
::
assertArrayHasKey
(
$i
,
$actual
->
cursorsUnknown
);
static
::
assertArrayHasKey
(
$i
,
$actual
->
cursorsUnknown
);
...
@@ -92,14 +92,14 @@ class CommandMonitoringSpecTest extends FunctionalTestCase
...
@@ -92,14 +92,14 @@ class CommandMonitoringSpecTest extends FunctionalTestCase
if
(
isset
(
$expected
->
ok
)
&&
is_numeric
(
$expected
->
ok
))
{
if
(
isset
(
$expected
->
ok
)
&&
is_numeric
(
$expected
->
ok
))
{
static
::
assertObjectHasAttribute
(
'ok'
,
$actual
);
static
::
assertObjectHasAttribute
(
'ok'
,
$actual
);
static
::
assertI
nternalType
(
'numeric'
,
$actual
->
ok
);
static
::
assertI
sNumeric
(
$actual
->
ok
);
static
::
assertEquals
(
$expected
->
ok
,
$actual
->
ok
);
static
::
assertEquals
(
$expected
->
ok
,
$actual
->
ok
);
unset
(
$expected
->
ok
);
unset
(
$expected
->
ok
);
}
}
if
(
isset
(
$expected
->
writeErrors
)
&&
is_array
(
$expected
->
writeErrors
))
{
if
(
isset
(
$expected
->
writeErrors
)
&&
is_array
(
$expected
->
writeErrors
))
{
static
::
assertObjectHasAttribute
(
'writeErrors'
,
$actual
);
static
::
assertObjectHasAttribute
(
'writeErrors'
,
$actual
);
static
::
assertI
nternalType
(
'array'
,
$actual
->
writeErrors
);
static
::
assertI
sArray
(
$actual
->
writeErrors
);
foreach
(
$expected
->
writeErrors
as
$i
=>
$expectedWriteError
)
{
foreach
(
$expected
->
writeErrors
as
$i
=>
$expectedWriteError
)
{
static
::
assertArrayHasKey
(
$i
,
$actual
->
writeErrors
);
static
::
assertArrayHasKey
(
$i
,
$actual
->
writeErrors
);
...
@@ -116,7 +116,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase
...
@@ -116,7 +116,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase
if
(
isset
(
$expectedWriteError
->
errmsg
)
&&
$expectedWriteError
->
errmsg
===
''
)
{
if
(
isset
(
$expectedWriteError
->
errmsg
)
&&
$expectedWriteError
->
errmsg
===
''
)
{
static
::
assertObjectHasAttribute
(
'errmsg'
,
$actualWriteError
);
static
::
assertObjectHasAttribute
(
'errmsg'
,
$actualWriteError
);
static
::
assertI
nternalType
(
'string'
,
$actualWriteError
->
errmsg
);
static
::
assertI
sString
(
$actualWriteError
->
errmsg
);
static
::
assertNotEmpty
(
$actualWriteError
->
errmsg
);
static
::
assertNotEmpty
(
$actualWriteError
->
errmsg
);
unset
(
$expected
->
writeErrors
[
$i
]
->
errmsg
);
unset
(
$expected
->
writeErrors
[
$i
]
->
errmsg
);
}
}
...
...
tests/SpecTests/ResultExpectation.php
View file @
4f7986af
...
@@ -216,7 +216,7 @@ final class ResultExpectation
...
@@ -216,7 +216,7 @@ final class ResultExpectation
break
;
break
;
case
self
::
ASSERT_MATCHES_DOCUMENT
:
case
self
::
ASSERT_MATCHES_DOCUMENT
:
$test
->
assertI
nternalType
(
'object'
,
$expected
);
$test
->
assertI
sObject
(
$expected
);
$test
->
assertThat
(
$actual
,
$test
->
logicalOr
(
$test
->
assertThat
(
$actual
,
$test
->
logicalOr
(
$test
->
isType
(
'array'
),
$test
->
isType
(
'array'
),
$test
->
isType
(
'object'
)
$test
->
isType
(
'object'
)
...
@@ -236,7 +236,7 @@ final class ResultExpectation
...
@@ -236,7 +236,7 @@ final class ResultExpectation
break
;
break
;
case
self
::
ASSERT_SAME_DOCUMENT
:
case
self
::
ASSERT_SAME_DOCUMENT
:
$test
->
assertI
nternalType
(
'object'
,
$expected
);
$test
->
assertI
sObject
(
$expected
);
$test
->
assertThat
(
$actual
,
$test
->
logicalOr
(
$test
->
assertThat
(
$actual
,
$test
->
logicalOr
(
$test
->
isType
(
'array'
),
$test
->
isType
(
'array'
),
$test
->
isType
(
'object'
)
$test
->
isType
(
'object'
)
...
...
tests/SpecTests/TransactionsSpecTest.php
View file @
4f7986af
...
@@ -78,13 +78,13 @@ class TransactionsSpecTest extends FunctionalTestCase
...
@@ -78,13 +78,13 @@ class TransactionsSpecTest extends FunctionalTestCase
if
(
isset
(
$expected
->
recoveryToken
)
&&
$expected
->
recoveryToken
===
42
)
{
if
(
isset
(
$expected
->
recoveryToken
)
&&
$expected
->
recoveryToken
===
42
)
{
static
::
assertObjectHasAttribute
(
'recoveryToken'
,
$actual
);
static
::
assertObjectHasAttribute
(
'recoveryToken'
,
$actual
);
static
::
assertI
nternalType
(
'object'
,
$actual
->
recoveryToken
);
static
::
assertI
sObject
(
$actual
->
recoveryToken
);
unset
(
$expected
->
recoveryToken
);
unset
(
$expected
->
recoveryToken
);
}
}
if
(
isset
(
$expected
->
readConcern
->
afterClusterTime
)
&&
$expected
->
readConcern
->
afterClusterTime
===
42
)
{
if
(
isset
(
$expected
->
readConcern
->
afterClusterTime
)
&&
$expected
->
readConcern
->
afterClusterTime
===
42
)
{
static
::
assertObjectHasAttribute
(
'readConcern'
,
$actual
);
static
::
assertObjectHasAttribute
(
'readConcern'
,
$actual
);
static
::
assertI
nternalType
(
'object'
,
$actual
->
readConcern
);
static
::
assertI
sObject
(
$actual
->
readConcern
);
static
::
assertObjectHasAttribute
(
'afterClusterTime'
,
$actual
->
readConcern
);
static
::
assertObjectHasAttribute
(
'afterClusterTime'
,
$actual
->
readConcern
);
static
::
assertInstanceOf
(
Timestamp
::
class
,
$actual
->
readConcern
->
afterClusterTime
);
static
::
assertInstanceOf
(
Timestamp
::
class
,
$actual
->
readConcern
->
afterClusterTime
);
unset
(
$expected
->
readConcern
->
afterClusterTime
);
unset
(
$expected
->
readConcern
->
afterClusterTime
);
...
...
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