60 lines
1.9 KiB
PHP
60 lines
1.9 KiB
PHP
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace DigiComp\FluidRenderFunctions\Tests\Functional;
|
||
|
|
||
|
use DigiComp\FlowDataTablesAdapter\Tests\Functional\Fixtures\TestEntity;
|
||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||
|
use Neos\Flow\Mvc\Routing\Route;
|
||
|
use Neos\Flow\Tests\FunctionalTestCase;
|
||
|
|
||
|
class RenderFunctionsTest extends FunctionalTestCase
|
||
|
{
|
||
|
protected static $testablePersistenceEnabled = true;
|
||
|
|
||
|
/**
|
||
|
* Initializer
|
||
|
*/
|
||
|
protected function setUp(): void
|
||
|
{
|
||
|
parent::setUp();
|
||
|
|
||
|
$route = new Route();
|
||
|
$route->setUriPattern('test/fluidrenderfunctions/test(/{@action})');
|
||
|
$route->setDefaults([
|
||
|
'@package' => 'DigiComp.FluidRenderFunctions',
|
||
|
'@subpackage' => 'Tests\Functional\Fixtures',
|
||
|
'@controller' => 'Test',
|
||
|
'@action' => 'index',
|
||
|
]);
|
||
|
$route->setAppendExceedingArguments(true);
|
||
|
$this->router->addRoute($route);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @test
|
||
|
*/
|
||
|
public function itAllowsFluidToRenderWrappedArray(): void
|
||
|
{
|
||
|
$response = $this->browser->request('http://localhost/test/fluidrenderfunctions/test');
|
||
|
static::assertEquals("hallo is cool\n", (string)$response->getBody());
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @test
|
||
|
*/
|
||
|
public function itAllowsToRenderTheOptionsArgumentOfSelectNicely(): void
|
||
|
{
|
||
|
$testEntity1 = new TestEntity(new ArrayCollection(), 'hallo');
|
||
|
$this->persistenceManager->add($testEntity1);
|
||
|
$testEntity2 = new TestEntity(new ArrayCollection(), 'hallo 2');
|
||
|
$this->persistenceManager->add($testEntity2);
|
||
|
$this->persistenceManager->persistAll();
|
||
|
|
||
|
$response = $this->browser->request('http://localhost/test/fluidrenderfunctions/test/select');
|
||
|
static::assertStringContainsString('hallo is cool', (string)$response->getBody());
|
||
|
static::assertStringContainsString('hallo 2 is cool', (string)$response->getBody());
|
||
|
}
|
||
|
}
|