CurlResult Tests

This commit is contained in:
Philipp Holzer 2018-10-11 21:19:38 +02:00
parent 71a60c5f66
commit 00bf0c24b6
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
4 changed files with 241 additions and 1 deletions

View file

@ -0,0 +1,30 @@
<?php
namespace Friendica\Test\src\Network;
use Friendica\Network\CurlResult;
use PHPUnit\Framework\TestCase;
class CurlResultTest extends TestCase
{
public function setUp()
{
parent::setUp(); // TODO: Change the autogenerated stub
require_once __DIR__.'/../../../boot.php';
require_once __DIR__.'/../../../include/text.php';
}
public function testNormal()
{
$header = file_get_contents(__DIR__ . '/../../datasets/curl/about.head');
$body = file_get_contents(__DIR__ . '/../../datasets/curl/about.body');
$curlResult = new CurlResult('https://test.local', $header . $body, [ 'http_code' => 200 ]);
$this->assertTrue($curlResult->isSuccess());
$this->assertSame($header, $curlResult->getHeader());
$this->assertSame($body, $curlResult->getBody());
}
}