HummingBirdAnimeClient/tests/AnimeClient/API/ParallelAPIRequestTest.php

51 lines
1.2 KiB
PHP
Raw Permalink Normal View History

<?php declare(strict_types=1);
/**
* Hummingbird Anime List Client
*
2018-08-22 13:48:27 -04:00
* An API client for Kitsu to manage anime and manga watch lists
*
2023-07-13 11:08:05 -04:00
* PHP version 8.1
*
2023-07-13 11:08:05 -04:00
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
2020-12-10 17:06:50 -05:00
* @version 5.2
2023-07-13 11:08:05 -04:00
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
2017-02-20 13:37:08 -05:00
namespace Aviat\AnimeClient\Tests\API;
2018-01-16 14:58:07 -05:00
use Aviat\AnimeClient\API\ParallelAPIRequest;
2017-02-20 13:37:08 -05:00
use Aviat\Ion\Friend;
use PHPUnit\Framework\TestCase;
2022-03-04 12:19:47 -05:00
/**
* @internal
*/
final class ParallelAPIRequestTest extends TestCase
{
2017-02-20 13:37:08 -05:00
public function testAddStringUrlRequest()
{
$requester = new ParallelAPIRequest();
2018-01-16 14:58:07 -05:00
$requester->addRequest('https://httpbin.org');
2017-02-20 13:37:08 -05:00
$friend = new Friend($requester);
2018-01-16 14:58:07 -05:00
2022-03-04 12:19:47 -05:00
$this->assertSame($friend->requests, ['https://httpbin.org']);
2017-02-20 13:37:08 -05:00
}
2018-01-16 14:58:07 -05:00
2017-02-20 13:37:08 -05:00
public function testAddStringUrlRequests()
{
$requests = [
'foo' => 'http://example.com',
2022-03-04 12:19:47 -05:00
'bar' => 'https://example.com',
2017-02-20 13:37:08 -05:00
];
2018-01-16 14:58:07 -05:00
2017-02-20 13:37:08 -05:00
$requester = new ParallelAPIRequest();
2018-01-16 14:58:07 -05:00
$requester->addRequests($requests);
2017-02-20 13:37:08 -05:00
$friend = new Friend($requester);
2018-01-16 14:58:07 -05:00
2022-03-04 12:19:47 -05:00
$this->assertSame($friend->requests, $requests);
2017-02-20 13:37:08 -05:00
}
2022-03-04 12:19:47 -05:00
}