Skip to content

Commit 432c9f3

Browse files
mrleblanc101nlemoine
authored andcommitted
feat: Add post type test
1 parent 691fac5 commit 432c9f3

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

tests/Integration/AdminScreenTest.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,27 @@ public function testRenderPageDropdownOutputsSelectElement(): void
7676
$this->assertStringContainsString('_use_slug', $output);
7777
}
7878

79-
public function testAddPostTypeSubmenusAddsSubmenus(): void
79+
public function testAddPostSubmenusAddsSubmenus(): void
80+
{
81+
$postsPageId = static::factory()->post->create(['post_type' => 'page', 'post_status' => 'publish']);
82+
update_option('page_for_posts', $postsPageId);
83+
84+
$this->acting_as('administrator');
85+
86+
$this->admin->addPostTypeSubmenus();
87+
88+
// Check submenus was added for posts
89+
$postMenuKey = 'edit.php';
90+
$this->assertArrayHasKey($postMenuKey, $GLOBALS['submenu'] ?? []);
91+
}
92+
93+
public function testAddCustomPostTypeSubmenusAddsSubmenus(): void
8094
{
8195
$this->acting_as('administrator');
8296

8397
$this->admin->addPostTypeSubmenus();
8498

85-
// Check submenus were added for at least one post type
99+
// Check submenus were added for at least one custom post type
86100
$bookMenuKey = 'edit.php?post_type=' . self::BOOK_POST_TYPE;
87101
$this->assertArrayHasKey($bookMenuKey, $GLOBALS['submenu'] ?? []);
88102
}

0 commit comments

Comments
 (0)