Exemplo n.º 1
0
 /**
  * @dataProvider generateItems
  * @covers ::append
  */
 public function test_append($Valid, $Invalid = array())
 {
     # Test valid
     $this->Container->append($Valid);
     $this->assertSame($Valid, $this->Container[0], 'IContainer[0] should equal $Valid');
     # Test invalid
     try {
         $this->Container->append($Invalid);
         $this->fail('Unable to generate exception with invalid value');
     } catch (\UnexpectedValueException $e) {
         $this->assertContains('Invalid value', $e->getMessage(), 'Invalid exception: ' . $e->getMessage());
     }
 }
Exemplo n.º 2
0
 /**
  * Add inline attachment to message.
  *
  * @throws \BLW\Model\FileException If <code>$File</code> cannot be read.
  *
  * @param \BLW\Type\IFile $File
  *            File to attatch.
  * @return string UniqueID of attachment.
  */
 public function inlineAttachment(IFile $File)
 {
     // Is file readable?
     if (!$File->isReadable()) {
         // Try to open file
         try {
             $File->openFile();
         } catch (FileException $e) {
             throw new FileException(strval($File), null, $e->getCode(), $e);
         }
     }
     // Generate unique id
     $File->UniqueID = uniqid();
     // Add attachment
     $this->_InlineAttachments->append($File);
     // Done
     return "@{$File->UniqueID}";
 }
Exemplo n.º 3
0
 /**
  * Add to email address.
  *
  * @param \BLW\Type\IEmailAddress $EmailAddress
  *            Address to add.
  * @return integer Returns a <code>IDataMapper</code> status code.
  */
 public function addBCC(IEmailAddress $EmailAddress)
 {
     // Is address valid?
     if ($EmailAddress->isValid()) {
         // Add email address
         $this->_BCC->append($EmailAddress);
         // Done
         return IDataMapper::UPDATED;
     }
     // Done
     return IDataMapper::INVALID;
 }