/** * {@inheritdoc} */ public function load($name, $type = MailTypes::TYPE_ALL) { if (isset($this->mails[$name]) && MailUtil::isValid($this->mails[$name], $type)) { return $this->mails[$name]; } throw new UnknownMailException($name, $type); }
/** * @dataProvider getCheckIsValidMailTypes * * @param bool $result The result value * @param string $entryType The entry type * @param bool $mailEnabled The value of mail field 'enabled' * @param string $mailType The value of mail field 'type' */ public function testIsValid($result, $entryType, $mailEnabled, $mailType) { /* @var MailInterface|\PHPUnit_Framework_MockObject_MockObject $mail */ $mail = $this->getMockBuilder(MailInterface::class)->getMock(); $mail->expects($this->any())->method('isEnabled')->will($this->returnValue($mailEnabled)); $mail->expects($this->any())->method('getType')->will($this->returnValue($mailType)); $this->assertSame($result, MailUtil::isValid($mail, $entryType)); }