'

MKP Base Options Test

We keep all mkp_base options in the WordPress options table. In a multisite network, each site has its own options table.
This code tests that options can be read, written and re-read properly with a variety of option value data types:

  • Boolean True
  • Boolean False
  • Integer
  • String
  • Simple Array
  • Associative Array
  • Nested Associative Array

In this shortcode, we clear the diagnostics table and any pending notifications, do the test and then display any diagnostic output.

mkp_base clear_notifications clear_diagnostics options_test show_diagnostics

Output:

Notifications clearedPerforming Options Test for 29
Testing update of mkp_29_option_test_1 PASSED
Testing update of mkp_29_option_test_2 PASSED
Testing update of mkp_29_option_test_3 PASSED
Testing update of mkp_29_option_test_4 PASSED
Testing update of mkp_29_option_test_5 PASSED
Testing update of mkp_29_option_test_6 PASSED

Diagnostic Logfile Contents

Logfile: /nas/content/live/mkpusaws/wp-content/MKP Plugins_29.log

08/23/19 20:41:43->MKP Plugins: Logfile [/nas/content/live/mkpusaws/wp-content/MKP Plugins_29.log] cleared
08/23/19 20:41:43->MKP Plugins: Doing code=[options_test] name=[options_test] value=[true]
08/23/19 20:41:43->MKP Plugins: mkp_29_option_test_1 PASSED
08/23/19 20:41:43->MKP Plugins: Table Name: [mkpusa_29_notifications]
08/23/19 20:41:43->MKP BASE: Saving Notification type 4[mkp_29_option_test_1 PASSED] to table [mkpusa_29_notifications]
08/23/19 20:41:43->MKP Plugins: Testing update of mkp_29_option_test_1 PASSED

08/23/19 20:41:43->MKP Plugins: mkp_29_option_test_2 PASSED
08/23/19 20:41:43->MKP Plugins: Table Name: [mkpusa_29_notifications]
08/23/19 20:41:43->MKP BASE: Saving Notification type 4[mkp_29_option_test_2 PASSED] to table [mkpusa_29_notifications]
08/23/19 20:41:43->MKP Plugins: Testing update of mkp_29_option_test_2 PASSED

08/23/19 20:41:43->MKP Plugins: mkp_29_option_test_3 PASSED
08/23/19 20:41:43->MKP Plugins: Table Name: [mkpusa_29_notifications]
08/23/19 20:41:43->MKP BASE: Saving Notification type 4[mkp_29_option_test_3 PASSED] to table [mkpusa_29_notifications]
08/23/19 20:41:43->MKP Plugins: Testing update of mkp_29_option_test_3 PASSED

08/23/19 20:41:43->MKP Plugins: mkp_29_option_test_4 PASSED
08/23/19 20:41:43->MKP Plugins: Table Name: [mkpusa_29_notifications]
08/23/19 20:41:43->MKP BASE: Saving Notification type 4[mkp_29_option_test_4 PASSED] to table [mkpusa_29_notifications]
08/23/19 20:41:43->MKP Plugins: Testing update of mkp_29_option_test_4 PASSED

08/23/19 20:41:43->MKP Plugins: mkp_29_option_test_5 PASSED
08/23/19 20:41:43->MKP Plugins: Table Name: [mkpusa_29_notifications]
08/23/19 20:41:43->MKP BASE: Saving Notification type 4[mkp_29_option_test_5 PASSED] to table [mkpusa_29_notifications]
08/23/19 20:41:43->MKP Plugins: Testing update of mkp_29_option_test_5 PASSED

08/23/19 20:41:43->MKP Plugins: mkp_29_option_test_6 PASSED
08/23/19 20:41:43->MKP Plugins: Table Name: [mkpusa_29_notifications]
08/23/19 20:41:43->MKP BASE: Saving Notification type 4[mkp_29_option_test_6 PASSED] to table [mkpusa_29_notifications]
08/23/19 20:41:43->MKP Plugins: Testing update of mkp_29_option_test_6 PASSED

08/23/19 20:41:43->MKP Plugins: Doing code=[show_diagnostics] name=[show_diagnostics] value=[true]