validate('test', []); $v->validate('test {string1} test {foo} test {bar}.', [ 'string1' => [ 'type' => 'user', 'id' => 'johndoe', 'name' => 'John Doe', ], 'foo' => [ 'type' => 'user-group', 'id' => 'sample', 'name' => 'Sample Group', ], 'bar' => [ 'type' => 'file', 'id' => '42', 'name' => 'test.txt', 'path' => 'path/to/test.txt', ], ]); $this->addToAssertionCount(2); $this->expectException(InvalidObjectExeption::class); $this->expectExceptionMessage('Object is invalid, value 123 is not a string'); $v->validate('test {string1} test.', [ 'string1' => [ 'type' => 'user', 'id' => 'johndoe', 'name' => 'John Doe', 'key' => 123, ], ]); $this->expectExceptionMessage('Object is invalid, key 456 is not a string'); $v->validate('test {string1} test.', [ 'string1' => [ 'type' => 'user', 'id' => 'johndoe', 'name' => 'John Doe', 456 => 'value', ], ]); } }