* Fix wrong type hint Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Use $this instead of parent Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * setUp should be a protected method Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * onNotSuccessfulTest should be protected Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * $command doesn't need to be a property Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Give alertText() proper return type Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Use null-safe operator Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Call Message static constructors statically Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Call StorageEngine methods statically Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Add better type hints in PrivilegesController Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Use packed (without keys) arrays in tests Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Use type casts instead of function casts Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Use const instead of private property Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Use const instead of private property Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Fix testAuthFailsTooLongPass() Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Replace loop with array_shift Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Use ob_get_clean Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Remove duplicated code Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> * Use assert instead of phpdoc Signed-off-by: Kamil Tekiela <tekiela246@gmail.com> --------- Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
65 lines
1.4 KiB
PHP
65 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpMyAdmin\Tests;
|
|
|
|
use PhpMyAdmin\Pdf;
|
|
use PHPUnit\Framework\Attributes\CoversClass;
|
|
use PHPUnit\Framework\Attributes\Large;
|
|
|
|
#[CoversClass(Pdf::class)]
|
|
#[Large]
|
|
class PdfTest extends AbstractTestCase
|
|
{
|
|
/**
|
|
* SetUp for test cases
|
|
*/
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->setGlobalConfig();
|
|
}
|
|
|
|
/**
|
|
* Test for Pdf::getPDFData
|
|
*/
|
|
public function testBasic(): void
|
|
{
|
|
$arr = new Pdf();
|
|
self::assertStringContainsString('PDF', $arr->getPDFData());
|
|
}
|
|
|
|
/**
|
|
* Test for Pdf::getPDFData
|
|
*/
|
|
public function testAlias(): void
|
|
{
|
|
$arr = new Pdf();
|
|
$arr->setAlias('{00}', '32');
|
|
self::assertStringContainsString('PDF', $arr->getPDFData());
|
|
}
|
|
|
|
/**
|
|
* Test for Pdf::getPDFData
|
|
*/
|
|
public function testDocument(): void
|
|
{
|
|
$pdf = new Pdf();
|
|
$pdf->setTitle('Title');
|
|
$pdf->Open();
|
|
$pdf->setAutoPageBreak(true);
|
|
$pdf->AddPage();
|
|
$pdf->setFont(Pdf::PMA_PDF_FONT, 'B', 14);
|
|
$pdf->Cell(0, 6, 'Cell', 'B', 1, 'C');
|
|
$pdf->Ln();
|
|
$pdf->AddPage();
|
|
$pdf->Bookmark('Bookmark');
|
|
$pdf->setMargins(0, 0);
|
|
$pdf->setDrawColor(200, 200, 200);
|
|
$pdf->Line(0, 0, 100, 100);
|
|
self::assertStringContainsString('PDF', $pdf->getPDFData());
|
|
}
|
|
}
|