mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-04-25 17:38:09 +02:00
Merge pull request #322
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
MongoDB\Driver\Cursor::isDead()
|
||||
MongoDB\Driver\Cursor::isDead() with basic iteration (find command)
|
||||
--SKIPIF--
|
||||
<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
|
||||
--FILE--
|
||||
@@ -9,22 +9,25 @@ require_once __DIR__ . "/../utils/basic.inc";
|
||||
$manager = new MongoDB\Driver\Manager(STANDALONE);
|
||||
|
||||
$bulk = new MongoDB\Driver\BulkWrite();
|
||||
$bulk->insert(array('_id' => 1));
|
||||
$bulk->insert(array('_id' => 2));
|
||||
$bulk->insert(array('_id' => 3));
|
||||
$bulk->insert(['_id' => 1]);
|
||||
$bulk->insert(['_id' => 2]);
|
||||
$bulk->insert(['_id' => 3]);
|
||||
$manager->executeBulkWrite(NS, $bulk);
|
||||
|
||||
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array(), array('batchSize' => 2)));
|
||||
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query([], ['batchSize' => 2]));
|
||||
|
||||
foreach ($cursor as $_) {
|
||||
var_dump($cursor->isDead());
|
||||
}
|
||||
|
||||
var_dump($cursor->isDead());
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
===DONE===
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
--TEST--
|
||||
MongoDB\Driver\Cursor::isDead() with IteratorIterator (find command)
|
||||
--SKIPIF--
|
||||
<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . "/../utils/basic.inc";
|
||||
|
||||
$manager = new MongoDB\Driver\Manager(STANDALONE);
|
||||
|
||||
$bulk = new MongoDB\Driver\BulkWrite();
|
||||
$bulk->insert(['_id' => 1]);
|
||||
$bulk->insert(['_id' => 2]);
|
||||
$bulk->insert(['_id' => 3]);
|
||||
$manager->executeBulkWrite(NS, $bulk);
|
||||
|
||||
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query([], ['batchSize' => 2]));
|
||||
|
||||
$iterator = new IteratorIterator($cursor);
|
||||
$iterator->rewind();
|
||||
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
var_dump($cursor->isDead());
|
||||
$iterator->next();
|
||||
}
|
||||
|
||||
var_dump($cursor->isDead());
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
MongoDB\Driver\Cursor::isDead() with basic iteration (OP_QUERY)
|
||||
--SKIPIF--
|
||||
<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE_30) ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . "/../utils/basic.inc";
|
||||
|
||||
$manager = new MongoDB\Driver\Manager(STANDALONE_30);
|
||||
|
||||
$bulk = new MongoDB\Driver\BulkWrite();
|
||||
$bulk->insert(['_id' => 1]);
|
||||
$bulk->insert(['_id' => 2]);
|
||||
$bulk->insert(['_id' => 3]);
|
||||
$manager->executeBulkWrite(NS, $bulk);
|
||||
|
||||
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query([], ['batchSize' => 2]));
|
||||
|
||||
foreach ($cursor as $_) {
|
||||
var_dump($cursor->isDead());
|
||||
}
|
||||
|
||||
var_dump($cursor->isDead());
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -0,0 +1,37 @@
|
||||
--TEST--
|
||||
MongoDB\Driver\Cursor::isDead() with IteratorIterator (OP_QUERY)
|
||||
--SKIPIF--
|
||||
<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE_30) ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . "/../utils/basic.inc";
|
||||
|
||||
$manager = new MongoDB\Driver\Manager(STANDALONE_30);
|
||||
|
||||
$bulk = new MongoDB\Driver\BulkWrite();
|
||||
$bulk->insert(['_id' => 1]);
|
||||
$bulk->insert(['_id' => 2]);
|
||||
$bulk->insert(['_id' => 3]);
|
||||
$manager->executeBulkWrite(NS, $bulk);
|
||||
|
||||
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query([], ['batchSize' => 2]));
|
||||
|
||||
$iterator = new IteratorIterator($cursor);
|
||||
$iterator->rewind();
|
||||
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
var_dump($cursor->isDead());
|
||||
$iterator->next();
|
||||
}
|
||||
|
||||
var_dump($cursor->isDead());
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
===DONE===
|
||||
@@ -54,7 +54,7 @@ object(MongoDB\Driver\Cursor)#%d (%d) {
|
||||
["readPreference"]=>
|
||||
NULL
|
||||
["isDead"]=>
|
||||
bool(true)
|
||||
bool(false)
|
||||
["currentIndex"]=>
|
||||
int(0)
|
||||
["currentDocument"]=>
|
||||
|
||||
@@ -71,7 +71,7 @@ object(MongoDB\Driver\Cursor)#%d (%d) {
|
||||
["readPreference"]=>
|
||||
NULL
|
||||
["isDead"]=>
|
||||
bool(true)
|
||||
bool(false)
|
||||
["currentIndex"]=>
|
||||
int(0)
|
||||
["currentDocument"]=>
|
||||
|
||||
@@ -70,7 +70,7 @@ object(MongoDB\Driver\Cursor)#%d (%d) {
|
||||
["readPreference"]=>
|
||||
NULL
|
||||
["isDead"]=>
|
||||
bool(true)
|
||||
bool(false)
|
||||
["currentIndex"]=>
|
||||
int(0)
|
||||
["currentDocument"]=>
|
||||
|
||||
@@ -69,7 +69,7 @@ object(MongoDB\Driver\Cursor)#%d (%d) {
|
||||
}
|
||||
}
|
||||
["isDead"]=>
|
||||
bool(true)
|
||||
bool(false)
|
||||
["currentIndex"]=>
|
||||
int(0)
|
||||
["currentDocument"]=>
|
||||
@@ -118,7 +118,7 @@ object(MongoDB\Driver\Cursor)#%d (%d) {
|
||||
}
|
||||
}
|
||||
["isDead"]=>
|
||||
bool(true)
|
||||
bool(false)
|
||||
["currentIndex"]=>
|
||||
int(0)
|
||||
["currentDocument"]=>
|
||||
@@ -167,7 +167,7 @@ object(MongoDB\Driver\Cursor)#%d (%d) {
|
||||
}
|
||||
}
|
||||
["isDead"]=>
|
||||
bool(true)
|
||||
bool(false)
|
||||
["currentIndex"]=>
|
||||
int(0)
|
||||
["currentDocument"]=>
|
||||
@@ -216,7 +216,7 @@ object(MongoDB\Driver\Cursor)#%d (%d) {
|
||||
}
|
||||
}
|
||||
["isDead"]=>
|
||||
bool(true)
|
||||
bool(false)
|
||||
["currentIndex"]=>
|
||||
int(0)
|
||||
["currentDocument"]=>
|
||||
@@ -265,7 +265,7 @@ object(MongoDB\Driver\Cursor)#%d (%d) {
|
||||
}
|
||||
}
|
||||
["isDead"]=>
|
||||
bool(true)
|
||||
bool(false)
|
||||
["currentIndex"]=>
|
||||
int(0)
|
||||
["currentDocument"]=>
|
||||
|
||||
@@ -43,7 +43,7 @@ object(MongoDB\Driver\Cursor)#%d (%d) {
|
||||
["readPreference"]=>
|
||||
NULL
|
||||
["isDead"]=>
|
||||
bool(true)
|
||||
bool(false)
|
||||
["currentIndex"]=>
|
||||
int(0)
|
||||
["currentDocument"]=>
|
||||
|
||||
Reference in New Issue
Block a user