Beispiel #1
0
 /**
  * Tests the isCompatible() method.
  *
  * @see \Jyxo\Mail\Encoding::isCompatible()
  */
 public function testIsCompatible()
 {
     // All defined encodings are compatible
     foreach ($this->encodings as $encoding) {
         $this->assertTrue(Encoding::isCompatible($encoding));
     }
     // Incompatible encodings returns false
     $this->assertFalse(Encoding::isCompatible('dummy-encoding'));
 }
Beispiel #2
0
 /**
  * Sets encoding.
  *
  * @param string $encoding Encoding
  * @return \Jyxo\Mail\Sender
  * @throws \InvalidArgumentException If an incompatible encoding was provided
  */
 public function setEncoding(string $encoding) : self
 {
     if (!Encoding::isCompatible($encoding)) {
         throw new \InvalidArgumentException(sprintf('Incompatible encoding %s.', $encoding));
     }
     $this->encoding = $encoding;
     return $this;
 }