diff --git a/tests/unit-tests/blocks/test-class-sensei-blocks-initializer.php b/tests/unit-tests/blocks/test-class-sensei-blocks-initializer.php index 0a13483ec7..4cb7bdcea1 100644 --- a/tests/unit-tests/blocks/test-class-sensei-blocks-initializer.php +++ b/tests/unit-tests/blocks/test-class-sensei-blocks-initializer.php @@ -105,7 +105,24 @@ public function testMaybeInitializeBlocks_WhenInAdminOnGutenbergEditSiteScreen_I $initializer_mock->maybe_initialize_blocks(); } - public function testMaybeInitializeBlocks_WhenInAdminOnNewPostScreenAndHasCorrectPostType_InitializesBlocks() { + public function testMaybeInitializeBlocks_WhenInAdminOnNewPostScreen_InitializesBlocks() { + /* Arrange */ + $initializer_mock = $this->getMockForAbstractClass( Sensei_Blocks_Initializer::class ); + + set_current_screen( 'post' ); + + global $pagenow; + $pagenow = 'post-new.php'; + + /* Assert */ + $initializer_mock->expects( $this->once() ) + ->method( 'initialize_blocks' ); + + /* Act */ + $initializer_mock->maybe_initialize_blocks(); + } + + public function testMaybeInitializeBlocks_WhenInAdminOnNewCourseScreenAndHasCorrectPostType_InitializesBlocks() { /* Arrange */ $initializer_mock = $this->getMockForAbstractClass( Sensei_Blocks_Initializer::class, [ [ 'course' ] ] );