Server : Apache System : Linux 145.162.205.92.host.secureserver.net 5.14.0-611.45.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 1 05:56:53 EDT 2026 x86_64 User : tradze ( 1001) PHP Version : 8.1.34 Disable Function : NONE Directory : /home/tradze/public_html/dev-test/vendorOLD/barryvdh/laravel-dompdf/tests/ |
<?php
namespace Barryvdh\DomPDF\Tests;
use Barryvdh\DomPDF\Facade;
use Illuminate\Http\Response;
class PdfTest extends TestCase
{
public function testAlias(): void
{
$pdf = \PDF::loadHtml('<h1>Test</h1>');
/** @var Response $response */
$response = $pdf->download('test.pdf');
$this->assertInstanceOf(Response::class, $response);
$this->assertNotEmpty($response->getContent());
$this->assertEquals('application/pdf', $response->headers->get('Content-Type'));
$this->assertEquals('attachment; filename="test.pdf"', $response->headers->get('Content-Disposition'));
}
public function testFacade(): void
{
$pdf = Facade\Pdf::loadHtml('<h1>Test</h1>');
/** @var Response $response */
$response = $pdf->download('test.pdf');
$this->assertInstanceOf(Response::class, $response);
$this->assertNotEmpty($response->getContent());
$this->assertEquals('application/pdf', $response->headers->get('Content-Type'));
$this->assertEquals('attachment; filename="test.pdf"', $response->headers->get('Content-Disposition'));
}
public function testDeprecatedFacade(): void
{
$pdf = Facade::loadHtml('<h1>Test</h1>');
/** @var Response $response */
$response = $pdf->download('test.pdf');
$this->assertInstanceOf(Response::class, $response);
$this->assertNotEmpty($response->getContent());
$this->assertEquals('application/pdf', $response->headers->get('Content-Type'));
$this->assertEquals('attachment; filename="test.pdf"', $response->headers->get('Content-Disposition'));
}
public function testDownload(): void
{
$pdf = Facade::loadHtml('<h1>Test</h1>');
/** @var Response $response */
$response = $pdf->download('test.pdf');
$this->assertInstanceOf(Response::class, $response);
$this->assertNotEmpty($response->getContent());
$this->assertEquals('application/pdf', $response->headers->get('Content-Type'));
$this->assertEquals('attachment; filename="test.pdf"', $response->headers->get('Content-Disposition'));
}
public function testStream(): void
{
$pdf = Facade::loadHtml('<h1>Test</h1>');
/** @var Response $response */
$response = $pdf->stream('test.pdf');
$this->assertInstanceOf(Response::class, $response);
$this->assertNotEmpty($response->getContent());
$this->assertEquals('application/pdf', $response->headers->get('Content-Type'));
$this->assertEquals('inline; filename="test.pdf"', $response->headers->get('Content-Disposition'));
}
public function testView(): void
{
$pdf = Facade::loadView('test');
/** @var Response $response */
$response = $pdf->download('test.pdf');
$this->assertInstanceOf(Response::class, $response);
$this->assertNotEmpty($response->getContent());
$this->assertEquals('application/pdf', $response->headers->get('Content-Type'));
$this->assertEquals('attachment; filename="test.pdf"', $response->headers->get('Content-Disposition'));
}
}