mirror of
https://github.com/holidayapi/holidayapi-php.git
synced 2025-06-21 12:16:31 +00:00
36 lines
745 B
PHP
36 lines
745 B
PHP
<?php
|
|
namespace HolidayAPI\Tests;
|
|
use HolidayAPI\Request;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class RequestTest extends TestCase
|
|
{
|
|
public function testExecute()
|
|
{
|
|
$curl = curl_init();
|
|
$request = new Request();
|
|
|
|
$this->assertFalse($request->execute($curl));
|
|
}
|
|
|
|
public function testGet()
|
|
{
|
|
$url = 'https://holidayapi.com';
|
|
|
|
$request = new Request(array(
|
|
'execute' => array(
|
|
$url => function ()
|
|
{
|
|
return '';
|
|
},
|
|
),
|
|
));
|
|
|
|
try {
|
|
$request->get($url);
|
|
} catch (\Exception $e) {
|
|
$this->assertRegExp('/empty response/i', $e->getMessage());
|
|
}
|
|
}
|
|
}
|
|
|