Skip to content

Commit 1fdb514

Browse files
committed
Add test for exception on TypeConstraint::validateType()
1 parent 001a0ba commit 1fdb514

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/Constraints/TypeTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,17 @@ public function testValidateTypeNameWording()
106106
);
107107
$m->invoke($t, 'notAValidTypeName');
108108
}
109+
110+
public function testValidateTypeException()
111+
{
112+
$t = new TypeConstraint();
113+
$data = new \StdClass();
114+
$schema = json_decode('{"type": "notAValidTypeName"}');
115+
116+
$this->setExpectedException(
117+
'JsonSchema\Exception\InvalidArgumentException',
118+
'object is an invalid type for notAValidTypeName'
119+
);
120+
$t->check($data, $schema);
121+
}
109122
}

0 commit comments

Comments
 (0)