Passed
Push — master ( 4d016b...b6e428 )
by Benjamin
02:33
created

APITest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
dl 0
loc 18
rs 10

2 Methods

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