Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
WP Plugins
Cron-Control
Commits
776359ae
Verified
Commit
776359ae
authored
Nov 14, 2016
by
Erick Hitter
Browse files
Test results of `get_option()` to ensure the CPT returns the proper format
parent
67471b86
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test-cron-options-cpt.php
View file @
776359ae
...
...
@@ -37,4 +37,34 @@ class WPCCR_Cron_Options_CPT_Test extends WP_UnitTestCase {
$this
->
assertEquals
(
md5
(
serialize
(
$event
[
'args'
]
)
),
$instance
[
'instance'
]
);
WP_Cron_Control_Revisited_Tests\Utils
::
compare_arrays
(
$event
[
'args'
],
$instance
[
'args'
],
$this
);
}
/**
* Check format of filtered array returned from CPT
*/
function
test_filter_cron_option_get
()
{
$event
=
WP_Cron_Control_Revisited_Tests\Utils
::
create_test_event
();
$cron
=
get_option
(
'cron'
);
// Core versions the cron option (see `_upgrade_cron_array()`)
// Without this in the filtered result, all events continually requeue as Core tries to "upgrade" the option
$this
->
assertArrayHasKey
(
'version'
,
$cron
);
$this
->
assertEquals
(
$cron
[
'version'
],
2
);
// Validate the remaining structure
foreach
(
$cron
as
$timestamp
=>
$timestamp_events
)
{
if
(
!
is_numeric
(
$timestamp
)
)
{
continue
;
}
foreach
(
$timestamp_events
as
$action
=>
$action_instances
)
{
$this
->
assertEquals
(
$action
,
$event
[
'action'
]
);
foreach
(
$action_instances
as
$instance
=>
$instance_args
)
{
$this
->
assertArrayHasKey
(
'schedule'
,
$instance_args
);
$this
->
assertArrayHasKey
(
'args'
,
$instance_args
);
}
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment