template->setUsername('mock-username'); $this->template->setKey('mock-key'); $params = $this->template->getParams(); $this->assertSame('mock-username', $params['username']); $this->assertSame('mock-key', $params['key']); } /** * @dataProvider getInvalidCallsCases */ public function testInvalidCallOfParams(?string $username, ?string $key): void { $this->expectException(InvalidCallException::class); $username !== null && $this->template->setUsername($username); $key !== null && $this->template->setKey($key); $this->template->getParams(); } public function getInvalidCallsCases(): iterable { yield [null, null]; yield ['value', null]; yield [null, 'value']; } protected function _before(): void { parent::_before(); $mailer = $this->createMock(MailerInterface::class); $this->template = new ConfirmNewEmail($mailer); } }