Skip to content

Commit dce9ada

Browse files
committed
PHPC-129: Fix tests for HIPPO can't throw InvalidArgumentException on argument errors
1 parent 2af9f04 commit dce9ada

File tree

5 files changed

+3
-43
lines changed

5 files changed

+3
-43
lines changed

tests/bson/bson-binary-001.phpt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ foreach($types as $type) {
2323
$tests[] = array("binary" => $binary);
2424
}
2525

26-
throws(function() {
27-
$b = new BSON\Binary("random binary data without type", BSON\Binary::TYPE_USER_DEFINED);
28-
$b->getSubType($b);
29-
}, "InvalidArgumentException", "getSubType");
30-
3126
throws(function() {
3227
$b = new BSON\Binary("random binary data without type");
3328
echo "FAIL: Constructed BSON\Binary without type!\n";
@@ -55,7 +50,6 @@ bool(true)
5550
bool(true)
5651
bool(true)
5752
bool(true)
58-
OK: Got InvalidArgumentException thrown from getSubType
5953
OK: Got InvalidArgumentException
6054
Test#0 { "binary" : { "$type" : "00", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }
6155
string(73) "{ "binary" : { "$type" : "00", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"

tests/bson/bson-objectid-001.phpt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ $id = new BSON\ObjectID(" 3e28b650640fd3162152da1");
5555
throws(function() {
5656
$id = new BSON\ObjectID(new stdclass);
5757
}, "InvalidArgumentException");
58-
throws(function() {
59-
$id = new BSON\ObjectID();
60-
echo $id->__toString("or somethign");
61-
}, "InvalidArgumentException");
6258

6359
?>
6460
===DONE===
@@ -89,5 +85,4 @@ OK: Got InvalidArgumentException
8985
OK: Got InvalidArgumentException
9086
OK: Got InvalidArgumentException
9187
OK: Got InvalidArgumentException
92-
OK: Got InvalidArgumentException
9388
===DONE===

tests/bson/bson-regex-001.phpt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,6 @@ $tests = array(
1818
throws(function() {
1919
$regexp = new BSON\Regex;
2020
}, "InvalidArgumentException");
21-
throws(function() {
22-
$regexp = new BSON\Regex("regexp", "i");
23-
$regexp->getPattern(1);
24-
}, "InvalidArgumentException", "getPattern");
25-
throws(function() {
26-
$regexp = new BSON\Regex("regexp", "i");
27-
$regexp->getFlags(1);
28-
}, "InvalidArgumentException", "getFlags");
29-
30-
throws(function() {
31-
$regexp = new BSON\Regex("regexp", "i");
32-
$regexp->__toString(1);
33-
}, "InvalidArgumentException", "__toString");
3421

3522

3623
foreach($tests as $n => $test) {
@@ -49,9 +36,6 @@ Pattern: regexp
4936
Flags: i
5037
String representation: /regexp/i
5138
OK: Got InvalidArgumentException
52-
OK: Got InvalidArgumentException thrown from getPattern
53-
OK: Got InvalidArgumentException thrown from getFlags
54-
OK: Got InvalidArgumentException thrown from __toString
5539
Test#0 { "regex" : { "$regex" : "regexp", "$options" : "i" } }
5640
string(55) "{ "regex" : { "$regex" : "regexp", "$options" : "i" } }"
5741
string(55) "{ "regex" : { "$regex" : "regexp", "$options" : "i" } }"

tests/bson/bson-timestamp-001.phpt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ throws(function() {
1515
$s = new BSON\Timestamp;
1616
}, "InvalidArgumentException");
1717

18-
throws(function() {
19-
$s = new BSON\Timestamp(1234, 5678);
20-
echo $s, "\n";
21-
$s->__toString(1);
22-
}, "InvalidArgumentException", "__toString");
18+
$s = new BSON\Timestamp(1234, 5678);
19+
echo $s, "\n";
2320

2421
foreach($tests as $n => $test) {
2522
$s = BSON\fromArray($test);
@@ -35,7 +32,6 @@ foreach($tests as $n => $test) {
3532
--EXPECTF--
3633
OK: Got InvalidArgumentException
3734
[1234:5678]
38-
OK: Got InvalidArgumentException thrown from __toString
3935
Test#0 { "timestamp" : { "$timestamp" : { "t" : 5678, "i" : 1234 } } }
4036
string(63) "{ "timestamp" : { "$timestamp" : { "t" : 5678, "i" : 1234 } } }"
4137
string(63) "{ "timestamp" : { "$timestamp" : { "t" : 5678, "i" : 1234 } } }"

tests/bson/bson-utcdatetime-001.phpt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ $array = iterator_to_array($cursor);
1818
$date = $utcdatetime->toDateTime();
1919
var_dump($date->format(DATE_RSS));
2020

21-
throws(function() use ($utcdatetime) {
22-
echo $utcdatetime, "\n";
23-
$utcdatetime->__toString(1);
24-
}, "InvalidArgumentException");
25-
26-
throws(function() use ($utcdatetime) {
27-
$utcdatetime->toDateTime(DATE_RSS);
28-
}, "InvalidArgumentException");
21+
echo $utcdatetime, "\n";
2922

3023
throws(function() {
3124
$d = new BSON\UTCDatetime;
@@ -52,8 +45,6 @@ foreach($tests as $n => $test) {
5245
string(31) "Thu, 20 Nov 2014 01:03:31 +0000"
5346
1416445411987
5447
OK: Got InvalidArgumentException
55-
OK: Got InvalidArgumentException
56-
OK: Got InvalidArgumentException
5748
Test#0 { "0" : { "$date" : 1416445411987 } }
5849
string(37) "{ "0" : { "$date" : 1416445411987 } }"
5950
string(37) "{ "0" : { "$date" : 1416445411987 } }"

0 commit comments

Comments
 (0)