forked from mongodb/mongo-php-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquery-errors.phpt
37 lines (33 loc) · 1.22 KB
/
query-errors.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
--TEST--
MongoDB\Driver\Query: Invalid types
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
throws(function() {
$query = new MongoDB\Driver\Query(array("company" => "Smith, Carter and Buckridge"), array(
"projection" => array("_id" => 0, "username" => 1),
"sort" => array("phoneNumber" => 1),
"modifiers" => "string",
));
}, "MongoDB\Driver\Exception\InvalidArgumentException");
throws(function() {
$query = new MongoDB\Driver\Query(array("company" => "Smith, Carter and Buckridge"), array(
"projection" => array("_id" => 0, "username" => 1),
"sort" => array("phoneNumber" => 1),
"projection" => "string",
));
}, "MongoDB\Driver\Exception\InvalidArgumentException");
throws(function() {
$query = new MongoDB\Driver\Query(array("company" => "Smith, Carter and Buckridge"), array(
"projection" => array("_id" => 0, "username" => 1),
"sort" => "string"
));
}, "MongoDB\Driver\Exception\InvalidArgumentException");
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
===DONE===