Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jdevalk committed Dec 10, 2023
1 parent 17cce4a commit 3f9fd27
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion tests/phpunit/helper-functions/test-class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static function set_up_before_class() {
}

/**
* Tests class constructor.
* Tests hooks registration.
*
* @covers Admin::register_hooks
*/
Expand All @@ -42,4 +42,31 @@ public function test_register_hooks() {
$this->assertSame( 10, has_action( 'manage_post_tag_custom_column', [ self::$class_instance, 'manage_tag_columns' ] ), 10, 3 );
$this->assertSame( 10, has_action( 'tag_row_actions', [ self::$class_instance, 'remove_view_action' ] ), 10, 2 );
}

/**
* Tests settings registration.
*
* @covers Admin::register_settings
*/
public function test_register_settings() {
self::$class_instance->register_settings();

global $wp_settings_sections, $wp_settings_fields;

$this->assertArrayHasKey( 'fewer_tags_section', $wp_settings_sections );
$this->assertArrayHasKey( 'joost_min_posts_count', $wp_settings_fields );
}

/**
* Tests display section.
*
* @covers Admin::display_section
*/
public function test_display_section() {
ob_start();
self::$class_instance->display_section();
$output = ob_get_clean();

$this->assertSame( 'Set the minimum number of posts a tag should have to become live on the site and not be redirected to the homepage.', $output );
}
}

0 comments on commit 3f9fd27

Please sign in to comment.