Skip to content

Commit a6544e1

Browse files
committed
PHPC-1178: Reimplement tests that load data fixtures
1 parent f6219f6 commit a6544e1

File tree

6 files changed

+8
-12
lines changed

6 files changed

+8
-12
lines changed

tests/functional/cursor-001.phpt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
Sorting single field, ascending, using the Cursor Iterator
3-
--XFAIL--
4-
LOAD() tests must be reimplemented (PHPC-1178)
53
--SKIPIF--
64
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
75
<?php skip_if_not_live(); ?>
@@ -11,6 +9,7 @@ LOAD() tests must be reimplemented (PHPC-1178)
119
require_once __DIR__ . "/../utils/basic.inc";
1210

1311
$manager = new MongoDB\Driver\Manager(URI);
12+
loadFixtures($manager);
1413

1514
$query = new MongoDB\Driver\Query(array(), array(
1615
'projection' => array('_id' => 0, 'username' => 1),

tests/functional/cursorid-001.phpt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
Sorting single field, ascending, using the Cursor Iterator
3-
--XFAIL--
4-
LOAD() tests must be reimplemented (PHPC-1178)
53
--SKIPIF--
64
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
75
<?php skip_if_not_live(); ?>
@@ -11,6 +9,7 @@ LOAD() tests must be reimplemented (PHPC-1178)
119
require_once __DIR__ . "/../utils/basic.inc";
1210

1311
$manager = new MongoDB\Driver\Manager(URI);
12+
loadFixtures($manager);
1413

1514
$query = new MongoDB\Driver\Query(array(), array(
1615
'projection' => array('_id' => 0, 'username' => 1),

tests/functional/query-sort-001.phpt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
Sorting single field, ascending
3-
--XFAIL--
4-
LOAD() tests must be reimplemented (PHPC-1178)
53
--SKIPIF--
64
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
75
<?php skip_if_not_live(); ?>
@@ -11,6 +9,7 @@ LOAD() tests must be reimplemented (PHPC-1178)
119
require_once __DIR__ . "/../utils/basic.inc";
1210

1311
$manager = new MongoDB\Driver\Manager(URI);
12+
loadFixtures($manager);
1413

1514
$query = new MongoDB\Driver\Query(array(), array(
1615
'projection' => array('_id' => 0, 'username' => 1),

tests/functional/query-sort-002.phpt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
Sorting single field, descending
3-
--XFAIL--
4-
LOAD() tests must be reimplemented (PHPC-1178)
53
--SKIPIF--
64
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
75
<?php skip_if_not_live(); ?>
@@ -11,6 +9,7 @@ LOAD() tests must be reimplemented (PHPC-1178)
119
require_once __DIR__ . "/../utils/basic.inc";
1210

1311
$manager = new MongoDB\Driver\Manager(URI);
12+
loadFixtures($manager);
1413

1514
$query = new MongoDB\Driver\Query(array(), array(
1615
'projection' => array('_id' => 0, 'username' => 1),

tests/functional/query-sort-003.phpt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
Sorting single field, ascending, using the Cursor Iterator
3-
--XFAIL--
4-
LOAD() tests must be reimplemented (PHPC-1178)
53
--SKIPIF--
64
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
75
<?php skip_if_not_live(); ?>
@@ -11,6 +9,7 @@ LOAD() tests must be reimplemented (PHPC-1178)
119
require_once __DIR__ . "/../utils/basic.inc";
1210

1311
$manager = new MongoDB\Driver\Manager(URI);
12+
loadFixtures($manager);
1413

1514
$query = new MongoDB\Driver\Query(array(), array(
1615
'projection' => array('_id' => 0, 'username' => 1),

tests/utils/tools.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,13 @@ function SLOW() {
408408
exit("skip SKIP_SLOW_TESTS");
409409
}
410410
}
411-
function LOAD($uri, $dbname = DATABASE_NAME, $collname = COLLECTION_NAME, $filename = null) {
411+
412+
function loadFixtures(\MongoDB\Driver\Manager $manager, $dbname = DATABASE_NAME, $collname = COLLECTION_NAME, $filename = null)
413+
{
412414
if (!$filename) {
413415
$filename = "compress.zlib://" . __DIR__ . "/" . "PHONGO-FIXTURES.json.gz";
414416
}
415417

416-
$manager = new MongoDB\Driver\Manager($uri);
417418
$bulk = new MongoDB\Driver\BulkWrite(['ordered' => false]);
418419

419420
$server = $manager->selectServer(new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_PRIMARY));

0 commit comments

Comments
 (0)