Completed
Push — master ( 790d30...8429c0 )
by Benjamin
05:11 queued 35s
created

SettingsPageTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
/**
3
 * Class SettingsPageTest
4
 *
5
 * @package WPSiteMonitor
6
 * @since 1.0.0
7
 */
8
9
/**
10
 * Settings Page test case.
11
 */
12
class SettingsPageTest extends WP_UnitTestCase {
0 ignored issues
show
Bug introduced by
The type WP_UnitTestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
14
	function setUp() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
15
		parent::setUp();
16
17
		wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
0 ignored issues
show
Bug introduced by
The function wp_set_current_user was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
		/** @scrutinizer ignore-call */ 
18
  wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
Loading history...
18
	}
19
20
	/**
21
	 * Assert that the settings page is added to the settings menu successfully.
22
	 */
23
	function test_settings_page_is_added_to_settings_menu() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
24
		$settings_menu = new \WPSiteMonitor\Settings_Menu();
25
		$settings_menu->display_settings_page();
26
27
		$this->assertEquals( admin_url() . 'options-general.php?page=wp_site_monitor', menu_page_url( 'wp_site_monitor', false ) );
0 ignored issues
show
Bug introduced by
The function admin_url was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
		$this->assertEquals( /** @scrutinizer ignore-call */ admin_url() . 'options-general.php?page=wp_site_monitor', menu_page_url( 'wp_site_monitor', false ) );
Loading history...
Bug introduced by
The function menu_page_url was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
		$this->assertEquals( admin_url() . 'options-general.php?page=wp_site_monitor', /** @scrutinizer ignore-call */ menu_page_url( 'wp_site_monitor', false ) );
Loading history...
28
	}
29
}
30