@@ -5,30 +5,30 @@ |
||
5 | 5 | */ |
6 | 6 | class HasClassCheck implements EnvironmentCheck |
7 | 7 | { |
8 | - /** |
|
9 | - * @var string |
|
10 | - */ |
|
11 | - protected $className; |
|
8 | + /** |
|
9 | + * @var string |
|
10 | + */ |
|
11 | + protected $className; |
|
12 | 12 | |
13 | - /** |
|
14 | - * @param string $className The name of the class to look for. |
|
15 | - */ |
|
16 | - public function __construct($className) |
|
17 | - { |
|
18 | - $this->className = $className; |
|
19 | - } |
|
13 | + /** |
|
14 | + * @param string $className The name of the class to look for. |
|
15 | + */ |
|
16 | + public function __construct($className) |
|
17 | + { |
|
18 | + $this->className = $className; |
|
19 | + } |
|
20 | 20 | |
21 | - /** |
|
22 | - * @inheritdoc |
|
23 | - * |
|
24 | - * @return array |
|
25 | - */ |
|
26 | - public function check() |
|
27 | - { |
|
28 | - if (class_exists($this->className)) { |
|
29 | - return array(EnvironmentCheck::OK, 'Class ' . $this->className.' exists'); |
|
30 | - } else { |
|
31 | - return array(EnvironmentCheck::ERROR, 'Class ' . $this->className.' doesn\'t exist'); |
|
32 | - } |
|
33 | - } |
|
21 | + /** |
|
22 | + * @inheritdoc |
|
23 | + * |
|
24 | + * @return array |
|
25 | + */ |
|
26 | + public function check() |
|
27 | + { |
|
28 | + if (class_exists($this->className)) { |
|
29 | + return array(EnvironmentCheck::OK, 'Class ' . $this->className.' exists'); |
|
30 | + } else { |
|
31 | + return array(EnvironmentCheck::ERROR, 'Class ' . $this->className.' doesn\'t exist'); |
|
32 | + } |
|
33 | + } |
|
34 | 34 | } |
@@ -26,9 +26,9 @@ |
||
26 | 26 | public function check() |
27 | 27 | { |
28 | 28 | if (class_exists($this->className)) { |
29 | - return array(EnvironmentCheck::OK, 'Class ' . $this->className.' exists'); |
|
29 | + return array(EnvironmentCheck::OK, 'Class '.$this->className.' exists'); |
|
30 | 30 | } else { |
31 | - return array(EnvironmentCheck::ERROR, 'Class ' . $this->className.' doesn\'t exist'); |
|
31 | + return array(EnvironmentCheck::ERROR, 'Class '.$this->className.' doesn\'t exist'); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | } |
@@ -5,30 +5,30 @@ |
||
5 | 5 | */ |
6 | 6 | class HasFunctionCheck implements EnvironmentCheck |
7 | 7 | { |
8 | - /** |
|
9 | - * @var string |
|
10 | - */ |
|
11 | - protected $functionName; |
|
8 | + /** |
|
9 | + * @var string |
|
10 | + */ |
|
11 | + protected $functionName; |
|
12 | 12 | |
13 | - /** |
|
14 | - * @param string $functionName The name of the function to look for. |
|
15 | - */ |
|
16 | - public function __construct($functionName) |
|
17 | - { |
|
18 | - $this->functionName = $functionName; |
|
19 | - } |
|
13 | + /** |
|
14 | + * @param string $functionName The name of the function to look for. |
|
15 | + */ |
|
16 | + public function __construct($functionName) |
|
17 | + { |
|
18 | + $this->functionName = $functionName; |
|
19 | + } |
|
20 | 20 | |
21 | - /** |
|
22 | - * @inheritdoc |
|
23 | - * |
|
24 | - * @return array |
|
25 | - */ |
|
26 | - public function check() |
|
27 | - { |
|
28 | - if (function_exists($this->functionName)) { |
|
29 | - return array(EnvironmentCheck::OK, $this->functionName.'() exists'); |
|
30 | - } else { |
|
31 | - return array(EnvironmentCheck::ERROR, $this->functionName.'() doesn\'t exist'); |
|
32 | - } |
|
33 | - } |
|
21 | + /** |
|
22 | + * @inheritdoc |
|
23 | + * |
|
24 | + * @return array |
|
25 | + */ |
|
26 | + public function check() |
|
27 | + { |
|
28 | + if (function_exists($this->functionName)) { |
|
29 | + return array(EnvironmentCheck::OK, $this->functionName.'() exists'); |
|
30 | + } else { |
|
31 | + return array(EnvironmentCheck::ERROR, $this->functionName.'() doesn\'t exist'); |
|
32 | + } |
|
33 | + } |
|
34 | 34 | } |
@@ -7,50 +7,50 @@ |
||
7 | 7 | */ |
8 | 8 | class SolrIndexCheck implements EnvironmentCheck |
9 | 9 | { |
10 | - /** |
|
11 | - * @var null|string |
|
12 | - */ |
|
13 | - protected $indexClass; |
|
10 | + /** |
|
11 | + * @var null|string |
|
12 | + */ |
|
13 | + protected $indexClass; |
|
14 | 14 | |
15 | - /** |
|
16 | - * @param string $indexClass Limit the index checks to the specified class and all its subclasses. |
|
17 | - */ |
|
18 | - public function __construct($indexClass = null) |
|
19 | - { |
|
20 | - $this->indexClass = $indexClass; |
|
21 | - } |
|
15 | + /** |
|
16 | + * @param string $indexClass Limit the index checks to the specified class and all its subclasses. |
|
17 | + */ |
|
18 | + public function __construct($indexClass = null) |
|
19 | + { |
|
20 | + $this->indexClass = $indexClass; |
|
21 | + } |
|
22 | 22 | |
23 | - /** |
|
24 | - * @inheritdoc |
|
25 | - * |
|
26 | - * @return array |
|
27 | - */ |
|
28 | - public function check() |
|
29 | - { |
|
30 | - $brokenCores = array(); |
|
23 | + /** |
|
24 | + * @inheritdoc |
|
25 | + * |
|
26 | + * @return array |
|
27 | + */ |
|
28 | + public function check() |
|
29 | + { |
|
30 | + $brokenCores = array(); |
|
31 | 31 | |
32 | - if (!class_exists('Solr')) { |
|
33 | - return array( |
|
34 | - EnvironmentCheck::ERROR, |
|
35 | - 'Class `Solr` not found. Is the fulltextsearch module installed?' |
|
36 | - ); |
|
37 | - } |
|
32 | + if (!class_exists('Solr')) { |
|
33 | + return array( |
|
34 | + EnvironmentCheck::ERROR, |
|
35 | + 'Class `Solr` not found. Is the fulltextsearch module installed?' |
|
36 | + ); |
|
37 | + } |
|
38 | 38 | |
39 | - $service = Solr::service(); |
|
40 | - foreach (Solr::get_indexes($this->indexClass) as $index) { |
|
41 | - $core = $index->getIndexName(); |
|
42 | - if (!$service->coreIsActive($core)) { |
|
43 | - $brokenCores[] = $core; |
|
44 | - } |
|
45 | - } |
|
39 | + $service = Solr::service(); |
|
40 | + foreach (Solr::get_indexes($this->indexClass) as $index) { |
|
41 | + $core = $index->getIndexName(); |
|
42 | + if (!$service->coreIsActive($core)) { |
|
43 | + $brokenCores[] = $core; |
|
44 | + } |
|
45 | + } |
|
46 | 46 | |
47 | - if (!empty($brokenCores)) { |
|
48 | - return array( |
|
49 | - EnvironmentCheck::ERROR, |
|
50 | - 'The following indexes are unavailable: ' . implode($brokenCores, ', ') |
|
51 | - ); |
|
52 | - } |
|
47 | + if (!empty($brokenCores)) { |
|
48 | + return array( |
|
49 | + EnvironmentCheck::ERROR, |
|
50 | + 'The following indexes are unavailable: ' . implode($brokenCores, ', ') |
|
51 | + ); |
|
52 | + } |
|
53 | 53 | |
54 | - return array(EnvironmentCheck::OK, 'Expected indexes are available.'); |
|
55 | - } |
|
54 | + return array(EnvironmentCheck::OK, 'Expected indexes are available.'); |
|
55 | + } |
|
56 | 56 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | if (!empty($brokenCores)) { |
48 | 48 | return array( |
49 | 49 | EnvironmentCheck::ERROR, |
50 | - 'The following indexes are unavailable: ' . implode($brokenCores, ', ') |
|
50 | + 'The following indexes are unavailable: '.implode($brokenCores, ', ') |
|
51 | 51 | ); |
52 | 52 | } |
53 | 53 |
@@ -7,52 +7,52 @@ |
||
7 | 7 | */ |
8 | 8 | class URLCheck implements EnvironmentCheck |
9 | 9 | { |
10 | - /** |
|
11 | - * @var string |
|
12 | - */ |
|
13 | - protected $url; |
|
10 | + /** |
|
11 | + * @var string |
|
12 | + */ |
|
13 | + protected $url; |
|
14 | 14 | |
15 | - /** |
|
16 | - * @var string |
|
17 | - */ |
|
18 | - protected $testString; |
|
15 | + /** |
|
16 | + * @var string |
|
17 | + */ |
|
18 | + protected $testString; |
|
19 | 19 | |
20 | - /* |
|
20 | + /* |
|
21 | 21 | * @param string $url The URL to check, relative to the site (homepage is ''). |
22 | 22 | * @param string $testString An optional piece of text to search for on the homepage. |
23 | 23 | */ |
24 | - public function __construct($url = '', $testString = '') |
|
25 | - { |
|
26 | - $this->url = $url; |
|
27 | - $this->testString = $testString; |
|
28 | - } |
|
24 | + public function __construct($url = '', $testString = '') |
|
25 | + { |
|
26 | + $this->url = $url; |
|
27 | + $this->testString = $testString; |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * @inheritdoc |
|
32 | - * |
|
33 | - * @return array |
|
34 | - * |
|
35 | - * @throws SS_HTTPResponse_Exception |
|
36 | - */ |
|
37 | - public function check() |
|
38 | - { |
|
39 | - $response = Director::test($this->url); |
|
30 | + /** |
|
31 | + * @inheritdoc |
|
32 | + * |
|
33 | + * @return array |
|
34 | + * |
|
35 | + * @throws SS_HTTPResponse_Exception |
|
36 | + */ |
|
37 | + public function check() |
|
38 | + { |
|
39 | + $response = Director::test($this->url); |
|
40 | 40 | |
41 | - if ($response->getStatusCode() != 200) { |
|
42 | - return array( |
|
43 | - EnvironmentCheck::ERROR, |
|
44 | - sprintf('Error retrieving "%s" (Code: %d)', $this->url, $response->getStatusCode()) |
|
45 | - ); |
|
46 | - } elseif ($this->testString && (strpos($response->getBody(), $this->testString) === false)) { |
|
47 | - return array( |
|
48 | - EnvironmentCheck::WARNING, |
|
49 | - sprintf('Success retrieving "%s", but string "%s" not found', $this->url, $this->testString) |
|
50 | - ); |
|
51 | - } else { |
|
52 | - return array( |
|
53 | - EnvironmentCheck::OK, |
|
54 | - sprintf('Success retrieving "%s"', $this->url) |
|
55 | - ); |
|
56 | - } |
|
57 | - } |
|
41 | + if ($response->getStatusCode() != 200) { |
|
42 | + return array( |
|
43 | + EnvironmentCheck::ERROR, |
|
44 | + sprintf('Error retrieving "%s" (Code: %d)', $this->url, $response->getStatusCode()) |
|
45 | + ); |
|
46 | + } elseif ($this->testString && (strpos($response->getBody(), $this->testString) === false)) { |
|
47 | + return array( |
|
48 | + EnvironmentCheck::WARNING, |
|
49 | + sprintf('Success retrieving "%s", but string "%s" not found', $this->url, $this->testString) |
|
50 | + ); |
|
51 | + } else { |
|
52 | + return array( |
|
53 | + EnvironmentCheck::OK, |
|
54 | + sprintf('Success retrieving "%s"', $this->url) |
|
55 | + ); |
|
56 | + } |
|
57 | + } |
|
58 | 58 | } |
@@ -5,15 +5,15 @@ |
||
5 | 5 | */ |
6 | 6 | class DatabaseCheckTest extends SapphireTest |
7 | 7 | { |
8 | - public function testCheckReportsValidConnection() |
|
9 | - { |
|
10 | - $check = new DatabaseCheck(); |
|
8 | + public function testCheckReportsValidConnection() |
|
9 | + { |
|
10 | + $check = new DatabaseCheck(); |
|
11 | 11 | |
12 | - $expected = array( |
|
13 | - EnvironmentCheck::OK, |
|
14 | - '', |
|
15 | - ); |
|
12 | + $expected = array( |
|
13 | + EnvironmentCheck::OK, |
|
14 | + '', |
|
15 | + ); |
|
16 | 16 | |
17 | - $this->assertEquals($expected, $check->check()); |
|
18 | - } |
|
17 | + $this->assertEquals($expected, $check->check()); |
|
18 | + } |
|
19 | 19 | } |
@@ -5,17 +5,17 @@ |
||
5 | 5 | */ |
6 | 6 | class ExternalURLCheckTest extends SapphireTest |
7 | 7 | { |
8 | - public function testCheckReportsMissingPages() |
|
9 | - { |
|
10 | - $this->markTestSkipped('ExternalURLCheck seems faulty on some systems'); |
|
8 | + public function testCheckReportsMissingPages() |
|
9 | + { |
|
10 | + $this->markTestSkipped('ExternalURLCheck seems faulty on some systems'); |
|
11 | 11 | |
12 | - $check = new ExternalURLCheck('http://missing-site/'); |
|
12 | + $check = new ExternalURLCheck('http://missing-site/'); |
|
13 | 13 | |
14 | - $expected = array( |
|
15 | - EnvironmentCheck::ERROR, |
|
16 | - 'Success retrieving "http://missing-site/" (Code: 404)', |
|
17 | - ); |
|
14 | + $expected = array( |
|
15 | + EnvironmentCheck::ERROR, |
|
16 | + 'Success retrieving "http://missing-site/" (Code: 404)', |
|
17 | + ); |
|
18 | 18 | |
19 | - $this->assertEquals($expected, $check->check()); |
|
20 | - } |
|
19 | + $this->assertEquals($expected, $check->check()); |
|
20 | + } |
|
21 | 21 | } |
@@ -5,24 +5,24 @@ |
||
5 | 5 | */ |
6 | 6 | class FileWritableCheckTest extends SapphireTest |
7 | 7 | { |
8 | - public function testCheckReportsWritablePaths() |
|
9 | - { |
|
10 | - $check = new FileWriteableCheck(TEMP_FOLDER); |
|
8 | + public function testCheckReportsWritablePaths() |
|
9 | + { |
|
10 | + $check = new FileWriteableCheck(TEMP_FOLDER); |
|
11 | 11 | |
12 | - $expected = array( |
|
13 | - EnvironmentCheck::OK, |
|
14 | - '', |
|
15 | - ); |
|
12 | + $expected = array( |
|
13 | + EnvironmentCheck::OK, |
|
14 | + '', |
|
15 | + ); |
|
16 | 16 | |
17 | - $this->assertEquals($expected, $check->check()); |
|
18 | - } |
|
17 | + $this->assertEquals($expected, $check->check()); |
|
18 | + } |
|
19 | 19 | |
20 | - public function testCheckReportsNonWritablePaths() |
|
21 | - { |
|
22 | - $check = new FileWriteableCheck('/var'); |
|
20 | + public function testCheckReportsNonWritablePaths() |
|
21 | + { |
|
22 | + $check = new FileWriteableCheck('/var'); |
|
23 | 23 | |
24 | - $result = $check->check(); |
|
24 | + $result = $check->check(); |
|
25 | 25 | |
26 | - $this->assertEquals(EnvironmentCheck::ERROR, $result[0]); |
|
27 | - } |
|
26 | + $this->assertEquals(EnvironmentCheck::ERROR, $result[0]); |
|
27 | + } |
|
28 | 28 | } |
@@ -5,27 +5,27 @@ |
||
5 | 5 | */ |
6 | 6 | class HasClassCheckTest extends SapphireTest |
7 | 7 | { |
8 | - public function testCheckReportsMissingClasses() |
|
9 | - { |
|
10 | - $check = new HasClassCheck('foo'); |
|
8 | + public function testCheckReportsMissingClasses() |
|
9 | + { |
|
10 | + $check = new HasClassCheck('foo'); |
|
11 | 11 | |
12 | - $expected = array( |
|
13 | - EnvironmentCheck::ERROR, |
|
14 | - 'Class foo doesn\'t exist', |
|
15 | - ); |
|
12 | + $expected = array( |
|
13 | + EnvironmentCheck::ERROR, |
|
14 | + 'Class foo doesn\'t exist', |
|
15 | + ); |
|
16 | 16 | |
17 | - $this->assertEquals($expected, $check->check()); |
|
18 | - } |
|
17 | + $this->assertEquals($expected, $check->check()); |
|
18 | + } |
|
19 | 19 | |
20 | - public function testCheckReportsFoundClasses() |
|
21 | - { |
|
22 | - $check = new HasClassCheck('stdClass'); |
|
20 | + public function testCheckReportsFoundClasses() |
|
21 | + { |
|
22 | + $check = new HasClassCheck('stdClass'); |
|
23 | 23 | |
24 | - $expected = array( |
|
25 | - EnvironmentCheck::OK, |
|
26 | - 'Class stdClass exists', |
|
27 | - ); |
|
24 | + $expected = array( |
|
25 | + EnvironmentCheck::OK, |
|
26 | + 'Class stdClass exists', |
|
27 | + ); |
|
28 | 28 | |
29 | - $this->assertEquals($expected, $check->check()); |
|
30 | - } |
|
29 | + $this->assertEquals($expected, $check->check()); |
|
30 | + } |
|
31 | 31 | } |
@@ -5,27 +5,27 @@ |
||
5 | 5 | */ |
6 | 6 | class HasFunctionCheckTest extends SapphireTest |
7 | 7 | { |
8 | - public function testCheckReportsMissingFunctions() |
|
9 | - { |
|
10 | - $check = new HasFunctionCheck('foo'); |
|
8 | + public function testCheckReportsMissingFunctions() |
|
9 | + { |
|
10 | + $check = new HasFunctionCheck('foo'); |
|
11 | 11 | |
12 | - $expected = array( |
|
13 | - EnvironmentCheck::ERROR, |
|
14 | - 'foo() doesn\'t exist', |
|
15 | - ); |
|
12 | + $expected = array( |
|
13 | + EnvironmentCheck::ERROR, |
|
14 | + 'foo() doesn\'t exist', |
|
15 | + ); |
|
16 | 16 | |
17 | - $this->assertEquals($expected, $check->check()); |
|
18 | - } |
|
17 | + $this->assertEquals($expected, $check->check()); |
|
18 | + } |
|
19 | 19 | |
20 | - public function testCheckReportsFoundFunctions() |
|
21 | - { |
|
22 | - $check = new HasFunctionCheck('class_exists'); |
|
20 | + public function testCheckReportsFoundFunctions() |
|
21 | + { |
|
22 | + $check = new HasFunctionCheck('class_exists'); |
|
23 | 23 | |
24 | - $expected = array( |
|
25 | - EnvironmentCheck::OK, |
|
26 | - 'class_exists() exists', |
|
27 | - ); |
|
24 | + $expected = array( |
|
25 | + EnvironmentCheck::OK, |
|
26 | + 'class_exists() exists', |
|
27 | + ); |
|
28 | 28 | |
29 | - $this->assertEquals($expected, $check->check()); |
|
30 | - } |
|
29 | + $this->assertEquals($expected, $check->check()); |
|
30 | + } |
|
31 | 31 | } |