/** * @expectedException Respect\Validation\Exceptions\KeySetException * @expectedExceptionMessage Must have keys { "name" } * @dataProvider providerForInvalidArguments */ public function testShouldThrowExceptionInCaseArgumentIsAnythingOtherThanArray($input) { $keySet = new KeySet(new Key('name')); $keySet->assert($input); }
/** * @expectedException Respect\Validation\Exceptions\KeySetException * @expectedExceptionMessage Must have keys "foo","bar" */ public function testShouldAssertKeys() { $input = array(); $key1 = new Key('foo', new AlwaysValid(), true); $key2 = new Key('bar', new AlwaysValid(), true); $keySet = new KeySet($key1, $key2); $keySet->assert($input); }