[new IsValidEmailList]]); $this->assertFalse($validator->fails()); } /** * Provide Valid data for validation test */ public static function provideValidData() : array { return [ [[ 'value' => 'johndoe@example.com', ]], [[ 'value' => 'johndoe@example.com|janedoe@example.com', ]], [[ 'value' => '|johndoe@example.com|janedoe@example.com', ]], [[ 'value' => 'johndoe@example.com|janedoe@example.com|', ]], ]; } /** * @test */ #[DataProvider('provideInvalidData')] public function test_invalid_data(array $data) : void { $validator = Validator::make($data, ['value' => [new IsValidEmailList]]); $this->assertTrue($validator->fails()); } /** * Provide Valid data for validation test */ public static function provideInvalidData() : array { return [ [[ 'value' => 'johndoeexamplecom', ]], [[ 'value' => 'johndoe@example.com|janedoeexamplecom', ]], [[ 'value' => 'johndoe@example.com,janedoe@example.com', ]], [[ 'value' => 'johndoe@example.com;janedoe@example.com|', ]], [[ 'value' => 'johndoe@example.com janedoe@example.com', ]], [[ 'value' => 'johndoe@example.com | janedoe@example.com', ]], ]; } }