forked from mongodb/mongo-php-driver
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatlas.phpt
41 lines (38 loc) · 932 Bytes
/
atlas.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--TEST--
Atlas Connectivity Tests
--SKIPIF--
<?php
if (!file_exists('.travis.scripts/atlas-uris.txt')) { echo "skip Atlas URIs not found\n"; }
if (filesize('.travis.scripts/atlas-uris.txt') < 10) { echo "skip Atlas URI file empty\n"; }
if ($_ENV['TESTS'] !== 'tests/atlas.phpt') { echo "skip Atlas tests not wanted\n"; }
?>
--FILE--
<?php
$urls = explode("\n", file_get_contents('.travis.scripts/atlas-uris.txt'));
$isMasterCmd = new \MongoDB\Driver\Command(['isMaster' => 1]);
$query = new \MongoDB\Driver\Query([]);
foreach ($urls as $url) {
$url = trim($url);
if ($url == '') {
continue;
}
try {
$m = new \MongoDB\Driver\Manager($url);
$m->executeCommand('admin', $isMasterCmd);
iterator_to_array($m->executeQuery('test.test', $query));
echo "PASS\n";
} catch(Exception $e) {
echo "FAIL: ", $e->getMessage(), "\n";
}
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
PASS
PASS
PASS
PASS
PASS
FAIL: %s
===DONE===