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
e8eb6283
Commit
e8eb6283
authored
Nov 01, 2015
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MongoDB\Manager no longer has single write methods
See: PHPC-465, HHVM-129
parent
a033aca8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
10 deletions
+35
-10
ClientFunctionalTest.php
tests/ClientFunctionalTest.php
+9
-2
CollectionManagementFunctionalTest.php
tests/Database/CollectionManagementFunctionalTest.php
+5
-1
DatabaseFunctionalTest.php
tests/Database/DatabaseFunctionalTest.php
+5
-1
DropCollectionFunctionalTest.php
tests/Operation/DropCollectionFunctionalTest.php
+5
-2
DropDatabaseFunctionalTest.php
tests/Operation/DropDatabaseFunctionalTest.php
+5
-2
ListCollectionsFunctionalTest.php
tests/Operation/ListCollectionsFunctionalTest.php
+3
-1
ListIndexesFunctionalTest.php
tests/Operation/ListIndexesFunctionalTest.php
+3
-1
No files found.
tests/ClientFunctionalTest.php
View file @
e8eb6283
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
MongoDB\Tests
;
namespace
MongoDB\Tests
;
use
MongoDB\Client
;
use
MongoDB\Client
;
use
MongoDB\Driver\BulkWrite
;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Command
;
use
MongoDB\Model\DatabaseInfo
;
use
MongoDB\Model\DatabaseInfo
;
...
@@ -23,7 +24,10 @@ class ClientFunctionalTest extends FunctionalTestCase
...
@@ -23,7 +24,10 @@ class ClientFunctionalTest extends FunctionalTestCase
public
function
testDropDatabase
()
public
function
testDropDatabase
()
{
{
$writeResult
=
$this
->
manager
->
executeInsert
(
$this
->
getNamespace
(),
array
(
'x'
=>
1
));
$bulkWrite
=
new
BulkWrite
();
$bulkWrite
->
insert
([
'x'
=>
1
]);
$writeResult
=
$this
->
manager
->
executeBulkWrite
(
$this
->
getNamespace
(),
$bulkWrite
);
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$commandResult
=
$this
->
client
->
dropDatabase
(
$this
->
getDatabaseName
());
$commandResult
=
$this
->
client
->
dropDatabase
(
$this
->
getDatabaseName
());
...
@@ -33,7 +37,10 @@ class ClientFunctionalTest extends FunctionalTestCase
...
@@ -33,7 +37,10 @@ class ClientFunctionalTest extends FunctionalTestCase
public
function
testListDatabases
()
public
function
testListDatabases
()
{
{
$writeResult
=
$this
->
manager
->
executeInsert
(
$this
->
getNamespace
(),
array
(
'x'
=>
1
));
$bulkWrite
=
new
BulkWrite
();
$bulkWrite
->
insert
([
'x'
=>
1
]);
$writeResult
=
$this
->
manager
->
executeBulkWrite
(
$this
->
getNamespace
(),
$bulkWrite
);
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$databases
=
$this
->
client
->
listDatabases
();
$databases
=
$this
->
client
->
listDatabases
();
...
...
tests/Database/CollectionManagementFunctionalTest.php
View file @
e8eb6283
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
MongoDB\Tests\Database
;
namespace
MongoDB\Tests\Database
;
use
MongoDB\Driver\BulkWrite
;
use
MongoDB\Model\CollectionInfo
;
use
MongoDB\Model\CollectionInfo
;
use
InvalidArgumentException
;
use
InvalidArgumentException
;
...
@@ -39,7 +40,10 @@ class CollectionManagementFunctionalTest extends FunctionalTestCase
...
@@ -39,7 +40,10 @@ class CollectionManagementFunctionalTest extends FunctionalTestCase
public
function
testDropCollection
()
public
function
testDropCollection
()
{
{
$writeResult
=
$this
->
manager
->
executeInsert
(
$this
->
getNamespace
(),
array
(
'x'
=>
1
));
$bulkWrite
=
new
BulkWrite
();
$bulkWrite
->
insert
([
'x'
=>
1
]);
$writeResult
=
$this
->
manager
->
executeBulkWrite
(
$this
->
getNamespace
(),
$bulkWrite
);
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$commandResult
=
$this
->
database
->
dropCollection
(
$this
->
getCollectionName
());
$commandResult
=
$this
->
database
->
dropCollection
(
$this
->
getCollectionName
());
...
...
tests/Database/DatabaseFunctionalTest.php
View file @
e8eb6283
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
MongoDB\Tests\Database
;
namespace
MongoDB\Tests\Database
;
use
MongoDB\Database
;
use
MongoDB\Database
;
use
MongoDB\Driver\BulkWrite
;
/**
/**
* Functional tests for the Database class.
* Functional tests for the Database class.
...
@@ -39,7 +40,10 @@ class DatabaseFunctionalTest extends FunctionalTestCase
...
@@ -39,7 +40,10 @@ class DatabaseFunctionalTest extends FunctionalTestCase
public
function
testDrop
()
public
function
testDrop
()
{
{
$writeResult
=
$this
->
manager
->
executeInsert
(
$this
->
getNamespace
(),
array
(
'x'
=>
1
));
$bulkWrite
=
new
BulkWrite
();
$bulkWrite
->
insert
([
'x'
=>
1
]);
$writeResult
=
$this
->
manager
->
executeBulkWrite
(
$this
->
getNamespace
(),
$bulkWrite
);
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$commandResult
=
$this
->
database
->
drop
();
$commandResult
=
$this
->
database
->
drop
();
...
...
tests/Operation/DropCollectionFunctionalTest.php
View file @
e8eb6283
...
@@ -4,16 +4,19 @@ namespace MongoDB\Tests\Operation;
...
@@ -4,16 +4,19 @@ namespace MongoDB\Tests\Operation;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Operation\DropCollection
;
use
MongoDB\Operation\DropCollection
;
use
MongoDB\Operation\InsertOne
;
use
MongoDB\Operation\ListCollections
;
use
MongoDB\Operation\ListCollections
;
class
DropCollectionFunctionalTest
extends
FunctionalTestCase
class
DropCollectionFunctionalTest
extends
FunctionalTestCase
{
{
public
function
testDropExistingCollection
()
public
function
testDropExistingCollection
()
{
{
$writeResult
=
$this
->
manager
->
executeInsert
(
$this
->
getNamespace
(),
array
(
'x'
=>
1
));
$server
=
$this
->
getPrimaryServer
();
$insertOne
=
new
InsertOne
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
[
'x'
=>
1
]);
$writeResult
=
$insertOne
->
execute
(
$server
);
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$server
=
$this
->
getPrimaryServer
();
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$operation
->
execute
(
$server
);
$operation
->
execute
(
$server
);
...
...
tests/Operation/DropDatabaseFunctionalTest.php
View file @
e8eb6283
...
@@ -4,16 +4,19 @@ namespace MongoDB\Tests\Operation;
...
@@ -4,16 +4,19 @@ namespace MongoDB\Tests\Operation;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Operation\DropDatabase
;
use
MongoDB\Operation\DropDatabase
;
use
MongoDB\Operation\InsertOne
;
use
MongoDB\Operation\ListDatabases
;
use
MongoDB\Operation\ListDatabases
;
class
DropDatabaseFunctionalTest
extends
FunctionalTestCase
class
DropDatabaseFunctionalTest
extends
FunctionalTestCase
{
{
public
function
testDropExistingDatabase
()
public
function
testDropExistingDatabase
()
{
{
$writeResult
=
$this
->
manager
->
executeInsert
(
$this
->
getNamespace
(),
array
(
'x'
=>
1
));
$server
=
$this
->
getPrimaryServer
();
$insertOne
=
new
InsertOne
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
[
'x'
=>
1
]);
$writeResult
=
$insertOne
->
execute
(
$server
);
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$server
=
$this
->
getPrimaryServer
();
$operation
=
new
DropDatabase
(
$this
->
getDatabaseName
());
$operation
=
new
DropDatabase
(
$this
->
getDatabaseName
());
$operation
->
execute
(
$server
);
$operation
->
execute
(
$server
);
...
...
tests/Operation/ListCollectionsFunctionalTest.php
View file @
e8eb6283
...
@@ -4,6 +4,7 @@ namespace MongoDB\Tests\Operation;
...
@@ -4,6 +4,7 @@ namespace MongoDB\Tests\Operation;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Operation\DropDatabase
;
use
MongoDB\Operation\DropDatabase
;
use
MongoDB\Operation\InsertOne
;
use
MongoDB\Operation\ListCollections
;
use
MongoDB\Operation\ListCollections
;
class
ListCollectionsFunctionalTest
extends
FunctionalTestCase
class
ListCollectionsFunctionalTest
extends
FunctionalTestCase
...
@@ -15,7 +16,8 @@ class ListCollectionsFunctionalTest extends FunctionalTestCase
...
@@ -15,7 +16,8 @@ class ListCollectionsFunctionalTest extends FunctionalTestCase
$operation
=
new
DropDatabase
(
$this
->
getDatabaseName
());
$operation
=
new
DropDatabase
(
$this
->
getDatabaseName
());
$operation
->
execute
(
$server
);
$operation
->
execute
(
$server
);
$writeResult
=
$this
->
manager
->
executeInsert
(
$this
->
getNamespace
(),
[
'x'
=>
1
]);
$insertOne
=
new
InsertOne
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
[
'x'
=>
1
]);
$writeResult
=
$insertOne
->
execute
(
$server
);
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$operation
=
new
ListCollections
(
$this
->
getDatabaseName
(),
[
'filter'
=>
[
'name'
=>
$this
->
getCollectionName
()]]);
$operation
=
new
ListCollections
(
$this
->
getDatabaseName
(),
[
'filter'
=>
[
'name'
=>
$this
->
getCollectionName
()]]);
...
...
tests/Operation/ListIndexesFunctionalTest.php
View file @
e8eb6283
...
@@ -4,6 +4,7 @@ namespace MongoDB\Tests\Operation;
...
@@ -4,6 +4,7 @@ namespace MongoDB\Tests\Operation;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Operation\DropCollection
;
use
MongoDB\Operation\DropCollection
;
use
MongoDB\Operation\InsertOne
;
use
MongoDB\Operation\ListIndexes
;
use
MongoDB\Operation\ListIndexes
;
class
ListIndexesFunctionalTest
extends
FunctionalTestCase
class
ListIndexesFunctionalTest
extends
FunctionalTestCase
...
@@ -15,7 +16,8 @@ class ListIndexesFunctionalTest extends FunctionalTestCase
...
@@ -15,7 +16,8 @@ class ListIndexesFunctionalTest extends FunctionalTestCase
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$operation
->
execute
(
$server
);
$operation
->
execute
(
$server
);
$writeResult
=
$this
->
manager
->
executeInsert
(
$this
->
getNamespace
(),
[
'x'
=>
1
]);
$insertOne
=
new
InsertOne
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
(),
[
'x'
=>
1
]);
$writeResult
=
$insertOne
->
execute
(
$server
);
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$this
->
assertEquals
(
1
,
$writeResult
->
getInsertedCount
());
$operation
=
new
ListIndexes
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
$operation
=
new
ListIndexes
(
$this
->
getDatabaseName
(),
$this
->
getCollectionName
());
...
...
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