setEmail('foo@example.com'); $command = new AccountCreateStep1Command($user); self::assertSame('foo@example.com', $command->email); } /** * @return iterable */ public function provideConstructException(): iterable { yield ['']; yield ['toto']; } /** * @dataProvider provideConstructException */ public function testConstructInvalidEmailException(string $email): void { $user = new User(); $user->setEmail($email); $this->expectException(InvalidArgumentException::class); new AccountCreateStep1Command($user); } }