コード例 #1
0
 /**
  * {@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);
 }
コード例 #2
0
 /**
  * @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));
 }