diff --git a/src/Downloader.php b/src/Downloader.php index 34b9666..90c10c9 100644 --- a/src/Downloader.php +++ b/src/Downloader.php @@ -8,6 +8,9 @@ class Downloader implements DownloaderInterface { + /** + * @var ClientInterface + */ protected $client; public function __construct(ClientInterface $client) diff --git a/tests/DownloaderTest.php b/tests/DownloaderTest.php index 435977d..7912ba1 100644 --- a/tests/DownloaderTest.php +++ b/tests/DownloaderTest.php @@ -18,10 +18,10 @@ public function test_download() ['test' => 'TEST_HEADER'], ['test1' => 'TEST_HEADER1'], ]; + $code = 200; - $mock = new MockHandler([ - new Response(200, $headers, $body) - ]); + $setResponse = new Response($code, $headers, $body); + $mock = new MockHandler([$setResponse]); $handler = HandlerStack::create($mock); $client = new Client(['handler' => $handler]); $downloader = new Downloader($client); @@ -31,5 +31,6 @@ public function test_download() $this->assertSame($body, (string)$response->getBody()); $this->assertSame($headers[0], $response->getHeaders()[0]); $this->assertSame($headers[1], $response->getHeaders()[1]); + $this->assertSame($code, $response->getStatusCode()); } } \ No newline at end of file diff --git a/tests/ParserTest.php b/tests/ParserTest.php index 51af04e..8fc0dab 100644 --- a/tests/ParserTest.php +++ b/tests/ParserTest.php @@ -11,12 +11,17 @@ public function test_get_tag_content() { $parser = new Parser; - $html = "
wedfwefwfwef
"; + $html = "111111111111
"; $result = $parser->getTagContent('p', $html); $this->assertCount(1, $result); + $html .= PHP_EOL . "222222222222
"; + + $result2 = $parser->getTagContent('p', $html); + + $this->assertCount(2, $result2); } public function test_get_meta_tag() @@ -28,5 +33,11 @@ public function test_get_meta_tag() $result = $parser->getMetaTags($meta); $this->assertCount(1, $result); + + $meta .= PHP_EOL . ""; + + $result2 = $parser->getMetaTags($meta); + + $this->assertCount(2, $result2); } } \ No newline at end of file