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
303de406
Commit
303de406
authored
Nov 02, 2015
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #42
parents
6693f5f1
66189d6c
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
53 additions
and
95 deletions
+53
-95
.travis.yml
.travis.yml
+3
-3
Client.php
src/Client.php
+4
-4
Collection.php
src/Collection.php
+2
-2
Database.php
src/Database.php
+2
-2
BulkWrite.php
src/Operation/BulkWrite.php
+1
-1
CreateIndexes.php
src/Operation/CreateIndexes.php
+1
-1
InsertMany.php
src/Operation/InsertMany.php
+1
-1
functions.php
src/functions.php
+0
-67
ClientFunctionalTest.php
tests/ClientFunctionalTest.php
+9
-2
BulkWriteFunctionalTest.php
tests/Collection/BulkWriteFunctionalTest.php
+1
-1
CollectionFunctionalTest.php
tests/Collection/CollectionFunctionalTest.php
+1
-1
FunctionalTestCase.php
tests/Collection/CrudSpec/FunctionalTestCase.php
+1
-1
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
FindOneFunctionalTest.php
tests/Operation/FindOneFunctionalTest.php
+1
-1
ListCollectionsFunctionalTest.php
tests/Operation/ListCollectionsFunctionalTest.php
+3
-1
ListIndexesFunctionalTest.php
tests/Operation/ListIndexesFunctionalTest.php
+3
-1
No files found.
.travis.yml
View file @
303de406
...
@@ -12,9 +12,9 @@ env:
...
@@ -12,9 +12,9 @@ env:
-
MONGO_REPO_TYPE="precise/mongodb-enterprise/"
-
MONGO_REPO_TYPE="precise/mongodb-enterprise/"
-
SOURCES_LOC="/etc/apt/sources.list.d/mongodb.list"
-
SOURCES_LOC="/etc/apt/sources.list.d/mongodb.list"
matrix
:
matrix
:
-
DRIVER_VERSION=
beta
SERVER_VERSION=2.4
-
DRIVER_VERSION=
1.0
SERVER_VERSION=2.4
-
DRIVER_VERSION=
beta
SERVER_VERSION=2.6
-
DRIVER_VERSION=
1.0
SERVER_VERSION=2.6
-
DRIVER_VERSION=
beta
SERVER_VERSION=3.0
-
DRIVER_VERSION=
1.0
SERVER_VERSION=3.0
before_install
:
before_install
:
-
sudo apt-key adv --keyserver ${KEY_SERVER} --recv 7F0CEB10
-
sudo apt-key adv --keyserver ${KEY_SERVER} --recv 7F0CEB10
...
...
src/Client.php
View file @
303de406
...
@@ -75,8 +75,8 @@ class Client
...
@@ -75,8 +75,8 @@ class Client
public
function
selectCollection
(
$databaseName
,
$collectionName
,
WriteConcern
$writeConcern
=
null
,
ReadPreference
$readPreference
=
null
)
public
function
selectCollection
(
$databaseName
,
$collectionName
,
WriteConcern
$writeConcern
=
null
,
ReadPreference
$readPreference
=
null
)
{
{
$namespace
=
$databaseName
.
'.'
.
$collectionName
;
$namespace
=
$databaseName
.
'.'
.
$collectionName
;
$writeConcern
=
$writeConcern
?:
\MongoDB\get_manager_write_concern
(
$this
->
manager
);
$writeConcern
=
$writeConcern
?:
$this
->
manager
->
getWriteConcern
(
);
$readPreference
=
$readPreference
?:
\MongoDB\get_manager_read_preference
(
$this
->
manager
);
$readPreference
=
$readPreference
?:
$this
->
manager
->
getReadPreference
(
);
return
new
Collection
(
$this
->
manager
,
$namespace
,
$writeConcern
,
$readPreference
);
return
new
Collection
(
$this
->
manager
,
$namespace
,
$writeConcern
,
$readPreference
);
}
}
...
@@ -94,8 +94,8 @@ class Client
...
@@ -94,8 +94,8 @@ class Client
*/
*/
public
function
selectDatabase
(
$databaseName
,
WriteConcern
$writeConcern
=
null
,
ReadPreference
$readPreference
=
null
)
public
function
selectDatabase
(
$databaseName
,
WriteConcern
$writeConcern
=
null
,
ReadPreference
$readPreference
=
null
)
{
{
$writeConcern
=
$writeConcern
?:
\MongoDB\get_manager_write_concern
(
$this
->
manager
);
$writeConcern
=
$writeConcern
?:
$this
->
manager
->
getWriteConcern
(
);
$readPreference
=
$readPreference
?:
\MongoDB\get_manager_read_preference
(
$this
->
manager
);
$readPreference
=
$readPreference
?:
$this
->
manager
->
getReadPreference
(
);
return
new
Database
(
$this
->
manager
,
$databaseName
,
$writeConcern
,
$readPreference
);
return
new
Database
(
$this
->
manager
,
$databaseName
,
$writeConcern
,
$readPreference
);
}
}
...
...
src/Collection.php
View file @
303de406
...
@@ -66,8 +66,8 @@ class Collection
...
@@ -66,8 +66,8 @@ class Collection
$this
->
collectionName
=
$parts
[
1
];
$this
->
collectionName
=
$parts
[
1
];
$this
->
manager
=
$manager
;
$this
->
manager
=
$manager
;
$this
->
writeConcern
=
$writeConcern
?:
\MongoDB\get_manager_write_concern
(
$this
->
manager
);
$this
->
writeConcern
=
$writeConcern
?:
$this
->
manager
->
getWriteConcern
(
);
$this
->
readPreference
=
$readPreference
?:
\MongoDB\get_manager_read_preference
(
$this
->
manager
);
$this
->
readPreference
=
$readPreference
?:
$this
->
manager
->
getReadPreference
(
);
}
}
/**
/**
...
...
src/Database.php
View file @
303de406
...
@@ -44,8 +44,8 @@ class Database
...
@@ -44,8 +44,8 @@ class Database
$this
->
manager
=
$manager
;
$this
->
manager
=
$manager
;
$this
->
databaseName
=
(
string
)
$databaseName
;
$this
->
databaseName
=
(
string
)
$databaseName
;
$this
->
writeConcern
=
$writeConcern
?:
\MongoDB\get_manager_write_concern
(
$this
->
manager
);
$this
->
writeConcern
=
$writeConcern
?:
$this
->
manager
->
getWriteConcern
(
);
$this
->
readPreference
=
$readPreference
?:
\MongoDB\get_manager_read_preference
(
$this
->
manager
);
$this
->
readPreference
=
$readPreference
?:
$this
->
manager
->
getReadPreference
(
);
}
}
/**
/**
...
...
src/Operation/BulkWrite.php
View file @
303de406
...
@@ -207,7 +207,7 @@ class BulkWrite implements Executable
...
@@ -207,7 +207,7 @@ class BulkWrite implements Executable
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
$bulk
=
new
Bulk
(
$this
->
options
[
'ordered'
]);
$bulk
=
new
Bulk
(
[
'ordered'
=>
$this
->
options
[
'ordered'
]
]);
$insertedIds
=
array
();
$insertedIds
=
array
();
foreach
(
$this
->
operations
as
$i
=>
$operation
)
{
foreach
(
$this
->
operations
as
$i
=>
$operation
)
{
...
...
src/Operation/CreateIndexes.php
View file @
303de406
...
@@ -107,7 +107,7 @@ class CreateIndexes implements Executable
...
@@ -107,7 +107,7 @@ class CreateIndexes implements Executable
*/
*/
private
function
executeLegacy
(
Server
$server
)
private
function
executeLegacy
(
Server
$server
)
{
{
$bulk
=
new
Bulk
(
true
);
$bulk
=
new
Bulk
(
[
'ordered'
=>
true
]
);
foreach
(
$this
->
indexes
as
$index
)
{
foreach
(
$this
->
indexes
as
$index
)
{
$bulk
->
insert
(
$index
);
$bulk
->
insert
(
$index
);
...
...
src/Operation/InsertMany.php
View file @
303de406
...
@@ -87,7 +87,7 @@ class InsertMany implements Executable
...
@@ -87,7 +87,7 @@ class InsertMany implements Executable
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
$bulk
=
new
Bulk
(
$this
->
options
[
'ordered'
]);
$bulk
=
new
Bulk
(
[
'ordered'
=>
$this
->
options
[
'ordered'
]
]);
$insertedIds
=
array
();
$insertedIds
=
array
();
foreach
(
$this
->
documents
as
$i
=>
$document
)
{
foreach
(
$this
->
documents
as
$i
=>
$document
)
{
...
...
src/functions.php
View file @
303de406
...
@@ -2,12 +2,8 @@
...
@@ -2,12 +2,8 @@
namespace
MongoDB
;
namespace
MongoDB
;
use
MongoDB\Driver\Manager
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Exception\InvalidArgumentTypeException
;
use
MongoDB\Exception\InvalidArgumentTypeException
;
use
ReflectionClass
;
/**
/**
* Return whether the first key in the document starts with a "$" character.
* Return whether the first key in the document starts with a "$" character.
...
@@ -57,69 +53,6 @@ function is_last_pipeline_operator_out(array $pipeline)
...
@@ -57,69 +53,6 @@ function is_last_pipeline_operator_out(array $pipeline)
return
key
(
$lastOp
)
===
'$out'
;
return
key
(
$lastOp
)
===
'$out'
;
}
}
/**
* Returns a ReadPreference corresponding to the Manager's read preference.
*
* @internal
* @todo this function can be removed once PHPC-417 is implemented
* @param Manager $manager
* @return ReadPreference
*/
function
get_manager_read_preference
(
Manager
$manager
)
{
$rp
=
$manager
->
getReadPreference
();
if
(
$rp
instanceof
ReadPreference
)
{
return
$rp
;
}
$args
=
array
(
$rp
[
'mode'
],
);
if
(
isset
(
$rp
[
'tags'
]))
{
$args
[]
=
$rp
[
'tags'
];
}
$rc
=
new
ReflectionClass
(
'MongoDB\Driver\ReadPreference'
);
return
$rc
->
newInstanceArgs
(
$args
);
}
/**
* Returns a WriteConcern corresponding to the Manager's write concern.
*
* @internal
* @todo this function can be removed once PHPC-417 is implemented
* @param Manager $manager
* @return WriteConcern
*/
function
get_manager_write_concern
(
Manager
$manager
)
{
$wc
=
$manager
->
getWriteConcern
();
if
(
$wc
instanceof
WriteConcern
)
{
return
$wc
;
}
$args
=
array
(
isset
(
$wc
[
'w'
])
?
$wc
[
'w'
]
:
-
2
,
$wc
[
'wtimeout'
],
);
if
(
isset
(
$wc
[
'journal'
]))
{
$args
[]
=
$wc
[
'journal'
];
if
(
isset
(
$wc
[
'fsync'
]))
{
$args
[]
=
$wc
[
'fsync'
];
}
}
$rc
=
new
ReflectionClass
(
'MongoDB\Driver\WriteConcern'
);
return
$rc
->
newInstanceArgs
(
$args
);
}
/**
/**
* Generate an index name from a key specification.
* Generate an index name from a key specification.
*
*
...
...
tests/ClientFunctionalTest.php
View file @
303de406
...
@@ -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/Collection/BulkWriteFunctionalTest.php
View file @
303de406
...
@@ -202,7 +202,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
...
@@ -202,7 +202,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
*/
*/
private
function
createFixtures
(
$n
)
private
function
createFixtures
(
$n
)
{
{
$bulkWrite
=
new
BulkWrite
(
true
);
$bulkWrite
=
new
BulkWrite
(
[
'ordered'
=>
true
]
);
for
(
$i
=
1
;
$i
<=
$n
;
$i
++
)
{
for
(
$i
=
1
;
$i
<=
$n
;
$i
++
)
{
$bulkWrite
->
insert
(
array
(
$bulkWrite
->
insert
(
array
(
...
...
tests/Collection/CollectionFunctionalTest.php
View file @
303de406
...
@@ -83,7 +83,7 @@ class CollectionFunctionalTest extends FunctionalTestCase
...
@@ -83,7 +83,7 @@ class CollectionFunctionalTest extends FunctionalTestCase
*/
*/
private
function
createFixtures
(
$n
)
private
function
createFixtures
(
$n
)
{
{
$bulkWrite
=
new
BulkWrite
(
true
);
$bulkWrite
=
new
BulkWrite
(
[
'ordered'
=>
true
]
);
for
(
$i
=
1
;
$i
<=
$n
;
$i
++
)
{
for
(
$i
=
1
;
$i
<=
$n
;
$i
++
)
{
$bulkWrite
->
insert
(
array
(
$bulkWrite
->
insert
(
array
(
...
...
tests/Collection/CrudSpec/FunctionalTestCase.php
View file @
303de406
...
@@ -17,7 +17,7 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase
...
@@ -17,7 +17,7 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase
*/
*/
protected
function
createFixtures
(
$n
)
protected
function
createFixtures
(
$n
)
{
{
$bulkWrite
=
new
BulkWrite
(
true
);
$bulkWrite
=
new
BulkWrite
(
[
'ordered'
=>
true
]
);
for
(
$i
=
1
;
$i
<=
$n
;
$i
++
)
{
for
(
$i
=
1
;
$i
<=
$n
;
$i
++
)
{
$bulkWrite
->
insert
(
array
(
$bulkWrite
->
insert
(
array
(
...
...
tests/Database/CollectionManagementFunctionalTest.php
View file @
303de406
...
@@ -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 @
303de406
...
@@ -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 @
303de406
...
@@ -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 @
303de406
...
@@ -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/FindOneFunctionalTest.php
View file @
303de406
...
@@ -45,7 +45,7 @@ class FindOneFunctionalTest extends FunctionalTestCase
...
@@ -45,7 +45,7 @@ class FindOneFunctionalTest extends FunctionalTestCase
*/
*/
private
function
createFixtures
(
$n
)
private
function
createFixtures
(
$n
)
{
{
$bulkWrite
=
new
BulkWrite
(
true
);
$bulkWrite
=
new
BulkWrite
(
[
'ordered'
=>
true
]
);
for
(
$i
=
1
;
$i
<=
$n
;
$i
++
)
{
for
(
$i
=
1
;
$i
<=
$n
;
$i
++
)
{
$bulkWrite
->
insert
([
$bulkWrite
->
insert
([
...
...
tests/Operation/ListCollectionsFunctionalTest.php
View file @
303de406
...
@@ -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 @
303de406
...
@@ -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