bin
3 months ago
fixtures
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
ContextWizardTest.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
OldPremiumGuardTest.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
OptionsHistoryTest.php
3 months ago
OptionsMigrationTest.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
SeatingExportTest.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
test-premium-compat.sh
3 months ago
CoreMetaObjectStructureTest.php
152 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Tests for Core meta object structure methods: |
| 4 | * getMetaObject, getMetaObjectKeyList, getMetaObjectAllowedReplacementTags, |
| 5 | * getMetaObjectList, getMetaObjectAuthtoken, encodeMetaValuesAndFillObjectAuthtoken. |
| 6 | */ |
| 7 | |
| 8 | class CoreMetaObjectStructureTest extends WP_UnitTestCase { |
| 9 | |
| 10 | private $main; |
| 11 | |
| 12 | public function set_up(): void { |
| 13 | parent::set_up(); |
| 14 | $this->main = sasoEventtickets::Instance(); |
| 15 | } |
| 16 | |
| 17 | // ── getMetaObject ────────────────────────────────────────────── |
| 18 | |
| 19 | public function test_getMetaObject_returns_array(): void { |
| 20 | $result = $this->main->getCore()->getMetaObject(); |
| 21 | $this->assertIsArray($result); |
| 22 | $this->assertNotEmpty($result); |
| 23 | } |
| 24 | |
| 25 | public function test_getMetaObject_has_validation_key(): void { |
| 26 | $result = $this->main->getCore()->getMetaObject(); |
| 27 | $this->assertArrayHasKey('validation', $result); |
| 28 | } |
| 29 | |
| 30 | public function test_getMetaObject_has_user_key(): void { |
| 31 | $result = $this->main->getCore()->getMetaObject(); |
| 32 | $this->assertArrayHasKey('user', $result); |
| 33 | } |
| 34 | |
| 35 | public function test_getMetaObject_validation_has_expected_subkeys(): void { |
| 36 | $result = $this->main->getCore()->getMetaObject(); |
| 37 | $validation = $result['validation']; |
| 38 | $this->assertArrayHasKey('first_success', $validation); |
| 39 | $this->assertArrayHasKey('last_success', $validation); |
| 40 | $this->assertArrayHasKey('first_ip', $validation); |
| 41 | $this->assertArrayHasKey('last_ip', $validation); |
| 42 | } |
| 43 | |
| 44 | // ── getMetaObjectKeyList ─────────────────────────────────────── |
| 45 | |
| 46 | public function test_getMetaObjectKeyList_returns_array(): void { |
| 47 | $metaObj = $this->main->getCore()->getMetaObject(); |
| 48 | $keys = $this->main->getCore()->getMetaObjectKeyList($metaObj); |
| 49 | $this->assertIsArray($keys); |
| 50 | $this->assertNotEmpty($keys); |
| 51 | } |
| 52 | |
| 53 | public function test_getMetaObjectKeyList_keys_are_uppercase(): void { |
| 54 | $metaObj = $this->main->getCore()->getMetaObject(); |
| 55 | $keys = $this->main->getCore()->getMetaObjectKeyList($metaObj); |
| 56 | foreach ($keys as $key) { |
| 57 | $this->assertEquals(strtoupper($key), $key, "Key '$key' should be uppercase"); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | public function test_getMetaObjectKeyList_starts_with_META_prefix(): void { |
| 62 | $metaObj = $this->main->getCore()->getMetaObject(); |
| 63 | $keys = $this->main->getCore()->getMetaObjectKeyList($metaObj); |
| 64 | foreach ($keys as $key) { |
| 65 | $this->assertStringStartsWith('META_', $key); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | public function test_getMetaObjectKeyList_custom_prefix(): void { |
| 70 | $metaObj = $this->main->getCore()->getMetaObject(); |
| 71 | $keys = $this->main->getCore()->getMetaObjectKeyList($metaObj, 'TICKET_'); |
| 72 | foreach ($keys as $key) { |
| 73 | $this->assertStringStartsWith('TICKET_', $key); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | // ── getMetaObjectAllowedReplacementTags ───────────────────────── |
| 78 | |
| 79 | public function test_getMetaObjectAllowedReplacementTags_returns_array(): void { |
| 80 | $result = $this->main->getCore()->getMetaObjectAllowedReplacementTags(); |
| 81 | $this->assertIsArray($result); |
| 82 | $this->assertNotEmpty($result); |
| 83 | } |
| 84 | |
| 85 | public function test_getMetaObjectAllowedReplacementTags_has_user_value(): void { |
| 86 | $tags = $this->main->getCore()->getMetaObjectAllowedReplacementTags(); |
| 87 | $keys = array_column($tags, 'key'); |
| 88 | $this->assertContains('USER_VALUE', $keys); |
| 89 | } |
| 90 | |
| 91 | public function test_getMetaObjectAllowedReplacementTags_has_woocommerce_keys(): void { |
| 92 | $tags = $this->main->getCore()->getMetaObjectAllowedReplacementTags(); |
| 93 | $keys = array_column($tags, 'key'); |
| 94 | $this->assertContains('WOOCOMMERCE_ORDER_ID', $keys); |
| 95 | $this->assertContains('WOOCOMMERCE_PRODUCT_ID', $keys); |
| 96 | } |
| 97 | |
| 98 | // ── getMetaObjectList ────────────────────────────────────────── |
| 99 | |
| 100 | public function test_getMetaObjectList_returns_array(): void { |
| 101 | $result = $this->main->getCore()->getMetaObjectList(); |
| 102 | $this->assertIsArray($result); |
| 103 | } |
| 104 | |
| 105 | public function test_getMetaObjectList_has_desc_key(): void { |
| 106 | $result = $this->main->getCore()->getMetaObjectList(); |
| 107 | $this->assertArrayHasKey('desc', $result); |
| 108 | } |
| 109 | |
| 110 | public function test_getMetaObjectList_has_formatter_key(): void { |
| 111 | $result = $this->main->getCore()->getMetaObjectList(); |
| 112 | $this->assertArrayHasKey('formatter', $result); |
| 113 | } |
| 114 | |
| 115 | public function test_getMetaObjectList_has_webhooks_key(): void { |
| 116 | $result = $this->main->getCore()->getMetaObjectList(); |
| 117 | $this->assertArrayHasKey('webhooks', $result); |
| 118 | } |
| 119 | |
| 120 | // ── getMetaObjectAuthtoken ───────────────────────────────────── |
| 121 | |
| 122 | public function test_getMetaObjectAuthtoken_returns_array(): void { |
| 123 | $result = $this->main->getCore()->getMetaObjectAuthtoken(); |
| 124 | $this->assertIsArray($result); |
| 125 | } |
| 126 | |
| 127 | public function test_getMetaObjectAuthtoken_has_desc_key(): void { |
| 128 | $result = $this->main->getCore()->getMetaObjectAuthtoken(); |
| 129 | $this->assertArrayHasKey('desc', $result); |
| 130 | } |
| 131 | |
| 132 | public function test_getMetaObjectAuthtoken_has_ticketscanner_key(): void { |
| 133 | $result = $this->main->getCore()->getMetaObjectAuthtoken(); |
| 134 | $this->assertArrayHasKey('ticketscanner', $result); |
| 135 | } |
| 136 | |
| 137 | // ── encodeMetaValuesAndFillObjectAuthtoken ────────────────────── |
| 138 | |
| 139 | public function test_encodeMetaValuesAndFillObjectAuthtoken_empty_string(): void { |
| 140 | $result = $this->main->getCore()->encodeMetaValuesAndFillObjectAuthtoken(''); |
| 141 | $this->assertIsArray($result); |
| 142 | $this->assertArrayHasKey('desc', $result); |
| 143 | } |
| 144 | |
| 145 | public function test_encodeMetaValuesAndFillObjectAuthtoken_json_string(): void { |
| 146 | $json = json_encode(['desc' => 'Test description', 'ticketscanner' => ['bound_to_products' => '']]); |
| 147 | $result = $this->main->getCore()->encodeMetaValuesAndFillObjectAuthtoken($json); |
| 148 | $this->assertIsArray($result); |
| 149 | $this->assertEquals('Test description', $result['desc']); |
| 150 | } |
| 151 | } |
| 152 |