forked from jeremykendall/php-domain-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCurlHttpClientTest.php
More file actions
57 lines (50 loc) · 1.36 KB
/
CurlHttpClientTest.php
File metadata and controls
57 lines (50 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* PHP Domain Parser: Public Suffix List based URL parsing.
*
* @see http://github.com/jeremykendall/php-domain-parser for the canonical source repository
*
* @copyright Copyright (c) 2017 Jeremy Kendall (http://jeremykendall.net)
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Pdp\Tests;
use Pdp\CurlHttpClient;
use Pdp\Exception;
use Pdp\HttpClientException;
use PHPUnit\Framework\TestCase;
/**
* @coversDefaultClass Pdp\CurlHttpClient
*/
class CurlHttpClientTest extends TestCase
{
/**
* @covers ::__construct
* @covers ::getContent
*/
public function testGetContent()
{
$content = (new CurlHttpClient())->getContent('https://www.google.com');
$this->assertNotNull($content);
$this->assertContains('google', $content);
}
/**
* @covers ::__construct
* @covers ::getContent
*/
public function testThrowsException()
{
$this->expectException(HttpClientException::class);
(new CurlHttpClient())->getContent('https://qsfsdfqdf.dfsf');
}
/**
* @covers ::__construct
*/
public function testConstructorThrowsException()
{
$this->expectException(Exception::class);
new CurlHttpClient(['foo' => 'bar']);
}
}