bin
3 months ago
AdminCodeCleanupAndPDFTest.php
3 months ago
AdminCodesByProductTest.php
3 months ago
AdminCustomerNameTest.php
3 months ago
AdminErrorLogTest.php
3 months ago
AdminFormatWarningTest.php
3 months ago
AdminListAndCodeOpsTest.php
3 months ago
AdminListQueryTest.php
3 months ago
AdminMetaAndErrorTest.php
3 months ago
AdminOptionsAndMigrationTest.php
3 months ago
AdminOrderInfoTest.php
3 months ago
AdminRedeemAmountTest.php
3 months ago
AdminRestrictionAndRstrTest.php
3 months ago
AdminSettingsAndDatepickerTest.php
3 months ago
AdminSettingsCodeTest.php
3 months ago
AdminTicketInfoTest.php
3 months ago
AdminTimezoneAndMiscTest.php
3 months ago
AdminWCCodeOpsTest.php
3 months ago
AuthtokenAccessTest.php
3 months ago
AuthtokenCRUDTest.php
3 months ago
AuthtokenEditAndRemoveTest.php
3 months ago
AuthtokenTest.php
3 months ago
BaseLimitsTest.php
3 months ago
CartCodeRestrictionAndAssignTest.php
3 months ago
CartMetaAndBeforeCartTest.php
3 months ago
CartValidationTest.php
3 months ago
CoreAlignAndSearchTest.php
3 months ago
CoreCodeOpsAndDBLogTest.php
3 months ago
CoreDecodeAndReplaceTest.php
3 months ago
CoreEncodeMetaTest.php
3 months ago
CoreExpiredAndRegisteredTest.php
3 months ago
CoreMetaAndUrlTest.php
3 months ago
CoreMetaObjectStructureTest.php
3 months ago
CoreMetaTest.php
3 months ago
CoreMethodsTest.php
3 months ago
CoreOrderAndIPTest.php
3 months ago
CoreParserAndQueryTest.php
3 months ago
CoreParserURLAndMergePDFTest.php
3 months ago
CoreReplaceAndExpireTest.php
3 months ago
CoreTicketIdAndExpirationTest.php
3 months ago
CoreTicketIdAndUrlTest.php
3 months ago
CoreTicketURLComponentsTest.php
3 months ago
CountRedeemsTodayTest.php
3 months ago
CronjobTest.php
3 months ago
DBOperationsTest.php
3 months ago
DBSanitizeAndQueryTest.php
3 months ago
DBSanitizeTest.php
3 months ago
DBTablesAndUpdateTest.php
3 months ago
DatabaseTest.php
3 months ago
DateCalcAndCorrectProductTest.php
3 months ago
DaychooserTest.php
3 months ago
EmailHandlerTest.php
3 months ago
EmailOrderMetaAndAttachmentsTest.php
3 months ago
ErrorLogAndSanitizeTest.php
3 months ago
EventTimeWindowTest.php
3 months ago
FrontendCheckCodeTest.php
3 months ago
FrontendCountConfirmedTest.php
3 months ago
FrontendExecuteJSONAndCheckCodeTest.php
3 months ago
FrontendIsUsedAndOptionsTest.php
3 months ago
FrontendMarkUsedTest.php
3 months ago
FrontendValidationTest.php
3 months ago
FullTicketFlowTest.php
3 months ago
HelpersTest.php
3 months ago
ListManagementTest.php
3 months ago
MaxRedeemPerDayTest.php
3 months ago
MessengerAndRESTEndpointsTest.php
3 months ago
MessengerTypeCheckTest.php
3 months ago
OneTimeUseTest.php
3 months ago
OptionsChangeAndLoadTest.php
3 months ago
OptionsDeleteAndResetTest.php
3 months ago
OptionsExportImportTest.php
3 months ago
OptionsFormatsTest.php
3 months ago
OptionsResetAndFormatTest.php
3 months ago
OptionsTest.php
3 months ago
OrderDeleteAndRefundDeleteTest.php
3 months ago
OrderMetaKeyValueDisplayTest.php
3 months ago
OrderStatusHandlerTest.php
3 months ago
OrderTicketGenerationTest.php
3 months ago
OrderTicketQueryTest.php
3 months ago
PDFAndQRConfigTest.php
3 months ago
PDFMergeAndPWAServiceWorkerTest.php
3 months ago
PDFSettersTest.php
3 months ago
PDFSettingsTest.php
3 months ago
PDFUtilsTest.php
3 months ago
PWAManifestAndSessionTest.php
3 months ago
PartialRefundAndCodeCleanupTest.php
3 months ago
PluginInitAndShortcodeTest.php
3 months ago
ProductSettingsTest.php
3 months ago
QRCodeAndDesignerTest.php
3 months ago
QRPDFAndBadgePDFTest.php
3 months ago
RESTRoutesAndPingTest.php
3 months ago
RefundTest.php
3 months ago
RestApiTest.php
3 months ago
RestApiTicketTest.php
3 months ago
ScannerBoilerplateAndFormatWarningsTest.php
3 months ago
SeatingBlockTest.php
3 months ago
SeatingCoordinatorTest.php
3 months ago
SeatingMetaTest.php
3 months ago
SeatingPlanCRUDTest.php
3 months ago
SeatingPlanTest.php
3 months ago
SeatingSeatCRUDTest.php
3 months ago
SetupWizardTest.php
3 months ago
ShortcodeAndCartCheckTest.php
3 months ago
ShortcodeAndCodesDisplayTest.php
3 months ago
ShortcodesAndCodeListTest.php
3 months ago
StaticDateAndTimeTest.php
3 months ago
StaticHelpersAndMessengerTest.php
3 months ago
StaticUtilMethodsTest.php
3 months ago
TicketBadgeTemplateTest.php
3 months ago
TicketCalcDateTest.php
3 months ago
TicketDesignerAndBadgeTest.php
3 months ago
TicketDesignerTemplateTest.php
3 months ago
TicketDesignerTest.php
3 months ago
TicketDisplayTest.php
3 months ago
TicketExpirationAndICSTest.php
3 months ago
TicketLabelAndDisplayTest.php
3 months ago
TicketLabelsAndStaticsTest.php
3 months ago
TicketQRSettersTest.php
3 months ago
TicketRedeemTest.php
3 months ago
TicketRoutingTest.php
3 months ago
TicketScannerMethodsTest.php
3 months ago
TicketSettersAndOrderTest.php
3 months ago
TicketUtilAndICSTest.php
3 months ago
TicketUtilMethodsTest.php
3 months ago
TicketWPMLAndSubscriptionTest.php
3 months ago
TimezoneRedeemBlockingTest.php
3 months ago
UrlParsingTest.php
3 months ago
VariationTicketTest.php
3 months ago
WCBaseMetaConstantsTest.php
3 months ago
WCCheckoutCartFlowTest.php
3 months ago
WCEmailAttachmentTest.php
3 months ago
WCFrontendAjaxAndDatepickerTest.php
3 months ago
WCFrontendCartHandlerTest.php
3 months ago
WCFrontendCartHandlersTest.php
3 months ago
WCFrontendCartTest.php
3 months ago
WCFrontendCartValidationTest.php
3 months ago
WCFrontendHandlersTest.php
3 months ago
WCFrontendLabelsTest.php
3 months ago
WCFrontendMethodsTest.php
3 months ago
WCOrderDeleteTest.php
3 months ago
WCOrderDisplayMetaTest.php
3 months ago
WCOrderHasTicketsTest.php
3 months ago
WCOrderHooksTest.php
3 months ago
WCOrderItemMetaDisplayTest.php
3 months ago
WCOrderItemOpsTest.php
3 months ago
WCOrderLifecycleTest.php
3 months ago
WCOrderMethodsTest.php
3 months ago
WCOrderTicketDetectionTest.php
3 months ago
WCOrderTicketNumberTest.php
3 months ago
WCProductAndVariationTest.php
3 months ago
WCProductColumnsTest.php
3 months ago
WCProductConfigAndColumnsTest.php
3 months ago
WCProductIsTicketAndListsTest.php
3 months ago
WCProductMetaSaveTest.php
3 months ago
WCProductMethodsTest.php
3 months ago
WCProductTabsAndSideBoxTest.php
3 months ago
WCProductTicketTest.php
3 months ago
WebhooksAndMigrationTest.php
3 months ago
bootstrap.php
3 months ago
composer.json
3 months ago
phpunit.xml
3 months ago
PDFSettersTest.php
136 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Tests for PDF methods: setters, getters, parts management. |
| 4 | */ |
| 5 | |
| 6 | class PDFSettersTest extends WP_UnitTestCase { |
| 7 | |
| 8 | private $main; |
| 9 | |
| 10 | public function set_up(): void { |
| 11 | parent::set_up(); |
| 12 | $this->main = sasoEventtickets::Instance(); |
| 13 | } |
| 14 | |
| 15 | // ── setFilemode / getFilemode ───────────────────────────────── |
| 16 | |
| 17 | public function test_setFilemode_and_getFilemode(): void { |
| 18 | $pdf = $this->main->getNewPDFObject(); |
| 19 | $pdf->setFilemode('d'); |
| 20 | $this->assertEquals('D', $pdf->getFilemode()); |
| 21 | } |
| 22 | |
| 23 | public function test_setFilemode_uppercase(): void { |
| 24 | $pdf = $this->main->getNewPDFObject(); |
| 25 | $pdf->setFilemode('i'); |
| 26 | $this->assertEquals('I', $pdf->getFilemode()); |
| 27 | } |
| 28 | |
| 29 | // ── setFilename / setFilepath / getFullFilePath ─────────────── |
| 30 | |
| 31 | public function test_setFilename_and_getFullFilePath(): void { |
| 32 | $pdf = $this->main->getNewPDFObject(); |
| 33 | $pdf->setFilepath('/tmp/'); |
| 34 | $pdf->setFilename('test.pdf'); |
| 35 | $this->assertEquals('/tmp/test.pdf', $pdf->getFullFilePath()); |
| 36 | } |
| 37 | |
| 38 | public function test_setFilepath_trims(): void { |
| 39 | $pdf = $this->main->getNewPDFObject(); |
| 40 | $pdf->setFilepath(' /tmp/ '); |
| 41 | $pdf->setFilename('file.pdf'); |
| 42 | $this->assertEquals('/tmp/file.pdf', $pdf->getFullFilePath()); |
| 43 | } |
| 44 | |
| 45 | // ── setSize ────────────────────────────────────────────────── |
| 46 | |
| 47 | public function test_setSize_stores_dimensions(): void { |
| 48 | $pdf = $this->main->getNewPDFObject(); |
| 49 | $pdf->setSize(100, 200); |
| 50 | |
| 51 | $ref = new ReflectionProperty($pdf, 'size_width'); |
| 52 | $ref->setAccessible(true); |
| 53 | $this->assertEquals(100, $ref->getValue($pdf)); |
| 54 | |
| 55 | $refH = new ReflectionProperty($pdf, 'size_height'); |
| 56 | $refH->setAccessible(true); |
| 57 | $this->assertEquals(200, $refH->getValue($pdf)); |
| 58 | } |
| 59 | |
| 60 | // ── setOrientation ─────────────────────────────────────────── |
| 61 | |
| 62 | public function test_setOrientation_stores_value(): void { |
| 63 | $pdf = $this->main->getNewPDFObject(); |
| 64 | $pdf->setOrientation('L'); |
| 65 | |
| 66 | $ref = new ReflectionProperty($pdf, 'orientation'); |
| 67 | $ref->setAccessible(true); |
| 68 | $this->assertEquals('L', $ref->getValue($pdf)); |
| 69 | } |
| 70 | |
| 71 | // ── setPageFormat ──────────────────────────────────────────── |
| 72 | |
| 73 | public function test_setPageFormat_stores_value(): void { |
| 74 | $pdf = $this->main->getNewPDFObject(); |
| 75 | $pdf->setPageFormat('A5'); |
| 76 | |
| 77 | $ref = new ReflectionProperty($pdf, 'page_format'); |
| 78 | $ref->setAccessible(true); |
| 79 | $this->assertEquals('A5', $ref->getValue($pdf)); |
| 80 | } |
| 81 | |
| 82 | // ── setRTL / isRTL ─────────────────────────────────────────── |
| 83 | |
| 84 | public function test_setRTL_and_isRTL_default(): void { |
| 85 | $pdf = $this->main->getNewPDFObject(); |
| 86 | $this->assertFalse($pdf->isRTL()); |
| 87 | } |
| 88 | |
| 89 | public function test_setRTL_and_isRTL_true(): void { |
| 90 | $pdf = $this->main->getNewPDFObject(); |
| 91 | $pdf->setRTL(true); |
| 92 | $this->assertTrue($pdf->isRTL()); |
| 93 | } |
| 94 | |
| 95 | // ── setParts / addPart ─────────────────────────────────────── |
| 96 | |
| 97 | public function test_setParts_stores_parts(): void { |
| 98 | $pdf = $this->main->getNewPDFObject(); |
| 99 | $pdf->setParts(['<h1>Page 1</h1>', '<h1>Page 2</h1>']); |
| 100 | |
| 101 | $ref = new ReflectionProperty($pdf, 'parts'); |
| 102 | $ref->setAccessible(true); |
| 103 | $parts = $ref->getValue($pdf); |
| 104 | |
| 105 | $this->assertCount(2, $parts); |
| 106 | } |
| 107 | |
| 108 | public function test_addPart_splits_by_pagebreak(): void { |
| 109 | $pdf = $this->main->getNewPDFObject(); |
| 110 | $pdf->setParts([]); |
| 111 | $pdf->addPart('Page1{PAGEBREAK}Page2{PAGEBREAK}Page3'); |
| 112 | |
| 113 | $ref = new ReflectionProperty($pdf, 'parts'); |
| 114 | $ref->setAccessible(true); |
| 115 | $parts = $ref->getValue($pdf); |
| 116 | |
| 117 | $this->assertCount(3, $parts); |
| 118 | $this->assertEquals('Page1', $parts[0]); |
| 119 | $this->assertEquals('Page2', $parts[1]); |
| 120 | $this->assertEquals('Page3', $parts[2]); |
| 121 | } |
| 122 | |
| 123 | public function test_addPart_single_part(): void { |
| 124 | $pdf = $this->main->getNewPDFObject(); |
| 125 | $pdf->setParts([]); |
| 126 | $pdf->addPart('<div>Content</div>'); |
| 127 | |
| 128 | $ref = new ReflectionProperty($pdf, 'parts'); |
| 129 | $ref->setAccessible(true); |
| 130 | $parts = $ref->getValue($pdf); |
| 131 | |
| 132 | $this->assertCount(1, $parts); |
| 133 | $this->assertEquals('<div>Content</div>', $parts[0]); |
| 134 | } |
| 135 | } |
| 136 |