| Total Complexity | 4 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class SleeperAvatarTest extends TestCase |
||
| 8 | { |
||
| 9 | |||
| 10 | private function remoteFileExists($url) { |
||
| 11 | $curl = curl_init($url); |
||
| 12 | |||
| 13 | //don't fetch the actual page, you only want to check the connection is ok |
||
| 14 | curl_setopt($curl, CURLOPT_NOBODY, true); |
||
| 15 | |||
| 16 | $result = curl_exec($curl); |
||
| 17 | $ret = false; |
||
| 18 | |||
| 19 | //if request did not fail |
||
| 20 | if ($result !== false) { |
||
| 21 | //if request was ok, check response code |
||
| 22 | $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); |
||
| 23 | |||
| 24 | if ($statusCode == 200) { |
||
| 25 | $ret = true; |
||
| 26 | } |
||
| 27 | } |
||
| 28 | |||
| 29 | curl_close($curl); |
||
| 30 | |||
| 31 | return $ret; |
||
| 32 | } |
||
| 33 | |||
| 34 | public function testAvatar() |
||
| 43 | } |
||
| 44 | |||
| 46 |