Passed
Branch master (d2d71f)
by Benjamin
02:28
created

Test_Case   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 23
rs 10
wmc 2
1
<?php
2
/**
3
 * Class TestCase
4
 *
5
 * @package WPSiteMonitor
6
 * @since 1.0.0
7
 */
8
9
namespace Tests;
10
11
use WP_UnitTestCase;
12
13
/**
14
 * Base test case.
15
 */
16
class Test_Case extends WP_UnitTestCase {
17
18
	const OPTION_NAME = 'wp_site_monitor_enable';
19
	const OPTION_GROUP = 'wp_site_monitor';
20
	const API_NAMESPACE = 'wp-site-monitor/v1';
21
22
	/**
23
	 * Assert that the plugin is being loaded by WordPress.
24
	 */
25
	public function test_plugin_is_loaded() {
26
		$this->assertTrue( defined( 'WP_SITE_MONITOR_VERSION' ) );
27
		$this->assertTrue( defined( 'WPINC' ) );
28
		$this->assertTrue( defined( 'WPSM_FILE' ) );
29
		$this->assertTrue( defined( 'WPSM_PATH' ) );
30
	}
31
32
	/**
33
	 * Set current WordPress user.
34
	 *
35
	 * @param string $role
36
	 */
37
	protected function log_in( $role = 'administrator' ) {
38
		wp_set_current_user( self::factory()->user->create( array( 'role' => $role ) ) );
39
	}
40
}
41