Translated using Weblate (Chinese (Simplified))
[phpmyadmin.git] / test / classes / PdfTest.php
blob95e53c1db91353ad66318fb2999f6c88c4dde57e
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * tests for Pdf class
6 * @package PhpMyAdmin-test
7 */
8 declare(strict_types=1);
10 namespace PhpMyAdmin\Tests;
12 use PhpMyAdmin\Config;
13 use PhpMyAdmin\Pdf;
14 use PhpMyAdmin\Tests\PmaTestCase;
16 /**
17 * tests for Pdf class
19 * @package PhpMyAdmin-test
21 class PdfTest extends PmaTestCase
23 /**
24 * SetUp for test cases
26 * @return void
28 protected function setUp(): void
30 $GLOBALS['PMA_Config'] = new Config();
31 $GLOBALS['PMA_Config']->enableBc();
34 /**
35 * Test for Pdf::getPDFData
37 * @group large
38 * @return void
40 public function testBasic()
42 $arr = new Pdf();
43 $this->assertStringContainsString('PDF', $arr->getPDFData());
46 /**
47 * Test for Pdf::getPDFData
49 * @group large
50 * @return void
52 public function testAlias()
54 $arr = new Pdf();
55 $arr->setAlias('{00}', '32');
56 $this->assertStringContainsString('PDF', $arr->getPDFData());
59 /**
60 * Test for Pdf::getPDFData
62 * @group large
63 * @return void
65 public function testDocument()
67 $pdf = new Pdf();
68 $pdf->SetTitle('Title');
69 $pdf->Open();
70 $pdf->SetAutoPageBreak('auto');
71 $pdf->Addpage();
72 $pdf->SetFont(Pdf::PMA_PDF_FONT, 'B', 14);
73 $pdf->Cell(0, 6, 'Cell', 'B', 1, 'C');
74 $pdf->Ln();
75 $pdf->Addpage();
76 $pdf->Bookmark('Bookmark');
77 $pdf->SetMargins(0, 0);
78 $pdf->SetDrawColor(200, 200, 200);
79 $pdf->line(0, 0, 100, 100);
80 $this->assertStringContainsString('PDF', $pdf->getPDFData());