]> git.immae.eu Git - github/shaarli/Shaarli.git/blame - tests/HttpUtils/GetHttpUrlTest.php
Merge pull request #522 from ArthurHoaro/hotfix/readershaare
[github/shaarli/Shaarli.git] / tests / HttpUtils / GetHttpUrlTest.php
CommitLineData
451314eb
V
1<?php
2/**
3 * HttpUtils' tests
4 */
5
6require_once 'application/HttpUtils.php';
7
8/**
1557cefb 9 * Unitary tests for get_http_response()
451314eb
V
10 */
11class GetHttpUrlTest extends PHPUnit_Framework_TestCase
12{
13 /**
14 * Get an invalid local URL
15 */
16 public function testGetInvalidLocalUrl()
17 {
1557cefb
A
18 // Local
19 list($headers, $content) = get_http_response('/non/existent', 1);
20 $this->assertEquals('Invalid HTTP Url', $headers[0]);
21 $this->assertFalse($content);
22
23 // Non HTTP
24 list($headers, $content) = get_http_response('ftp://save.tld/mysave', 1);
25 $this->assertEquals('Invalid HTTP Url', $headers[0]);
26 $this->assertFalse($content);
451314eb
V
27 }
28
29 /**
30 * Get an invalid remote URL
31 */
32 public function testGetInvalidRemoteUrl()
33 {
1557cefb
A
34 list($headers, $content) = @get_http_response('http://non.existent', 1);
35 $this->assertFalse($headers);
36 $this->assertFalse($content);
451314eb
V
37 }
38}