2024-06-01 23:15:35 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace DigiComp\FluidRenderFunctions\Tests\Functional;
|
|
|
|
|
|
|
|
use Neos\Flow\Mvc\Routing\Route;
|
|
|
|
use Neos\Flow\Tests\FunctionalTestCase;
|
2024-06-01 23:24:43 +02:00
|
|
|
use Neos\FluidAdaptor\Tests\Functional\Form\Fixtures\Domain\Model\Tag;
|
2024-06-01 23:15:35 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
{
|
2024-06-01 23:24:43 +02:00
|
|
|
$post1 = new Tag('hallo');
|
|
|
|
$this->persistenceManager->add($post1);
|
|
|
|
$post2 = new Tag('hallo 2');
|
|
|
|
$this->persistenceManager->add($post2);
|
2024-06-01 23:15:35 +02:00
|
|
|
$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());
|
|
|
|
}
|
|
|
|
}
|