Commit 98775279 authored by Dainis Abols's avatar Dainis Abols
Browse files

ProgramContinueTest

parent 047a2655
<?php
declare(strict_types=1);
namespace Lu\LuApi\Functional;
use GuzzleHttp\Client as Guzzle;
use GuzzleHttp\Exception\GuzzleException;
use Lu\LuApi\Helpers\DataHelper;
use Vendor\MyExtension\Service\AbstractSomethingService;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
/**
* Test for route `?r=program-continue`
*
* @author Dainis Abols <dainis.abols@lu.lv>
* @owner University of Latvia
* @since 22.02.2022
*/
class ProgramContinueTest extends UnitTestCase
{
protected $resetSingletonInstances = true;
/**
* Public API URL
*
* @var string
*/
private string $url = 'https://www.lu.lv/api/?r=program-continue/search/mate';
/**
* Program Continue test
*
* @test
*/
public function programContinueTest()
{
// Read url
$url = $this->url;
$result = (new DataHelper())->fetchUrl($url);
// Assert url read
$code = !empty($result) ? $result->getStatusCode() : 500;
$this->assertEquals(200, $code, 'Program Continue Url read failed');
// Assert json return
$content = @$result->getBody()->getContents();
$this->assertJson($content, 'Prograsm Continue Url response is not JSON');
// Check data object
$content = json_decode($content, true);
$this->assertNotEmpty($content, 'Program Continue has no data received');
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment