expectException(InvalidEmailException::class); } (new Gordianus())->getPrimaryEmail($email); } public function providerValidator() { return [ ['john.doe@gmail.comm', true], ['john doe@gmail.com', false], ]; } /** * @dataProvider providerGetPrimaryEmail * * @param Gordianus $gordianus * @param string $email * @param string $expectedEmail */ public function testGetPrimaryEmail(Gordianus $gordianus, string $email, string $expectedEmail) { $this->assertSame($expectedEmail, $gordianus->getPrimaryEmail($email)); } public function providerGetPrimaryEmail() { return [ [new Gordianus([Gordianus::SERVICE_TLEN_PL]), 'john.doe+alias@gmail.com', 'john.doe+alias@gmail.com'], [new Gordianus(), 'john.doe+alias@gmail.com', 'johndoe@gmail.com'], [new Gordianus([]), 'John.Doe@example.com', 'john.doe@example.com'], [new Gordianus([], true), 'John.Doe@example.com', 'John.Doe@example.com'], ]; } }