infinito/application/symfony/tests/Functional/FrameFunctionTest.php

46 lines
1.6 KiB
PHP
Raw Normal View History

2019-03-28 16:31:03 +01:00
<?php
namespace Tests\Functional;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
* @author kevinfrantz
*/
class FrameFunctionTest extends WebTestCase
{
public function testHomepageWithFrame(): void
{
$client = static::createClient();
$client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE.html?frame=1');
$this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertContains('<html', $client->getResponse()->getContent());
}
public function testHomepageFrameWithoutParameter(): void
{
$client = static::createClient();
$client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE.html');
$this->assertEquals(200, $client->getResponse()->getStatusCode());
$content = $client->getResponse()->getContent();
$this->assertContains('<html', $content);
}
public function testHomepageFrameless(): void
{
$client = static::createClient();
$client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE.html?frame=0');
$this->assertEquals(200, $client->getResponse()->getStatusCode());
$content = $client->getResponse()->getContent();
$this->assertNotContains('<html', $content);
}
public function testIncorrectParameterValue(): void
{
$client = static::createClient();
$client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE.html?frame=true');
2019-03-28 22:17:59 +01:00
$this->assertEquals(500, $client->getResponse()->getStatusCode());
2019-03-28 16:31:03 +01:00
}
}