Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
donnapep committed Jan 14, 2025
1 parent 02c9eea commit e3d50c1
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tests/unit-tests/blocks/test-class-sensei-blocks-initializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ] ] );

Expand Down

0 comments on commit e3d50c1

Please sign in to comment.