Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
C
Cron-Control
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
WP Plugins
Cron-Control
Commits
4f66ed20
Commit
4f66ed20
authored
Sep 21, 2017
by
Erick Hitter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPCS fixes
parent
0bc077ff
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
12 deletions
+11
-12
includes/utils.php
includes/utils.php
+5
-5
tests/bootstrap.php
tests/bootstrap.php
+1
-1
tests/tests/class-utils-tests.php
tests/tests/class-utils-tests.php
+5
-6
No files found.
includes/utils.php
View file @
4f66ed20
...
...
@@ -62,12 +62,12 @@ function collapse_events_array( $events, $timestamp = null ) {
/**
* Convert simplified representation of cron events array to the format WordPress expects
*
* @param array $events
* @param array $events
Flattened event list.
* @return array
*/
function
inflate_collapsed_events_array
(
$events
)
{
$inflated
=
array
(
'version'
=>
2
,
// Core versions the cron array; without this, Core will attempt to "upgrade" the value
'version'
=>
2
,
// Core versions the cron array; without this, Core will attempt to "upgrade" the value
.
);
if
(
empty
(
$events
)
)
{
...
...
@@ -75,10 +75,10 @@ function inflate_collapsed_events_array( $events ) {
}
foreach
(
$events
as
$event
)
{
// Object for convenience
// Object for convenience
.
$event
=
(
object
)
$event
;
// Set up where this event belongs in the overall structure
// Set up where this event belongs in the overall structure
.
if
(
!
isset
(
$inflated
[
$event
->
timestamp
]
)
)
{
$inflated
[
$event
->
timestamp
]
=
array
();
}
...
...
@@ -87,7 +87,7 @@ function inflate_collapsed_events_array( $events ) {
$inflated
[
$event
->
timestamp
][
$event
->
action
]
=
array
();
}
// Store this event
// Store this event
.
$inflated
[
$event
->
timestamp
][
$event
->
action
][
$event
->
instance
]
=
$event
->
args
;
}
...
...
tests/bootstrap.php
View file @
4f66ed20
...
...
@@ -19,7 +19,7 @@ require_once $_tests_dir . '/includes/functions.php';
function
_manually_load_plugin
()
{
define
(
'WP_CRON_CONTROL_SECRET'
,
'testtesttest'
);
// Nonsense values to test constraints and aid testing
// Nonsense values to test constraints and aid testing
.
define
(
'CRON_CONTROL_CACHE_BUCKET_SIZE'
,
0
);
define
(
'CRON_CONTROL_MAX_CACHE_BUCKETS'
,
PHP_INT_MAX
/
2
);
...
...
tests/test
-util
s.php
→
tests/test
s/class-utils-test
s.php
View file @
4f66ed20
<?php
/**
*
Class Utils_Test
s
*
Test plugin's utility function
s
*
* @package
Automatti
c_Cron_Control
* @package
a8
c_Cron_Control
*/
namespace
Automattic\WP\Cron_Control\Tests
;
use
Automattic\WP\Cron_Control
;
/**
*
Sample test case.
*
Class Utils_Tests
*/
class
Utils_Tests
extends
\
WP_UnitTestCase
{
/**
...
...
@@ -19,7 +18,7 @@ class Utils_Tests extends \WP_UnitTestCase {
function
setUp
()
{
parent
::
setUp
();
// make sure the schedule is clear
// make sure the schedule is clear
.
_set_cron_array
(
array
()
);
}
...
...
@@ -27,7 +26,7 @@ class Utils_Tests extends \WP_UnitTestCase {
* Clean up after our tests
*/
function
tearDown
()
{
// make sure the schedule is clear
// make sure the schedule is clear
.
_set_cron_array
(
array
()
);
parent
::
tearDown
();
...
...
Write
Preview
Markdown
is supported
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