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
bd148eab
Commit
bd148eab
authored
Jul 18, 2018
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #567
parents
798d510a
330161a2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
14 deletions
+38
-14
FunctionalTestCase.php
tests/Collection/FunctionalTestCase.php
+13
-5
DocumentationExamplesTest.php
tests/DocumentationExamplesTest.php
+13
-5
FunctionalTestCase.php
tests/Operation/FunctionalTestCase.php
+12
-4
No files found.
tests/Collection/FunctionalTestCase.php
View file @
bd148eab
...
...
@@ -3,7 +3,7 @@
namespace
MongoDB\Tests\Collection
;
use
MongoDB\Collection
;
use
MongoDB\
Operation\DropCollectio
n
;
use
MongoDB\
Driver\WriteConcer
n
;
use
MongoDB\Tests\FunctionalTestCase
as
BaseFunctionalTestCase
;
/**
...
...
@@ -18,8 +18,8 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase
parent
::
setUp
();
$this
->
collection
=
new
Collection
(
$this
->
manager
,
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$
operation
->
execute
(
$this
->
getPrimaryServer
()
);
$
this
->
dropCollection
(
);
}
public
function
tearDown
()
...
...
@@ -28,7 +28,15 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase
return
;
}
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
dropCollection
();
}
private
function
dropCollection
()
{
$options
=
version_compare
(
$this
->
getServerVersion
(),
'3.4.0'
,
'>='
)
?
[
'writeConcern'
=>
new
WriteConcern
(
WriteConcern
::
MAJORITY
)]
:
[];
$this
->
collection
->
drop
(
$options
);
}
}
tests/DocumentationExamplesTest.php
View file @
bd148eab
...
...
@@ -6,8 +6,8 @@ use MongoDB\Client;
use
MongoDB\Database
;
use
MongoDB\Driver\Cursor
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Operation\DropCollection
;
use
MongoDB\Operation\DropDatabase
;
/**
* Documentation examples to be parsed for inclusion in the MongoDB manual.
...
...
@@ -20,8 +20,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
{
parent
::
setUp
();
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
dropCollection
();
}
public
function
tearDown
()
...
...
@@ -30,8 +29,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
return
;
}
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
dropCollection
();
}
public
function
testExample_1_2
()
...
...
@@ -1429,4 +1427,14 @@ class DocumentationExamplesTest extends FunctionalTestCase
{
$this
->
assertCollectionCount
(
$this
->
getDatabaseName
()
.
'.'
.
$this
->
getCollectionName
(),
$count
);
}
private
function
dropCollection
()
{
$options
=
version_compare
(
$this
->
getServerVersion
(),
'3.4.0'
,
'>='
)
?
[
'writeConcern'
=>
new
WriteConcern
(
WriteConcern
::
MAJORITY
)]
:
[];
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$options
);
$operation
->
execute
(
$this
->
getPrimaryServer
());
}
}
tests/Operation/FunctionalTestCase.php
View file @
bd148eab
...
...
@@ -18,8 +18,7 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase
{
parent
::
setUp
();
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
dropCollection
();
}
public
function
tearDown
()
...
...
@@ -28,8 +27,7 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase
return
;
}
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$operation
->
execute
(
$this
->
getPrimaryServer
());
$this
->
dropCollection
();
}
protected
function
createDefaultReadConcern
()
...
...
@@ -46,4 +44,14 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase
{
return
$this
->
manager
->
startSession
();
}
private
function
dropCollection
()
{
$options
=
version_compare
(
$this
->
getServerVersion
(),
'3.4.0'
,
'>='
)
?
[
'writeConcern'
=>
new
WriteConcern
(
WriteConcern
::
MAJORITY
)]
:
[];
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
$options
);
$operation
->
execute
(
$this
->
getPrimaryServer
());
}
}
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