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
5f09883d
Commit
5f09883d
authored
Jun 08, 2016
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify arguments for assertCollectionDoesNotExist()
parent
a2715b13
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
+7
-12
DropCollectionFunctionalTest.php
tests/Operation/DropCollectionFunctionalTest.php
+7
-12
No files found.
tests/Operation/DropCollectionFunctionalTest.php
View file @
5f09883d
...
...
@@ -2,7 +2,6 @@
namespace
MongoDB\Tests\Operation
;
use
MongoDB\Driver\Server
;
use
MongoDB\Operation\DropCollection
;
use
MongoDB\Operation\InsertOne
;
use
MongoDB\Operation\ListCollections
;
...
...
@@ -20,7 +19,7 @@ class DropCollectionFunctionalTest extends FunctionalTestCase
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$operation
->
execute
(
$server
);
$this
->
assertCollectionDoesNotExist
(
$
server
,
$this
->
getDatabaseName
(),
$
this
->
getCollectionName
());
$this
->
assertCollectionDoesNotExist
(
$this
->
getCollectionName
());
}
/**
...
...
@@ -28,26 +27,22 @@ class DropCollectionFunctionalTest extends FunctionalTestCase
*/
public
function
testDropNonexistentCollection
()
{
$server
=
$this
->
getPrimaryServer
();
$this
->
assertCollectionDoesNotExist
(
$server
,
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$this
->
assertCollectionDoesNotExist
(
$this
->
getCollectionName
());
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$operation
->
execute
(
$
server
);
$operation
->
execute
(
$
this
->
getPrimaryServer
()
);
}
/**
* Asserts that a collection with the given name does not exist on the
* server.
*
* @param Server $server
* @param string $databaseName
* @param string $collectionName
*/
private
function
assertCollectionDoesNotExist
(
Server
$server
,
$databaseName
,
$collectionName
)
private
function
assertCollectionDoesNotExist
(
$collectionName
)
{
$operation
=
new
ListCollections
(
$
databaseName
);
$collections
=
$operation
->
execute
(
$
server
);
$operation
=
new
ListCollections
(
$
this
->
getDatabaseName
()
);
$collections
=
$operation
->
execute
(
$
this
->
getPrimaryServer
()
);
$foundCollection
=
null
;
...
...
@@ -58,6 +53,6 @@ class DropCollectionFunctionalTest extends FunctionalTestCase
}
}
$this
->
assertNull
(
$foundCollection
,
sprintf
(
'Collection %s exists
on the server
'
,
$collectionName
));
$this
->
assertNull
(
$foundCollection
,
sprintf
(
'Collection %s exists'
,
$collectionName
));
}
}
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