friendica/tests/src/Network/CurlResultTest.php

30 lines
782 B
PHP

<?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());
}
}