1
0
mirror of https://github.com/Rudloff/alltube.git synced 2024-06-25 07:27:46 +02:00
alltube/tests/JsonControllerTest.php
2019-11-30 14:09:12 +01:00

58 lines
1.1 KiB
PHP

<?php
/**
* JsonControllerTest class.
*/
namespace Alltube\Test;
use Alltube\Controller\JsonController;
/**
* Unit tests for the FrontController class.
*/
class JsonControllerTest extends ControllerTest
{
/**
* Prepare tests.
*/
protected function setUp(): void
{
parent::setUp();
$this->controller = new JsonController($this->container);
}
/**
* Test the json() function.
*
* @return void
* @requires download
*/
public function testJson()
{
$this->assertRequestIsOk('json', ['url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU']);
}
/**
* Test the json() function with an error.
*
* @return void
* @requires download
*/
public function testJsonWithError()
{
$this->assertRequestIsServerError('json', ['url' => 'http://example.com/foo']);
}
/**
* Test the json() function without the URL parameter.
*
* @return void
*/
public function testJsonWithoutUrl()
{
$this->assertRequestIsClientError('json');
}
}