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
a72cbe38
Unverified
Commit
a72cbe38
authored
Aug 23, 2019
by
Andreas Braun
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #669
parents
5042a2fa
83260b5d
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
41 additions
and
22 deletions
+41
-22
.travis.yml
.travis.yml
+7
-10
setup_mo.sh
.travis/setup_mo.sh
+1
-1
CollectionFunctionalTest.php
tests/Collection/CollectionFunctionalTest.php
+7
-4
FunctionalTestCase.php
tests/FunctionalTestCase.php
+3
-3
AggregateFunctionalTest.php
tests/Operation/AggregateFunctionalTest.php
+11
-1
WatchFunctionalTest.php
tests/Operation/WatchFunctionalTest.php
+2
-1
ChangeStreamsSpecTest.php
tests/SpecTests/ChangeStreamsSpecTest.php
+8
-0
ErrorExpectation.php
tests/SpecTests/ErrorExpectation.php
+2
-2
No files found.
.travis.yml
View file @
a72cbe38
...
...
@@ -14,9 +14,9 @@ cache:
env
:
global
:
-
DRIVER_VERSION=1.6.0alpha
2
-
DRIVER_VERSION=1.6.0alpha
3
-
SERVER_DISTRO=ubuntu1604
-
SERVER_VERSION=4.
0.1
0
-
SERVER_VERSION=4.
2.
0
-
DEPLOYMENT=STANDALONE
-
COMPOSER_OPTIONS=
...
...
@@ -44,7 +44,7 @@ jobs:
env
:
-
COMPOSER_OPTIONS=--prefer-lowest
# Test older standalone server versions (3.0-
3.6
)
# Test older standalone server versions (3.0-
4.0
)
-
stage
:
Test
php
:
"
7.0"
dist
:
trusty
...
...
@@ -66,6 +66,10 @@ jobs:
php
:
"
7.0"
env
:
-
SERVER_VERSION=3.6.13
-
stage
:
Test
php
:
"
7.3"
env
:
-
SERVER_VERSION=4.0.12
# Test other server configurations
-
stage
:
Test
...
...
@@ -94,13 +98,6 @@ jobs:
env
:
-
DEPLOYMENT=SHARDED_CLUSTER_RS
# Test upcoming server versions
-
stage
:
Test
php
:
"
7.3"
env
:
-
SERVER_VERSION=4.2.0-rc1
-
DEPLOYMENT=REPLICASET
before_install
:
-
pip install "mongo-orchestration>=0.6.7,<1.0" --user `whoami`
-
export SERVER_FILENAME=mongodb-linux-x86_64-${SERVER_DISTRO}-${SERVER_VERSION}
...
...
.travis/setup_mo.sh
View file @
a72cbe38
...
...
@@ -9,7 +9,7 @@ fi
case
$DEPLOYMENT
in
SHARDED_CLUSTER
)
${
TRAVIS_BUILD_DIR
}
/.travis/mo.sh
${
TRAVIS_BUILD_DIR
}
/mongo-orchestration/sharded_clusters/cluster.json start
>
/tmp/mo-result.json
cat
/tmp/mo-result.json |
tail
-n
1 | php
-r
'echo json_decode(file_get_contents("php://stdin"))->mongodb_uri;'
>
/tmp/uri.txt
cat
/tmp/mo-result.json |
tail
-n
1 | php
-r
'echo json_decode(file_get_contents("php://stdin"))->mongodb_uri
, "/?retryWrites=false"
;'
>
/tmp/uri.txt
;;
SHARDED_CLUSTER_RS
)
${
TRAVIS_BUILD_DIR
}
/.travis/mo.sh
${
TRAVIS_BUILD_DIR
}
/mongo-orchestration/sharded_clusters/cluster_replset.json start
>
/tmp/mo-result.json
...
...
tests/Collection/CollectionFunctionalTest.php
View file @
a72cbe38
...
...
@@ -9,6 +9,7 @@ use MongoDB\Driver\ReadConcern;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Operation\Count
;
use
MongoDB\Operation\MapReduce
;
use
MongoDB\Tests\CommandObserver
;
...
...
@@ -619,8 +620,6 @@ class CollectionFunctionalTest extends FunctionalTestCase
/**
* @dataProvider collectionWriteMethodClosures
* @expectedException MongoDB\Exception\UnsupportedException
* @expectedExceptionMessage "writeConcern" option cannot be specified within a transaction
*/
public
function
testMethodInTransactionWithWriteConcernOption
(
$method
)
{
...
...
@@ -631,6 +630,9 @@ class CollectionFunctionalTest extends FunctionalTestCase
$session
=
$this
->
manager
->
startSession
();
$session
->
startTransaction
();
$this
->
expectException
(
UnsupportedException
::
class
);
$this
->
expectExceptionMessage
(
'"writeConcern" option cannot be specified within a transaction'
);
try
{
call_user_func
(
$method
,
$this
->
collection
,
$session
,
[
'writeConcern'
=>
new
WriteConcern
(
1
)]);
}
finally
{
...
...
@@ -640,8 +642,6 @@ class CollectionFunctionalTest extends FunctionalTestCase
/**
* @dataProvider collectionReadMethodClosures
* @expectedException MongoDB\Exception\UnsupportedException
* @expectedExceptionMessage "readConcern" option cannot be specified within a transaction
*/
public
function
testMethodInTransactionWithReadConcernOption
(
$method
)
{
...
...
@@ -652,6 +652,9 @@ class CollectionFunctionalTest extends FunctionalTestCase
$session
=
$this
->
manager
->
startSession
();
$session
->
startTransaction
();
$this
->
expectException
(
UnsupportedException
::
class
);
$this
->
expectExceptionMessage
(
'"readConcern" option cannot be specified within a transaction'
);
try
{
call_user_func
(
$method
,
$this
->
collection
,
$session
,
[
'readConcern'
=>
new
ReadConcern
(
ReadConcern
::
LOCAL
)]);
}
finally
{
...
...
tests/FunctionalTestCase.php
View file @
a72cbe38
...
...
@@ -94,10 +94,10 @@ abstract class FunctionalTestCase extends TestCase
$parts
[]
=
$urlParts
[
'path'
];
}
if
(
isset
(
$urlParts
[
'query'
]))
{
$parts
+=
[
$parts
=
array_merge
(
$parts
,
[
'?'
,
$urlParts
[
'
path
'
]
];
$urlParts
[
'
query
'
]
]
)
;
}
return
implode
(
''
,
$parts
);
...
...
tests/Operation/AggregateFunctionalTest.php
View file @
a72cbe38
...
...
@@ -217,7 +217,17 @@ class AggregateFunctionalTest extends FunctionalTestCase
$results
=
iterator_to_array
(
$operation
->
execute
(
$this
->
getPrimaryServer
()));
$this
->
assertCount
(
1
,
$results
);
$this
->
assertObjectHasAttribute
(
'stages'
,
current
(
$results
));
$result
=
current
(
$results
);
if
(
$this
->
isShardedCluster
())
{
$this
->
assertObjectHasAttribute
(
'shards'
,
$result
);
foreach
(
$result
->
shards
as
$shard
)
{
$this
->
assertObjectHasAttribute
(
'stages'
,
$shard
);
}
}
else
{
$this
->
assertObjectHasAttribute
(
'stages'
,
$result
);
}
},
function
(
array
$event
)
{
$this
->
assertObjectNotHasAttribute
(
'writeConcern'
,
$event
[
'started'
]
->
getCommand
());
...
...
tests/Operation/WatchFunctionalTest.php
View file @
a72cbe38
...
...
@@ -28,6 +28,7 @@ class WatchFunctionalTest extends FunctionalTestCase
{
use
SetUpTearDownTrait
;
const
INTERRUPTED
=
11601
;
const
NOT_MASTER
=
10107
;
private
static
$wireVersionForStartAtOperationTime
=
7
;
...
...
@@ -1295,7 +1296,7 @@ class WatchFunctionalTest extends FunctionalTestCase
$this
->
configureFailPoint
([
'configureFailPoint'
=>
'failCommand'
,
'mode'
=>
[
'times'
=>
1
],
'data'
=>
[
'failCommands'
=>
[
'aggregate'
],
'errorCode'
=>
self
::
NOT_MASTER
],
'data'
=>
[
'failCommands'
=>
[
'aggregate'
],
'errorCode'
=>
self
::
INTERRUPTED
],
]);
$this
->
expectException
(
CommandException
::
class
);
...
...
tests/SpecTests/ChangeStreamsSpecTest.php
View file @
a72cbe38
...
...
@@ -18,6 +18,10 @@ use stdClass;
*/
class
ChangeStreamsSpecTest
extends
FunctionalTestCase
{
private
static
$incompleteTests
=
[
'change-streams-errors: Change Stream should error when _id is projected out'
=>
'PHPC-1419'
,
];
/**
* Assert that the expected and actual command documents match.
*
...
...
@@ -66,6 +70,10 @@ class ChangeStreamsSpecTest extends FunctionalTestCase
*/
public
function
testChangeStreams
(
stdClass
$test
,
$databaseName
=
null
,
$collectionName
=
null
,
$database2Name
=
null
,
$collection2Name
=
null
)
{
if
(
isset
(
self
::
$incompleteTests
[
$this
->
dataDescription
()]))
{
$this
->
markTestIncomplete
(
self
::
$incompleteTests
[
$this
->
dataDescription
()]);
}
$this
->
checkServerRequirements
(
$this
->
createRunOn
(
$test
));
if
(
!
isset
(
$databaseName
,
$collectionName
,
$database2Name
,
$collection2Name
))
{
...
...
tests/SpecTests/ErrorExpectation.php
View file @
a72cbe38
...
...
@@ -132,7 +132,7 @@ final class ErrorExpectation
$test
->
assertNotNull
(
$actual
);
if
(
isset
(
$this
->
messageContains
))
{
$test
->
assert
Contains
(
$this
->
messageContains
,
$actual
->
getMessage
(),
''
,
true
/* case-insensitive */
);
$test
->
assert
StringContainsStringIgnoringCase
(
$this
->
messageContains
,
$actual
->
getMessage
()
);
}
if
(
isset
(
$this
->
codeName
))
{
...
...
@@ -178,7 +178,7 @@ final class ErrorExpectation
$test
->
assertInstanceOf
(
CommandException
::
class
,
$actual
);
$result
=
$actual
->
getResultDocument
();
$test
->
assertObjectHasAttribute
(
'codeName'
,
$result
);
$test
->
assert
AttributeSame
(
$this
->
codeName
,
'codeName'
,
$result
);
$test
->
assert
Same
(
$this
->
codeName
,
$result
->
codeName
);
}
private
static
function
isArrayOfStrings
(
$array
)
...
...
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