Jyxo\Mail\EncodingTest::testEncode PHP Method

testEncode() public method

Tests the encode() method.
See also: Jyxo\Mail\Encoding::encode()
public testEncode ( )
    public function testEncode()
    {
        $data = file_get_contents($this->filePath . '/email.html');
        foreach ($this->encodings as $encoding) {
            $encoded = Encoding::encode($data, $encoding, 75, "\n");
            $this->assertStringEqualsFile($this->filePath . '/encoding-' . $encoding . '.txt', $encoded);
        }
        try {
            Encoding::encode('data', 'dummy-encoding', 75, "\n");
            $this->fail(sprintf('Expected exception %s.', \InvalidArgumentException::class));
        } catch (\PHPUnit_Framework_AssertionFailedError $e) {
            throw $e;
        } catch (\Exception $e) {
            // Correctly thrown exception
            $this->assertInstanceOf(\InvalidArgumentException::class, $e);
        }
    }