mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2024-12-04 23:17:19 +01:00
Optimized code for FormatFunctionTest
This commit is contained in:
parent
94b84527a8
commit
fb4dd58cde
@ -2,5 +2,6 @@
|
|||||||
(
|
(
|
||||||
cd "$(dirname "$(readlink -f "${0}")")/../docker-symfony/" &&
|
cd "$(dirname "$(readlink -f "${0}")")/../docker-symfony/" &&
|
||||||
docker-compose exec php php /var/www/symfony/bin/console cache:clear &&
|
docker-compose exec php php /var/www/symfony/bin/console cache:clear &&
|
||||||
docker-compose exec php php /var/www/symfony/bin/console cache:clear --env=prod
|
docker-compose exec php php /var/www/symfony/bin/console cache:clear --env=prod &&
|
||||||
|
docker-compose exec php php /var/www/symfony/bin/console cache:clear --env=test
|
||||||
)
|
)
|
||||||
|
@ -4,43 +4,59 @@ namespace Tests\Functional;
|
|||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*/
|
*/
|
||||||
class FormatFunctionTest extends WebTestCase
|
class FormatFunctionTest extends WebTestCase
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var Client
|
||||||
|
*/
|
||||||
|
private $client;
|
||||||
|
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
$this->client = static::createClient();
|
||||||
|
}
|
||||||
|
|
||||||
public function testHomepage(): void
|
public function testHomepage(): void
|
||||||
{
|
{
|
||||||
$client = static::createClient();
|
$this->client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE');
|
||||||
$client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE');
|
$this->assertEquals(200, $this->client->getResponse()
|
||||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
->getStatusCode());
|
||||||
$this->assertContains('<html', $client->getResponse()->getContent());
|
$this->assertJson($this->client->getResponse()
|
||||||
|
->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHomepageWithHTML(): void
|
public function testHomepageWithHTML(): void
|
||||||
{
|
{
|
||||||
$client = static::createClient();
|
$this->client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE.html');
|
||||||
$client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE.html');
|
$this->assertEquals(200, $this->client->getResponse()
|
||||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
->getStatusCode());
|
||||||
$this->assertContains('<html', $client->getResponse()->getContent());
|
$this->assertContains('<html', $this->client->getResponse()
|
||||||
|
->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHomepageWithJSON(): void
|
public function testHomepageWithJSON(): void
|
||||||
{
|
{
|
||||||
$client = static::createClient();
|
$this->client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE.json');
|
||||||
$client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE.json');
|
$this->assertEquals(200, $this->client->getResponse()
|
||||||
echo $client->getResponse()->getContent();
|
->getStatusCode());
|
||||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
$this->assertJson($this->client->getResponse()
|
||||||
// $this->assertContains('<html', $client->getResponse()->getContent());
|
->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHomepageWithXML(): void
|
public function testHomepageWithXML(): void
|
||||||
{
|
{
|
||||||
$client = static::createClient();
|
$this->client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE.xml');
|
||||||
$client->request(Request::METHOD_GET, 'api/rest/source/HOMEPAGE.xml');
|
$this->assertEquals(200, $this->client->getResponse()
|
||||||
echo $client->getResponse()->getContent();
|
->getStatusCode());
|
||||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
$content = $this->client->getResponse()->getContent();
|
||||||
// $this->assertContains('<html', $client->getResponse()->getContent());
|
$xml = new \XMLReader();
|
||||||
|
$xml->XML($content);
|
||||||
|
$xml->setParserProperty(\XMLReader::VALIDATE, true);
|
||||||
|
$this->assertTrue($xml->isValid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,4 +34,15 @@ class LawTest extends TestCase
|
|||||||
$this->assertNull($this->law->setRights($rights));
|
$this->assertNull($this->law->setRights($rights));
|
||||||
$this->assertEquals($right, $this->law->getRights()->get(0));
|
$this->assertEquals($right, $this->law->getRights()->get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implemented to debug where ReflectionException "Property Infinito\\Entity\\Meta\\Law::$relation does not exist" is coming from.
|
||||||
|
*/
|
||||||
|
public function testRelationNotSet(): void
|
||||||
|
{
|
||||||
|
$reflectionClass = new \ReflectionClass($this->law);
|
||||||
|
$this->assertFalse($reflectionClass->hasMethod('getRelation'));
|
||||||
|
$this->assertFalse($reflectionClass->hasMethod('setRelation'));
|
||||||
|
$this->assertFalse($reflectionClass->hasProperty('relation'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user