Skip to content

Commit

Permalink
Specs for VideosApi
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandin committed Mar 22, 2021
1 parent 43f5717 commit 1848b6e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/NewTwitchApi/NewTwitchApiSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use NewTwitchApi\Resources\TagsApi;
use NewTwitchApi\Resources\TeamsApi;
use NewTwitchApi\Resources\UsersApi;
use NewTwitchApi\Resources\VideosApi;
use NewTwitchApi\Resources\WebhooksApi;
use NewTwitchApi\Webhooks\WebhooksSubscriptionApi;
use PhpSpec\ObjectBehavior;
Expand Down Expand Up @@ -87,6 +88,11 @@ function it_should_provide_users_api()
$this->getUsersApi()->shouldBeAnInstanceOf(UsersApi::class);
}

function it_should_provide_videos_api()
{
$this->getVideosApi()->shouldBeAnInstanceOf(VideosApi::class);
}

function it_should_provide_webhooks_api()
{
$this->getWebhooksApi()->shouldBeAnInstanceOf(WebhooksApi::class);
Expand Down
29 changes: 29 additions & 0 deletions spec/NewTwitchApi/Resources/VideosApiSpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace spec\NewTwitchApi\Resources;

use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use PhpSpec\ObjectBehavior;
use Psr\Http\Message\ResponseInterface;

class VideosApiSpec extends ObjectBehavior
{
function let(Client $guzzleClient)
{
$this->beConstructedWith($guzzleClient);
}

function it_should_delete_videos(Client $guzzleClient, Response $response)
{
$guzzleClient->send(new Request('DELETE', 'videos?id=123', ['Authorization' => 'Bearer TEST_TOKEN']))->willReturn($response);
$this->deleteVideos('TEST_TOKEN', ['123'])->shouldBeAnInstanceOf(ResponseInterface::class);
}

function it_should_delete_multiple_videos(Client $guzzleClient, Response $response)
{
$guzzleClient->send(new Request('DELETE', 'videos?id=123&id=321', ['Authorization' => 'Bearer TEST_TOKEN']))->willReturn($response);
$this->deleteVideos('TEST_TOKEN', ['123', '321'])->shouldBeAnInstanceOf(ResponseInterface::class);
}
}

0 comments on commit 1848b6e

Please sign in to comment.