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
96311aa4
Unverified
Commit
96311aa4
authored
Aug 23, 2019
by
Andreas Braun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-466: Fix usage of useMultipleMongoses in spec tests
parent
1245eb94
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
13 deletions
+8
-13
Context.php
tests/SpecTests/Context.php
+4
-4
RetryableWritesSpecTest.php
tests/SpecTests/RetryableWritesSpecTest.php
+2
-5
TransactionsSpecTest.php
tests/SpecTests/TransactionsSpecTest.php
+2
-4
No files found.
tests/SpecTests/Context.php
View file @
96311aa4
...
@@ -121,7 +121,7 @@ final class Context
...
@@ -121,7 +121,7 @@ final class Context
return
$o
;
return
$o
;
}
}
public
static
function
fromRetryableWrites
(
stdClass
$test
,
$databaseName
,
$collectionName
)
public
static
function
fromRetryableWrites
(
stdClass
$test
,
$databaseName
,
$collectionName
,
$useMultipleMongoses
)
{
{
$o
=
new
self
(
$databaseName
,
$collectionName
);
$o
=
new
self
(
$databaseName
,
$collectionName
);
...
@@ -134,12 +134,12 @@ final class Context
...
@@ -134,12 +134,12 @@ final class Context
$o
->
outcomeCollectionName
=
$test
->
outcome
->
collection
->
name
;
$o
->
outcomeCollectionName
=
$test
->
outcome
->
collection
->
name
;
}
}
$o
->
client
=
new
Client
(
FunctionalTestCase
::
getUri
(),
$clientOptions
);
$o
->
client
=
new
Client
(
FunctionalTestCase
::
getUri
(
$useMultipleMongoses
),
$clientOptions
);
return
$o
;
return
$o
;
}
}
public
static
function
fromTransactions
(
stdClass
$test
,
$databaseName
,
$collectionName
)
public
static
function
fromTransactions
(
stdClass
$test
,
$databaseName
,
$collectionName
,
$useMultipleMongoses
)
{
{
$o
=
new
self
(
$databaseName
,
$collectionName
);
$o
=
new
self
(
$databaseName
,
$collectionName
);
...
@@ -159,7 +159,7 @@ final class Context
...
@@ -159,7 +159,7 @@ final class Context
* re-using a previously persisted libmongoc client object. */
* re-using a previously persisted libmongoc client object. */
$clientOptions
+=
[
'p'
=>
mt_rand
()];
$clientOptions
+=
[
'p'
=>
mt_rand
()];
$o
->
client
=
new
Client
(
FunctionalTestCase
::
getUri
(),
$clientOptions
);
$o
->
client
=
new
Client
(
FunctionalTestCase
::
getUri
(
$useMultipleMongoses
),
$clientOptions
);
$session0Options
=
isset
(
$test
->
sessionOptions
->
session0
)
?
(
array
)
$test
->
sessionOptions
->
session0
:
[];
$session0Options
=
isset
(
$test
->
sessionOptions
->
session0
)
?
(
array
)
$test
->
sessionOptions
->
session0
:
[];
$session1Options
=
isset
(
$test
->
sessionOptions
->
session1
)
?
(
array
)
$test
->
sessionOptions
->
session1
:
[];
$session1Options
=
isset
(
$test
->
sessionOptions
->
session1
)
?
(
array
)
$test
->
sessionOptions
->
session1
:
[];
...
...
tests/SpecTests/RetryableWritesSpecTest.php
View file @
96311aa4
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
namespace
MongoDB\Tests\SpecTests
;
namespace
MongoDB\Tests\SpecTests
;
use
MongoDB\Driver\Manager
;
use
stdClass
;
use
stdClass
;
use
function
basename
;
use
function
basename
;
use
function
file_get_contents
;
use
function
file_get_contents
;
...
@@ -29,15 +28,13 @@ class RetryableWritesSpecTest extends FunctionalTestCase
...
@@ -29,15 +28,13 @@ class RetryableWritesSpecTest extends FunctionalTestCase
$this
->
markTestSkipped
(
'Transaction numbers are only allowed on a replica set member or mongos (PHPC-1415)'
);
$this
->
markTestSkipped
(
'Transaction numbers are only allowed on a replica set member or mongos (PHPC-1415)'
);
}
}
if
(
isset
(
$test
->
useMultipleMongoses
)
&&
$test
->
useMultipleMongoses
&&
$this
->
isShardedCluster
())
{
$useMultipleMongoses
=
isset
(
$test
->
useMultipleMongoses
)
&&
$test
->
useMultipleMongoses
&&
$this
->
isShardedCluster
();
$this
->
manager
=
new
Manager
(
static
::
getUri
(
true
));
}
if
(
isset
(
$runOn
))
{
if
(
isset
(
$runOn
))
{
$this
->
checkServerRequirements
(
$runOn
);
$this
->
checkServerRequirements
(
$runOn
);
}
}
$context
=
Context
::
fromRetryableWrites
(
$test
,
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$context
=
Context
::
fromRetryableWrites
(
$test
,
$this
->
getDatabaseName
(),
$this
->
getCollectionName
()
,
$useMultipleMongoses
);
$this
->
setContext
(
$context
);
$this
->
setContext
(
$context
);
$this
->
dropTestAndOutcomeCollections
();
$this
->
dropTestAndOutcomeCollections
();
...
...
tests/SpecTests/TransactionsSpecTest.php
View file @
96311aa4
...
@@ -135,9 +135,7 @@ class TransactionsSpecTest extends FunctionalTestCase
...
@@ -135,9 +135,7 @@ class TransactionsSpecTest extends FunctionalTestCase
$this
->
markTestSkipped
(
$test
->
skipReason
);
$this
->
markTestSkipped
(
$test
->
skipReason
);
}
}
if
(
isset
(
$test
->
useMultipleMongoses
)
&&
$test
->
useMultipleMongoses
&&
$this
->
isShardedCluster
())
{
$useMultipleMongoses
=
isset
(
$test
->
useMultipleMongoses
)
&&
$test
->
useMultipleMongoses
&&
$this
->
isShardedCluster
();
$this
->
manager
=
new
Manager
(
static
::
getUri
(
true
));
}
if
(
isset
(
$runOn
))
{
if
(
isset
(
$runOn
))
{
$this
->
checkServerRequirements
(
$runOn
);
$this
->
checkServerRequirements
(
$runOn
);
...
@@ -150,7 +148,7 @@ class TransactionsSpecTest extends FunctionalTestCase
...
@@ -150,7 +148,7 @@ class TransactionsSpecTest extends FunctionalTestCase
$databaseName
=
isset
(
$databaseName
)
?
$databaseName
:
$this
->
getDatabaseName
();
$databaseName
=
isset
(
$databaseName
)
?
$databaseName
:
$this
->
getDatabaseName
();
$collectionName
=
isset
(
$collectionName
)
?
$collectionName
:
$this
->
getCollectionName
();
$collectionName
=
isset
(
$collectionName
)
?
$collectionName
:
$this
->
getCollectionName
();
$context
=
Context
::
fromTransactions
(
$test
,
$databaseName
,
$collectionName
);
$context
=
Context
::
fromTransactions
(
$test
,
$databaseName
,
$collectionName
,
$useMultipleMongoses
);
$this
->
setContext
(
$context
);
$this
->
setContext
(
$context
);
$this
->
dropTestAndOutcomeCollections
();
$this
->
dropTestAndOutcomeCollections
();
...
...
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