Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leonidasmi committed Sep 17, 2024
1 parent fada9dd commit 0640e14
Showing 1 changed file with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static function register_hooks_provider() {
'action_times' => 0,
],
'On dashboard page' => [
'current_page' => 'wpseo_page_new_dashboard',
'current_page' => 'wpseo_dashboard',
'action_times' => 1,
],
];
Expand Down Expand Up @@ -173,19 +173,25 @@ public function test_register_hooks_on_dashboard_page( $current_page, $action_ti
public function test_add_page() {
$pages = $this->instance->add_page(
[
[ 'page1', '', 'Page 1', 'manage_options', 'page1', [ $this, 'display_page' ] ],
[ 'page2', '', 'Page 2', 'manage_options', 'page2', [ $this, 'display_page' ] ],
[ 'page3', '', 'Page 3', 'manage_options', 'page3', [ $this, 'display_page' ] ],
[ 'page1', '', 'Page 1', 'manage_options', 'page1', [ 'custom_display_page' ] ],
[ 'page2', '', 'Page 2', 'manage_options', 'page2', [ 'custom_display_page' ] ],
[ 'page3', '', 'Page 3', 'manage_options', 'page3', [ 'custom_display_page' ] ],
]
);

// Assert that the new page was added at index 3.
$this->assertEquals( 'wpseo_dashboard', $pages[3][0] );
// Assert that the new page was added at index 0.
$this->assertEquals( 'wpseo_dashboard', $pages[0][0] );
$this->assertEquals( 'page3', $pages[3][0] );
$this->assertEquals( '', $pages[0][1] );
$this->assertEquals( '', $pages[3][1] );
$this->assertEquals( 'New dashboard', $pages[3][2] );
$this->assertEquals( 'wpseo_manage_options', $pages[3][3] );
$this->assertEquals( 'wpseo_page_new_dashboard', $pages[3][4] );
$this->assertEquals( [ $this->instance, 'display_page' ], $pages[3][5] );
$this->assertEquals( 'General', $pages[0][2] );
$this->assertEquals( 'Page 3', $pages[3][2] );
$this->assertEquals( 'wpseo_manage_options', $pages[0][3] );
$this->assertEquals( 'manage_options', $pages[3][3] );
$this->assertEquals( 'wpseo_dashboard', $pages[0][4] );
$this->assertEquals( 'page3', $pages[3][4] );
$this->assertEquals( [ $this->instance, 'display_page' ], $pages[0][5] );
$this->assertEquals( [ 'custom_display_page' ], $pages[3][5] );
}

/**
Expand Down

0 comments on commit 0640e14

Please sign in to comment.