@@ -28,124 +28,124 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | class FileAgeCheck implements EnvironmentCheck |
| 30 | 30 | { |
| 31 | - /** |
|
| 32 | - * @var int |
|
| 33 | - */ |
|
| 34 | - const CHECK_SINGLE = 1; |
|
| 31 | + /** |
|
| 32 | + * @var int |
|
| 33 | + */ |
|
| 34 | + const CHECK_SINGLE = 1; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @var int |
|
| 38 | - */ |
|
| 39 | - const CHECK_ALL = 2; |
|
| 36 | + /** |
|
| 37 | + * @var int |
|
| 38 | + */ |
|
| 39 | + const CHECK_ALL = 2; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Absolute path to a file or folder, compatible with glob(). |
|
| 43 | - * |
|
| 44 | - * @var string |
|
| 45 | - */ |
|
| 46 | - protected $path; |
|
| 41 | + /** |
|
| 42 | + * Absolute path to a file or folder, compatible with glob(). |
|
| 43 | + * |
|
| 44 | + * @var string |
|
| 45 | + */ |
|
| 46 | + protected $path; |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Relative date specification, compatible with strtotime(). |
|
| 50 | - * |
|
| 51 | - * @var string |
|
| 52 | - */ |
|
| 53 | - protected $relativeAge; |
|
| 48 | + /** |
|
| 49 | + * Relative date specification, compatible with strtotime(). |
|
| 50 | + * |
|
| 51 | + * @var string |
|
| 52 | + */ |
|
| 53 | + protected $relativeAge; |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * The function to use for checking file age: so filemtime(), filectime(), or fileatime(). |
|
| 57 | - * |
|
| 58 | - * @var string |
|
| 59 | - */ |
|
| 60 | - protected $checkFn; |
|
| 55 | + /** |
|
| 56 | + * The function to use for checking file age: so filemtime(), filectime(), or fileatime(). |
|
| 57 | + * |
|
| 58 | + * @var string |
|
| 59 | + */ |
|
| 60 | + protected $checkFn; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Constant, check for a single file to match age criteria, or all of them. |
|
| 64 | - * |
|
| 65 | - * @var int |
|
| 66 | - */ |
|
| 67 | - protected $checkType; |
|
| 62 | + /** |
|
| 63 | + * Constant, check for a single file to match age criteria, or all of them. |
|
| 64 | + * |
|
| 65 | + * @var int |
|
| 66 | + */ |
|
| 67 | + protected $checkType; |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Type of comparison (either > or <). |
|
| 71 | - * |
|
| 72 | - * @var string |
|
| 73 | - */ |
|
| 74 | - protected $compareOperand; |
|
| 69 | + /** |
|
| 70 | + * Type of comparison (either > or <). |
|
| 71 | + * |
|
| 72 | + * @var string |
|
| 73 | + */ |
|
| 74 | + protected $compareOperand; |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * @param string $path |
|
| 78 | - * @param string $relativeAge |
|
| 79 | - * @param string $compareOperand |
|
| 80 | - * @param null|int $checkType |
|
| 81 | - * @param string $checkFn |
|
| 82 | - */ |
|
| 83 | - public function __construct($path, $relativeAge, $compareOperand = '>', $checkType = null, $checkFn = 'filemtime') |
|
| 84 | - { |
|
| 85 | - $this->path = $path; |
|
| 86 | - $this->relativeAge = $relativeAge; |
|
| 87 | - $this->checkFn = $checkFn; |
|
| 88 | - $this->checkType = ($checkType) ? $checkType : self::CHECK_SINGLE; |
|
| 89 | - $this->compareOperand = $compareOperand; |
|
| 90 | - } |
|
| 76 | + /** |
|
| 77 | + * @param string $path |
|
| 78 | + * @param string $relativeAge |
|
| 79 | + * @param string $compareOperand |
|
| 80 | + * @param null|int $checkType |
|
| 81 | + * @param string $checkFn |
|
| 82 | + */ |
|
| 83 | + public function __construct($path, $relativeAge, $compareOperand = '>', $checkType = null, $checkFn = 'filemtime') |
|
| 84 | + { |
|
| 85 | + $this->path = $path; |
|
| 86 | + $this->relativeAge = $relativeAge; |
|
| 87 | + $this->checkFn = $checkFn; |
|
| 88 | + $this->checkType = ($checkType) ? $checkType : self::CHECK_SINGLE; |
|
| 89 | + $this->compareOperand = $compareOperand; |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * {@inheritDoc} |
|
| 94 | - * |
|
| 95 | - * @return array |
|
| 96 | - */ |
|
| 97 | - public function check() |
|
| 98 | - { |
|
| 99 | - $cutoffTime = strtotime($this->relativeAge, DBDatetime::now()->Format('U')); |
|
| 100 | - $files = $this->getFiles(); |
|
| 101 | - $invalidFiles = []; |
|
| 102 | - $validFiles = []; |
|
| 103 | - $checkFn = $this->checkFn; |
|
| 104 | - $allValid = true; |
|
| 105 | - if ($files) { |
|
| 106 | - foreach ($files as $file) { |
|
| 107 | - $fileTime = $checkFn($file); |
|
| 108 | - $valid = ($this->compareOperand == '>') ? ($fileTime >= $cutoffTime) : ($fileTime <= $cutoffTime); |
|
| 109 | - if ($valid) { |
|
| 110 | - $validFiles[] = $file; |
|
| 111 | - } else { |
|
| 112 | - $invalidFiles[] = $file; |
|
| 113 | - if ($this->checkType == self::CHECK_ALL) { |
|
| 114 | - return [ |
|
| 115 | - EnvironmentCheck::ERROR, |
|
| 116 | - sprintf( |
|
| 117 | - 'File "%s" doesn\'t match age check (compare %s: %s, actual: %s)', |
|
| 118 | - $file, |
|
| 119 | - $this->compareOperand, |
|
| 120 | - date('c', $cutoffTime), |
|
| 121 | - date('c', $fileTime) |
|
| 122 | - ) |
|
| 123 | - ]; |
|
| 124 | - } |
|
| 125 | - } |
|
| 126 | - } |
|
| 127 | - } |
|
| 92 | + /** |
|
| 93 | + * {@inheritDoc} |
|
| 94 | + * |
|
| 95 | + * @return array |
|
| 96 | + */ |
|
| 97 | + public function check() |
|
| 98 | + { |
|
| 99 | + $cutoffTime = strtotime($this->relativeAge, DBDatetime::now()->Format('U')); |
|
| 100 | + $files = $this->getFiles(); |
|
| 101 | + $invalidFiles = []; |
|
| 102 | + $validFiles = []; |
|
| 103 | + $checkFn = $this->checkFn; |
|
| 104 | + $allValid = true; |
|
| 105 | + if ($files) { |
|
| 106 | + foreach ($files as $file) { |
|
| 107 | + $fileTime = $checkFn($file); |
|
| 108 | + $valid = ($this->compareOperand == '>') ? ($fileTime >= $cutoffTime) : ($fileTime <= $cutoffTime); |
|
| 109 | + if ($valid) { |
|
| 110 | + $validFiles[] = $file; |
|
| 111 | + } else { |
|
| 112 | + $invalidFiles[] = $file; |
|
| 113 | + if ($this->checkType == self::CHECK_ALL) { |
|
| 114 | + return [ |
|
| 115 | + EnvironmentCheck::ERROR, |
|
| 116 | + sprintf( |
|
| 117 | + 'File "%s" doesn\'t match age check (compare %s: %s, actual: %s)', |
|
| 118 | + $file, |
|
| 119 | + $this->compareOperand, |
|
| 120 | + date('c', $cutoffTime), |
|
| 121 | + date('c', $fileTime) |
|
| 122 | + ) |
|
| 123 | + ]; |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - // If at least one file was valid, count as passed |
|
| 130 | - if ($this->checkType == self::CHECK_SINGLE && count($invalidFiles) < count($files)) { |
|
| 131 | - return [EnvironmentCheck::OK, '']; |
|
| 132 | - } |
|
| 133 | - if (count($invalidFiles) == 0) { |
|
| 134 | - return [EnvironmentCheck::OK, '']; |
|
| 135 | - } |
|
| 136 | - return [ |
|
| 137 | - EnvironmentCheck::ERROR, |
|
| 138 | - sprintf('No files matched criteria (%s %s)', $this->compareOperand, date('c', $cutoffTime)) |
|
| 139 | - ]; |
|
| 140 | - } |
|
| 129 | + // If at least one file was valid, count as passed |
|
| 130 | + if ($this->checkType == self::CHECK_SINGLE && count($invalidFiles) < count($files)) { |
|
| 131 | + return [EnvironmentCheck::OK, '']; |
|
| 132 | + } |
|
| 133 | + if (count($invalidFiles) == 0) { |
|
| 134 | + return [EnvironmentCheck::OK, '']; |
|
| 135 | + } |
|
| 136 | + return [ |
|
| 137 | + EnvironmentCheck::ERROR, |
|
| 138 | + sprintf('No files matched criteria (%s %s)', $this->compareOperand, date('c', $cutoffTime)) |
|
| 139 | + ]; |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - /** |
|
| 143 | - * Gets a list of absolute file paths. |
|
| 144 | - * |
|
| 145 | - * @return array |
|
| 146 | - */ |
|
| 147 | - protected function getFiles() |
|
| 148 | - { |
|
| 149 | - return glob($this->path); |
|
| 150 | - } |
|
| 142 | + /** |
|
| 143 | + * Gets a list of absolute file paths. |
|
| 144 | + * |
|
| 145 | + * @return array |
|
| 146 | + */ |
|
| 147 | + protected function getFiles() |
|
| 148 | + { |
|
| 149 | + return glob($this->path); |
|
| 150 | + } |
|
| 151 | 151 | } |
@@ -11,29 +11,29 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class HasClassCheck implements EnvironmentCheck |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * @var string |
|
| 16 | - */ |
|
| 17 | - protected $className; |
|
| 14 | + /** |
|
| 15 | + * @var string |
|
| 16 | + */ |
|
| 17 | + protected $className; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @param string $className The name of the class to look for. |
|
| 21 | - */ |
|
| 22 | - public function __construct($className) |
|
| 23 | - { |
|
| 24 | - $this->className = $className; |
|
| 25 | - } |
|
| 19 | + /** |
|
| 20 | + * @param string $className The name of the class to look for. |
|
| 21 | + */ |
|
| 22 | + public function __construct($className) |
|
| 23 | + { |
|
| 24 | + $this->className = $className; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * {@inheritDoc} |
|
| 29 | - * |
|
| 30 | - * @return array |
|
| 31 | - */ |
|
| 32 | - public function check() |
|
| 33 | - { |
|
| 34 | - if (class_exists($this->className)) { |
|
| 35 | - return [EnvironmentCheck::OK, 'Class ' . $this->className.' exists']; |
|
| 36 | - } |
|
| 37 | - return [EnvironmentCheck::ERROR, 'Class ' . $this->className.' doesn\'t exist']; |
|
| 38 | - } |
|
| 27 | + /** |
|
| 28 | + * {@inheritDoc} |
|
| 29 | + * |
|
| 30 | + * @return array |
|
| 31 | + */ |
|
| 32 | + public function check() |
|
| 33 | + { |
|
| 34 | + if (class_exists($this->className)) { |
|
| 35 | + return [EnvironmentCheck::OK, 'Class ' . $this->className.' exists']; |
|
| 36 | + } |
|
| 37 | + return [EnvironmentCheck::ERROR, 'Class ' . $this->className.' doesn\'t exist']; |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -11,77 +11,77 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class FileWriteableCheck implements EnvironmentCheck |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * @var string |
|
| 16 | - */ |
|
| 17 | - protected $path; |
|
| 14 | + /** |
|
| 15 | + * @var string |
|
| 16 | + */ |
|
| 17 | + protected $path; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @param string $path The full path. If a relative path, it will relative to the BASE_PATH. |
|
| 21 | - */ |
|
| 22 | - public function __construct($path) |
|
| 23 | - { |
|
| 24 | - $this->path = $path; |
|
| 25 | - } |
|
| 19 | + /** |
|
| 20 | + * @param string $path The full path. If a relative path, it will relative to the BASE_PATH. |
|
| 21 | + */ |
|
| 22 | + public function __construct($path) |
|
| 23 | + { |
|
| 24 | + $this->path = $path; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * {@inheritDoc} |
|
| 29 | - * |
|
| 30 | - * @return array |
|
| 31 | - */ |
|
| 32 | - public function check() |
|
| 33 | - { |
|
| 34 | - if ($this->path[0] == '/') { |
|
| 35 | - $filename = $this->path; |
|
| 36 | - } else { |
|
| 37 | - $filename = BASE_PATH . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $this->path); |
|
| 38 | - } |
|
| 27 | + /** |
|
| 28 | + * {@inheritDoc} |
|
| 29 | + * |
|
| 30 | + * @return array |
|
| 31 | + */ |
|
| 32 | + public function check() |
|
| 33 | + { |
|
| 34 | + if ($this->path[0] == '/') { |
|
| 35 | + $filename = $this->path; |
|
| 36 | + } else { |
|
| 37 | + $filename = BASE_PATH . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $this->path); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - if (file_exists($filename)) { |
|
| 41 | - $isWriteable = is_writeable($filename); |
|
| 42 | - } else { |
|
| 43 | - $isWriteable = is_writeable(dirname($filename)); |
|
| 44 | - } |
|
| 40 | + if (file_exists($filename)) { |
|
| 41 | + $isWriteable = is_writeable($filename); |
|
| 42 | + } else { |
|
| 43 | + $isWriteable = is_writeable(dirname($filename)); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - if (!$isWriteable) { |
|
| 47 | - if (function_exists('posix_getgroups')) { |
|
| 48 | - $userID = posix_geteuid(); |
|
| 49 | - $user = posix_getpwuid($userID); |
|
| 46 | + if (!$isWriteable) { |
|
| 47 | + if (function_exists('posix_getgroups')) { |
|
| 48 | + $userID = posix_geteuid(); |
|
| 49 | + $user = posix_getpwuid($userID); |
|
| 50 | 50 | |
| 51 | - $currentOwnerID = fileowner(file_exists($filename) ? $filename : dirname($filename)); |
|
| 52 | - $currentOwner = posix_getpwuid($currentOwnerID); |
|
| 51 | + $currentOwnerID = fileowner(file_exists($filename) ? $filename : dirname($filename)); |
|
| 52 | + $currentOwner = posix_getpwuid($currentOwnerID); |
|
| 53 | 53 | |
| 54 | - $message = "User '$user[name]' needs to be able to write to this file:\n$filename\n\nThe file is " |
|
| 55 | - . "currently owned by '$currentOwner[name]'. "; |
|
| 54 | + $message = "User '$user[name]' needs to be able to write to this file:\n$filename\n\nThe file is " |
|
| 55 | + . "currently owned by '$currentOwner[name]'. "; |
|
| 56 | 56 | |
| 57 | - if ($user['name'] == $currentOwner['name']) { |
|
| 58 | - $message .= 'We recommend that you make the file writeable.'; |
|
| 59 | - } else { |
|
| 60 | - $groups = posix_getgroups(); |
|
| 61 | - $groupList = []; |
|
| 62 | - foreach ($groups as $group) { |
|
| 63 | - $groupInfo = posix_getgrgid($group); |
|
| 64 | - if (in_array($currentOwner['name'], $groupInfo['members'])) { |
|
| 65 | - $groupList[] = $groupInfo['name']; |
|
| 66 | - } |
|
| 67 | - } |
|
| 68 | - if ($groupList) { |
|
| 69 | - $message .= " We recommend that you make the file group-writeable and change the group to " |
|
| 70 | - . "one of these groups:\n - " . implode("\n - ", $groupList) |
|
| 71 | - . "\n\nFor example:\nchmod g+w $filename\nchgrp " . $groupList[0] . " $filename"; |
|
| 72 | - } else { |
|
| 73 | - $message .= " There is no user-group that contains both the web-server user and the owner " |
|
| 74 | - . "of this file. Change the ownership of the file, create a new group, or temporarily " |
|
| 75 | - . "make the file writeable by everyone during the install process."; |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - } else { |
|
| 79 | - $message = "The webserver user needs to be able to write to this file:\n$filename"; |
|
| 80 | - } |
|
| 57 | + if ($user['name'] == $currentOwner['name']) { |
|
| 58 | + $message .= 'We recommend that you make the file writeable.'; |
|
| 59 | + } else { |
|
| 60 | + $groups = posix_getgroups(); |
|
| 61 | + $groupList = []; |
|
| 62 | + foreach ($groups as $group) { |
|
| 63 | + $groupInfo = posix_getgrgid($group); |
|
| 64 | + if (in_array($currentOwner['name'], $groupInfo['members'])) { |
|
| 65 | + $groupList[] = $groupInfo['name']; |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | + if ($groupList) { |
|
| 69 | + $message .= " We recommend that you make the file group-writeable and change the group to " |
|
| 70 | + . "one of these groups:\n - " . implode("\n - ", $groupList) |
|
| 71 | + . "\n\nFor example:\nchmod g+w $filename\nchgrp " . $groupList[0] . " $filename"; |
|
| 72 | + } else { |
|
| 73 | + $message .= " There is no user-group that contains both the web-server user and the owner " |
|
| 74 | + . "of this file. Change the ownership of the file, create a new group, or temporarily " |
|
| 75 | + . "make the file writeable by everyone during the install process."; |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + } else { |
|
| 79 | + $message = "The webserver user needs to be able to write to this file:\n$filename"; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - return [EnvironmentCheck::ERROR, $message]; |
|
| 83 | - } |
|
| 82 | + return [EnvironmentCheck::ERROR, $message]; |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - return [EnvironmentCheck::OK, '']; |
|
| 86 | - } |
|
| 85 | + return [EnvironmentCheck::OK, '']; |
|
| 86 | + } |
|
| 87 | 87 | } |
@@ -16,27 +16,27 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class DevHealthControllerTest extends SapphireTest |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * {@inheritDoc} |
|
| 21 | - * @var array |
|
| 22 | - */ |
|
| 23 | - protected $usesDatabase = true; |
|
| 19 | + /** |
|
| 20 | + * {@inheritDoc} |
|
| 21 | + * @var array |
|
| 22 | + */ |
|
| 23 | + protected $usesDatabase = true; |
|
| 24 | 24 | |
| 25 | - public function testIndexCreatesChecker() |
|
| 26 | - { |
|
| 27 | - $controller = new DevHealthController(); |
|
| 25 | + public function testIndexCreatesChecker() |
|
| 26 | + { |
|
| 27 | + $controller = new DevHealthController(); |
|
| 28 | 28 | |
| 29 | - $request = new HTTPRequest('GET', 'example.com'); |
|
| 29 | + $request = new HTTPRequest('GET', 'example.com'); |
|
| 30 | 30 | |
| 31 | - // we need to fake authenticated access as BasicAuth::requireLogin doesn't like empty |
|
| 32 | - // permission type strings, which is what health check uses. |
|
| 31 | + // we need to fake authenticated access as BasicAuth::requireLogin doesn't like empty |
|
| 32 | + // permission type strings, which is what health check uses. |
|
| 33 | 33 | |
| 34 | - putenv('ENVCHECK_BASICAUTH_USERNAME="foo"'); |
|
| 35 | - putenv('ENVCHECK_BASICAUTH_PASSWORD="bar"'); |
|
| 34 | + putenv('ENVCHECK_BASICAUTH_USERNAME="foo"'); |
|
| 35 | + putenv('ENVCHECK_BASICAUTH_PASSWORD="bar"'); |
|
| 36 | 36 | |
| 37 | - $_SERVER['PHP_AUTH_USER'] = 'foo'; |
|
| 38 | - $_SERVER['PHP_AUTH_PW'] = 'bar'; |
|
| 37 | + $_SERVER['PHP_AUTH_USER'] = 'foo'; |
|
| 38 | + $_SERVER['PHP_AUTH_PW'] = 'bar'; |
|
| 39 | 39 | |
| 40 | - $this->assertInstanceOf(EnvironmentChecker::class, $controller->index($request)); |
|
| 41 | - } |
|
| 40 | + $this->assertInstanceOf(EnvironmentChecker::class, $controller->index($request)); |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -16,18 +16,18 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class DevCheckControllerTest extends SapphireTest |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * {@inheritDoc} |
|
| 21 | - * @var array |
|
| 22 | - */ |
|
| 23 | - protected $usesDatabase = true; |
|
| 19 | + /** |
|
| 20 | + * {@inheritDoc} |
|
| 21 | + * @var array |
|
| 22 | + */ |
|
| 23 | + protected $usesDatabase = true; |
|
| 24 | 24 | |
| 25 | - public function testIndexCreatesChecker() |
|
| 26 | - { |
|
| 27 | - $controller = new DevCheckController(); |
|
| 25 | + public function testIndexCreatesChecker() |
|
| 26 | + { |
|
| 27 | + $controller = new DevCheckController(); |
|
| 28 | 28 | |
| 29 | - $request = new HTTPRequest('GET', 'example.com'); |
|
| 29 | + $request = new HTTPRequest('GET', 'example.com'); |
|
| 30 | 30 | |
| 31 | - $this->assertInstanceOf(EnvironmentChecker::class, $controller->index($request)); |
|
| 32 | - } |
|
| 31 | + $this->assertInstanceOf(EnvironmentChecker::class, $controller->index($request)); |
|
| 32 | + } |
|
| 33 | 33 | } |
@@ -15,15 +15,15 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class URLCheckTest extends SapphireTest |
| 17 | 17 | { |
| 18 | - public function testCheckReportsMissingPages() |
|
| 19 | - { |
|
| 20 | - $check = new URLCheck('foo', 'bar'); |
|
| 18 | + public function testCheckReportsMissingPages() |
|
| 19 | + { |
|
| 20 | + $check = new URLCheck('foo', 'bar'); |
|
| 21 | 21 | |
| 22 | - $expected = [ |
|
| 23 | - EnvironmentCheck::ERROR, |
|
| 24 | - 'Error retrieving "foo" (Code: 404)' |
|
| 25 | - ]; |
|
| 22 | + $expected = [ |
|
| 23 | + EnvironmentCheck::ERROR, |
|
| 24 | + 'Error retrieving "foo" (Code: 404)' |
|
| 25 | + ]; |
|
| 26 | 26 | |
| 27 | - $this->assertEquals($expected, $check->check()); |
|
| 28 | - } |
|
| 27 | + $this->assertEquals($expected, $check->check()); |
|
| 28 | + } |
|
| 29 | 29 | } |
@@ -15,24 +15,24 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class FileWritableCheckTest extends SapphireTest |
| 17 | 17 | { |
| 18 | - public function testCheckReportsWritablePaths() |
|
| 19 | - { |
|
| 20 | - $check = new FileWriteableCheck(TEMP_FOLDER); |
|
| 18 | + public function testCheckReportsWritablePaths() |
|
| 19 | + { |
|
| 20 | + $check = new FileWriteableCheck(TEMP_FOLDER); |
|
| 21 | 21 | |
| 22 | - $expected = [ |
|
| 23 | - EnvironmentCheck::OK, |
|
| 24 | - '' |
|
| 25 | - ]; |
|
| 22 | + $expected = [ |
|
| 23 | + EnvironmentCheck::OK, |
|
| 24 | + '' |
|
| 25 | + ]; |
|
| 26 | 26 | |
| 27 | - $this->assertEquals($expected, $check->check()); |
|
| 28 | - } |
|
| 27 | + $this->assertEquals($expected, $check->check()); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - public function testCheckReportsNonWritablePaths() |
|
| 31 | - { |
|
| 32 | - $check = new FileWriteableCheck('/var'); |
|
| 30 | + public function testCheckReportsNonWritablePaths() |
|
| 31 | + { |
|
| 32 | + $check = new FileWriteableCheck('/var'); |
|
| 33 | 33 | |
| 34 | - $result = $check->check(); |
|
| 34 | + $result = $check->check(); |
|
| 35 | 35 | |
| 36 | - $this->assertEquals(EnvironmentCheck::ERROR, $result[0]); |
|
| 37 | - } |
|
| 36 | + $this->assertEquals(EnvironmentCheck::ERROR, $result[0]); |
|
| 37 | + } |
|
| 38 | 38 | } |
@@ -15,17 +15,17 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class ExternalURLCheckTest extends SapphireTest |
| 17 | 17 | { |
| 18 | - public function testCheckReportsMissingPages() |
|
| 19 | - { |
|
| 20 | - $this->markTestSkipped('ExternalURLCheck seems faulty on some systems'); |
|
| 18 | + public function testCheckReportsMissingPages() |
|
| 19 | + { |
|
| 20 | + $this->markTestSkipped('ExternalURLCheck seems faulty on some systems'); |
|
| 21 | 21 | |
| 22 | - $check = new ExternalURLCheck('http://missing-site/'); |
|
| 22 | + $check = new ExternalURLCheck('http://missing-site/'); |
|
| 23 | 23 | |
| 24 | - $expected = [ |
|
| 25 | - EnvironmentCheck::ERROR, |
|
| 26 | - 'Success retrieving "http://missing-site/" (Code: 404)' |
|
| 27 | - ]; |
|
| 24 | + $expected = [ |
|
| 25 | + EnvironmentCheck::ERROR, |
|
| 26 | + 'Success retrieving "http://missing-site/" (Code: 404)' |
|
| 27 | + ]; |
|
| 28 | 28 | |
| 29 | - $this->assertEquals($expected, $check->check()); |
|
| 30 | - } |
|
| 29 | + $this->assertEquals($expected, $check->check()); |
|
| 30 | + } |
|
| 31 | 31 | } |
@@ -15,27 +15,27 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class HasClassCheckTest extends SapphireTest |
| 17 | 17 | { |
| 18 | - public function testCheckReportsMissingClasses() |
|
| 19 | - { |
|
| 20 | - $check = new HasClassCheck('foo'); |
|
| 18 | + public function testCheckReportsMissingClasses() |
|
| 19 | + { |
|
| 20 | + $check = new HasClassCheck('foo'); |
|
| 21 | 21 | |
| 22 | - $expected = [ |
|
| 23 | - EnvironmentCheck::ERROR, |
|
| 24 | - 'Class foo doesn\'t exist' |
|
| 25 | - ]; |
|
| 22 | + $expected = [ |
|
| 23 | + EnvironmentCheck::ERROR, |
|
| 24 | + 'Class foo doesn\'t exist' |
|
| 25 | + ]; |
|
| 26 | 26 | |
| 27 | - $this->assertEquals($expected, $check->check()); |
|
| 28 | - } |
|
| 27 | + $this->assertEquals($expected, $check->check()); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - public function testCheckReportsFoundClasses() |
|
| 31 | - { |
|
| 32 | - $check = new HasClassCheck('stdClass'); |
|
| 30 | + public function testCheckReportsFoundClasses() |
|
| 31 | + { |
|
| 32 | + $check = new HasClassCheck('stdClass'); |
|
| 33 | 33 | |
| 34 | - $expected = [ |
|
| 35 | - EnvironmentCheck::OK, |
|
| 36 | - 'Class stdClass exists', |
|
| 37 | - ]; |
|
| 34 | + $expected = [ |
|
| 35 | + EnvironmentCheck::OK, |
|
| 36 | + 'Class stdClass exists', |
|
| 37 | + ]; |
|
| 38 | 38 | |
| 39 | - $this->assertEquals($expected, $check->check()); |
|
| 40 | - } |
|
| 39 | + $this->assertEquals($expected, $check->check()); |
|
| 40 | + } |
|
| 41 | 41 | } |