Skip to content

Commit 8cecc7b

Browse files
authored
Merge branch 'ari/convert-blog-description-to-interactive' into ari/plugin-installer
2 parents 3861030 + 21667a8 commit 8cecc7b

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

classes/class-page-types.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
*/
1313
class Page_Types {
1414

15+
/**
16+
* The page types.
17+
*
18+
* @var array
19+
*/
20+
public static $page_types = [];
21+
1522
/**
1623
* The taxonomy name.
1724
*
@@ -145,9 +152,8 @@ public function maybe_update_terms() {
145152
* @return array
146153
*/
147154
public function get_page_types() {
148-
static $page_types;
149-
if ( null !== $page_types ) {
150-
return $page_types;
155+
if ( null !== static::$page_types ) {
156+
return static::$page_types;
151157
}
152158

153159
$terms = \get_terms(
@@ -158,21 +164,21 @@ public function get_page_types() {
158164
);
159165

160166
if ( ! $terms || \is_wp_error( $terms ) ) {
161-
$page_types = [];
162-
return $page_types;
167+
static::$page_types = [];
168+
return static::$page_types;
163169
}
164170

165-
$page_types = [];
171+
static::$page_types = [];
166172
foreach ( $terms as $term ) {
167-
$page_types[] = [
173+
static::$page_types[] = [
168174
'id' => $term->term_id,
169175
'slug' => $term->slug,
170176
'title' => $term->name,
171177
'description' => $term->description,
172178
];
173179
}
174180

175-
return $page_types;
181+
return static::$page_types;
176182
}
177183

178184
/**

classes/update/class-update-170.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private function make_tasks_interactive() {
4343
$task = \progress_planner()->get_suggested_tasks_db()->get_tasks_by(
4444
[
4545
'task_id' => $task_id,
46-
'post_status' => 'publish',
46+
'post_status' => [ 'publish', 'future' ],
4747
]
4848
);
4949

tests/phpunit/test-class-page-types.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ public function test_maybe_update_terms() {
121121
* @return void
122122
*/
123123
public function test_get_page_types() {
124+
// Reset the page types, before the test.
125+
$page_types_object = \progress_planner()->get_page_types();
126+
$page_types_object::$page_types = null;
127+
124128
$page_types = \progress_planner()->get_page_types()->get_page_types();
125129
$lessons = self::get_lessons();
126130
$this->assertCount( \count( $lessons ), $page_types );

0 commit comments

Comments
 (0)