[]])); self::assertFalse(Validator::isValid('value', ['\is_stringNot' => []])); self::assertTrue(Validator::isValid('value', ['phpOMS\Validation\Validator::hasLength' => [4]])); } public function testInvalidValidatorCall() : void { $this->expectException(\BadFunctionCallException::class); Validator::isValid('value', ['\invalid_call' => []]); } #[\PHPUnit\Framework\Attributes\Group('framework')] #[\PHPUnit\Framework\Attributes\TestDox('A value can be checked to match a regular expression')] public function testMatching() : void { self::assertTrue(Validator::matches('ThisTestVar', '/.*/')); self::assertFalse(Validator::matches('ThisTestVar', '/.*\d+/')); self::assertTrue(Validator::matches('ThisTestVar', '/TestVar/')); self::assertFalse(Validator::matches('ThisTestVar', '/ThisTest$/')); } #[\PHPUnit\Framework\Attributes\Group('framework')] public function testErrorMessage() : void { self::assertEquals('', Validator::getMessage()); } #[\PHPUnit\Framework\Attributes\Group('framework')] public function testErrorCode() : void { self::assertEquals(0, Validator::getErrorCode()); } #[\PHPUnit\Framework\Attributes\Group('framework')] public function testResetError() : void { Validator::resetError(); self::assertEquals('', Validator::getMessage()); self::assertEquals(0, Validator::getErrorCode()); } }