Passed
Push — master ( 5769dc...415062 )
by Joe
02:27
created

CloudlinuxTest   A

Complexity

Total Complexity 19

Size/Duplication

Total Lines 214
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 19
lcom 1
cbo 1
dl 0
loc 214
rs 10
c 0
b 0
f 0

18 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 2
A tearDown() 0 3 1
A testTestEnvironment() 0 5 1
A testGetcurlpage() 0 4 1
A testStatus() 0 10 1
A testAvailability() 0 7 1
A testCheck() 0 7 1
A testRegister() 0 7 1
A testRest_remove() 0 7 1
A testRemove() 0 7 1
A testRest_list() 0 7 1
A testAuthToken() 0 7 1
A testLicense() 0 7 1
A testRemove_license() 0 7 1
A testIs_licensed() 0 7 1
A testXml_is_licensed() 0 7 1
A testLicense_list() 0 7 1
A testReconcile() 0 7 1
1
<?php
2
3
namespace Detain\Cloudlinux\Tests;
4
5
use Detain\Cloudlinux\Cloudlinux;
6
7
/**
8
 * Generated by PHPUnit_SkeletonGenerator on 2017-05-31 at 10:07:32.
9
 */
10
class CloudlinuxTest extends \PHPUnit_Framework_TestCase
11
{
12
	/**
13
	 * @var Cloudlinux
14
	 */
15
	protected $object;
16
17
	/**
18
	 * Sets up the fixture, for example, opens a network connection.
19
	 * This method is called before a test is executed.
20
	 */
21
	protected function setUp()
22
	{
23
		if (file_exists(__DIR__.'/.env')) {
24
			$dotenv = new Dotenv\Dotenv(__DIR__);
25
			$dotenv->load();
26
		}
27
		$this->object = new Cloudlinux(getenv('CLOUDLINUX_LOGIN'), getenv('CLOUDLINUX_KEY'));
28
	}
29
30
	/**
31
	 * Tears down the fixture, for example, closes a network connection.
32
	 * This method is called after a test is executed.
33
	 */
34
	protected function tearDown()
35
	{
36
	}
37
38
	public function testTestEnvironment() {
39
		$CLOUDLINUX_LOGIN = getenv('CLOUDLINUX_LOGIN');
40
		$this->assertNotEmpty($CLOUDLINUX_LOGIN, 'No environment variables! Copy .env.example -> .env and fill out your account details.');
41
		$this->assertInstanceOf('\Detain\Cloudlinux\Cloudlinux', $this->object);
42
	}
43
44
	/**
45
	 * @covers Detain\Cloudlinux\Cloudlinux::getcurlpage
46
	 * @todo   Implement testLog().
47
	 */
48
	public function testGetcurlpage()
49
	{
50
		$this->assertRegExp('/<html/i', $this->object->getcurlpage('https://cln.cloudlinux.com'));
51
	}
52
53
	/**
54
	 * @covers Detain\Cloudlinux\Cloudlinux::status
55
	 * @todo   Implement testStatus().
56
	 */
57
	public function testStatus()
58
	{
59
		//Array( [success] => 1  [data] => Array([db_rhn_online] => 1  [db_clweb_connected] => 1   [db_clweb_online] => 1  [ip_server_reg] => 1  [xmlrpc] => 1  [rhn_overloaded] =>   [db_rhn_connected] => 1  ) )
0 ignored issues
show
Unused Code Comprehensibility introduced by
52% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
60
		// Remove the following lines when you implement this test.
61
		$status = $this->object->status();
62
		$this->assertTrue(is_array($status));
63
		$this->assertArrayHasKey('success', $status, 'Missing success status in response');
64
		$this->assertArrayHasKey('data', $status, 'Missing data in response');
65
		$this->assertEquals($status['data']['ip_server_reg'], 1, 'IP Server is not up');
66
	}
67
68
	/**
69
	 * @covers Detain\Cloudlinux\Cloudlinux::availability
70
	 * @todo   Implement testAvailability().
71
	 */
72
	public function testAvailability()
73
	{
74
		// Remove the following lines when you implement this test.
75
		$this->markTestIncomplete(
76
			'This test has not been implemented yet.'
77
		);
78
	}
79
80
	/**
81
	 * @covers Detain\Cloudlinux\Cloudlinux::check
82
	 * @todo   Implement testCheck().
83
	 */
84
	public function testCheck()
85
	{
86
		// Remove the following lines when you implement this test.
87
		$this->markTestIncomplete(
88
			'This test has not been implemented yet.'
89
		);
90
	}
91
92
	/**
93
	 * @covers Detain\Cloudlinux\Cloudlinux::register
94
	 * @todo   Implement testRegister().
95
	 */
96
	public function testRegister()
97
	{
98
		// Remove the following lines when you implement this test.
99
		$this->markTestIncomplete(
100
			'This test has not been implemented yet.'
101
		);
102
	}
103
104
	/**
105
	 * @covers Detain\Cloudlinux\Cloudlinux::rest_remove
106
	 * @todo   Implement testRest_remove().
107
	 */
108
	public function testRest_remove()
109
	{
110
		// Remove the following lines when you implement this test.
111
		$this->markTestIncomplete(
112
			'This test has not been implemented yet.'
113
		);
114
	}
115
116
	/**
117
	 * @covers Detain\Cloudlinux\Cloudlinux::remove
118
	 * @todo   Implement testRemove().
119
	 */
120
	public function testRemove()
121
	{
122
		// Remove the following lines when you implement this test.
123
		$this->markTestIncomplete(
124
			'This test has not been implemented yet.'
125
		);
126
	}
127
128
	/**
129
	 * @covers Detain\Cloudlinux\Cloudlinux::rest_list
130
	 * @todo   Implement testRest_list().
131
	 */
132
	public function testRest_list()
133
	{
134
		// Remove the following lines when you implement this test.
135
		$this->markTestIncomplete(
136
			'This test has not been implemented yet.'
137
		);
138
	}
139
140
	/**
141
	 * @covers Detain\Cloudlinux\Cloudlinux::authToken
142
	 * @todo   Implement testAuthToken().
143
	 */
144
	public function testAuthToken()
145
	{
146
		// Remove the following lines when you implement this test.
147
		$this->markTestIncomplete(
148
			'This test has not been implemented yet.'
149
		);
150
	}
151
152
	/**
153
	 * @covers Detain\Cloudlinux\Cloudlinux::license
154
	 * @todo   Implement testLicense().
155
	 */
156
	public function testLicense()
157
	{
158
		// Remove the following lines when you implement this test.
159
		$this->markTestIncomplete(
160
			'This test has not been implemented yet.'
161
		);
162
	}
163
164
	/**
165
	 * @covers Detain\Cloudlinux\Cloudlinux::remove_license
166
	 * @todo   Implement testRemove_license().
167
	 */
168
	public function testRemove_license()
169
	{
170
		// Remove the following lines when you implement this test.
171
		$this->markTestIncomplete(
172
			'This test has not been implemented yet.'
173
		);
174
	}
175
176
	/**
177
	 * @covers Detain\Cloudlinux\Cloudlinux::is_licensed
178
	 * @todo   Implement testIs_licensed().
179
	 */
180
	public function testIs_licensed()
181
	{
182
		// Remove the following lines when you implement this test.
183
		$this->markTestIncomplete(
184
			'This test has not been implemented yet.'
185
		);
186
	}
187
188
	/**
189
	 * @covers Detain\Cloudlinux\Cloudlinux::xml_is_licensed
190
	 * @todo   Implement testXml_is_licensed().
191
	 */
192
	public function testXml_is_licensed()
193
	{
194
		// Remove the following lines when you implement this test.
195
		$this->markTestIncomplete(
196
			'This test has not been implemented yet.'
197
		);
198
	}
199
200
	/**
201
	 * @covers Detain\Cloudlinux\Cloudlinux::license_list
202
	 * @todo   Implement testLicense_list().
203
	 */
204
	public function testLicense_list()
205
	{
206
		// Remove the following lines when you implement this test.
207
		$this->markTestIncomplete(
208
			'This test has not been implemented yet.'
209
		);
210
	}
211
212
	/**
213
	 * @covers Detain\Cloudlinux\Cloudlinux::reconcile
214
	 * @todo   Implement testReconcile().
215
	 */
216
	public function testReconcile()
217
	{
218
		// Remove the following lines when you implement this test.
219
		$this->markTestIncomplete(
220
			'This test has not been implemented yet.'
221
		);
222
	}
223
}
224