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
738022df
Unverified
Commit
738022df
authored
Oct 02, 2019
by
Andreas Braun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-481: Remove duplicated bulk write tests
parent
d4b5e8d9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
62 deletions
+0
-62
BulkWriteFunctionalTest.php
tests/Operation/BulkWriteFunctionalTest.php
+0
-62
No files found.
tests/Operation/BulkWriteFunctionalTest.php
View file @
738022df
...
...
@@ -8,7 +8,6 @@ use MongoDB\Collection;
use
MongoDB\Driver\BulkWrite
as
Bulk
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Exception\BadMethodCallException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Model\BSONDocument
;
use
MongoDB\Operation\BulkWrite
;
use
MongoDB\Tests\CommandObserver
;
...
...
@@ -226,67 +225,6 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
$result
->
getUpsertedIds
();
}
public
function
testUnknownOperation
()
{
$this
->
expectException
(
InvalidArgumentException
::
class
);
$this
->
expectExceptionMessage
(
'Unknown operation type "foo" in $operations[0]'
);
new
BulkWrite
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
[
[
'foo'
=>
[[
'_id'
=>
1
]]],
]);
}
/**
* @dataProvider provideOpsWithMissingArguments
*/
public
function
testMissingArguments
(
array
$ops
)
{
$this
->
expectException
(
InvalidArgumentException
::
class
);
$this
->
expectExceptionMessageRegExp
(
'/Missing (first|second) argument for \$operations\[\d+\]\["\w+\"]/'
);
new
BulkWrite
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$ops
);
}
public
function
provideOpsWithMissingArguments
()
{
return
[
[[[
'insertOne'
=>
[]]]],
[[[
'updateOne'
=>
[]]]],
[[[
'updateOne'
=>
[[
'_id'
=>
1
]]]]],
[[[
'updateMany'
=>
[]]]],
[[[
'updateMany'
=>
[[
'_id'
=>
1
]]]]],
[[[
'replaceOne'
=>
[]]]],
[[[
'replaceOne'
=>
[[
'_id'
=>
1
]]]]],
[[[
'deleteOne'
=>
[]]]],
[[[
'deleteMany'
=>
[]]]],
];
}
public
function
testUpdateOneRequiresUpdateOperators
()
{
$this
->
expectException
(
InvalidArgumentException
::
class
);
$this
->
expectExceptionMessage
(
'First key in $operations[0]["updateOne"][1] is neither an update operator nor a pipeline'
);
new
BulkWrite
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
[
[
'updateOne'
=>
[[
'_id'
=>
1
],
[
'x'
=>
1
]]],
]);
}
public
function
testUpdateManyRequiresUpdateOperators
()
{
$this
->
expectException
(
InvalidArgumentException
::
class
);
$this
->
expectExceptionMessage
(
'First key in $operations[0]["updateMany"][1] is neither an update operator nor a pipeline'
);
new
BulkWrite
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
[
[
'updateMany'
=>
[[
'_id'
=>
[
'$gt'
=>
1
]],
[
'x'
=>
1
]]],
]);
}
public
function
testReplaceOneRequiresReplacementDocument
()
{
$this
->
expectException
(
InvalidArgumentException
::
class
);
$this
->
expectExceptionMessage
(
'First key in $operations[0]["replaceOne"][1] is an update operator'
);
new
BulkWrite
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
[
[
'replaceOne'
=>
[[
'_id'
=>
1
],
[
'$inc'
=>
[
'x'
=>
1
]]]],
]);
}
public
function
testSessionOption
()
{
if
(
version_compare
(
$this
->
getServerVersion
(),
'3.6.0'
,
'<'
))
{
...
...
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