Passed
Push — master ( 811721...96a06a )
by Benjamin
02:26
created

APITest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A test_rest_api_plugin_route_exists() 0 3 1
A test_wp_version_endpoint_exists() 0 3 1
1
<?php
2
/**
3
 * Class APITest
4
 *
5
 * @package WPSiteMonitor
6
 * @since 1.0.0
7
 */
8
9
use Tests\Test_Case;
10
11
/**
12
 * API test case.
13
 */
14
class APITest extends Test_Case {
15
16
	protected $server;
17
18
	public function setUp() {
19
		parent::setUp();
20
21
		$this->server = rest_get_server();
22
	}
23
24
	/**
25
	 * Assert that REST API route for the plugin exist.
26
	 */
27
	public function test_rest_api_plugin_route_exists() {
28
		$routes = $this->server->get_routes();
29
		$this->assertArrayHasKey( self::API_NAMESPACE, $routes );
30
	}
31
32
	/**
33
	 * Assert that WordPress version endpoint exists.
34
	 */
35
	public function test_wp_version_endpoint_exists() {
36
		$routes = $this->server->get_routes();
37
		$this->assertArrayHasKey( self::API_NAMESPACE . '/wp-version', $routes );
38
	}
39
}
40