2024-05-30 14:01:25 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace DigiComp\FluidCurrentControllerExpression\Tests\Functional;
|
|
|
|
|
|
|
|
use Neos\Flow\Mvc\Routing\Route;
|
|
|
|
use Neos\Flow\Tests\FunctionalTestCase;
|
|
|
|
|
|
|
|
class CurrentControllerExpressionNodeTest extends FunctionalTestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var \Neos\Flow\Http\Client\Browser
|
|
|
|
*/
|
|
|
|
protected $browser;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializer
|
|
|
|
*/
|
|
|
|
protected function setUp(): void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
$route = new Route();
|
|
|
|
$route->setUriPattern('test/currentcontrollerexpressions/test(/{@action})');
|
|
|
|
$route->setDefaults([
|
|
|
|
'@package' => 'DigiComp.FluidCurrentControllerExpression',
|
|
|
|
'@subpackage' => 'Tests\Functional\Fixtures',
|
|
|
|
'@controller' => 'Test',
|
|
|
|
'@action' => 'index',
|
|
|
|
]);
|
|
|
|
$route->setAppendExceedingArguments(true);
|
|
|
|
$this->router->addRoute($route);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
|
|
|
public function itReturnsCurrentControllerInformations(): void
|
|
|
|
{
|
|
|
|
$response = $this->browser->request('http://localhost/test/currentcontrollerexpressions/test');
|
|
|
|
static::assertEquals(
|
|
|
|
'Test
|
|
|
|
index
|
|
|
|
DigiComp.FluidCurrentControllerExpression
|
|
|
|
Tests\Functional\Fixtures
|
|
|
|
DigiComp\FluidCurrentControllerExpression\Tests\Functional\Fixtures\Controller\TestController
|
|
|
|
html
|
|
|
|
',
|
|
|
|
(string)$response->getBody()
|
|
|
|
);
|
2024-05-30 15:08:53 +02:00
|
|
|
}
|
2024-05-30 14:01:25 +02:00
|
|
|
|
2024-05-30 15:08:53 +02:00
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
|
|
|
public function itReturnsCurrentControllerInformationsUsedInLayouts(): void
|
|
|
|
{
|
2024-05-30 14:01:25 +02:00
|
|
|
$response = $this->browser->request('http://localhost/test/currentcontrollerexpressions/test/withlayout');
|
|
|
|
static::assertEquals(
|
|
|
|
'Test
|
|
|
|
withLayout
|
|
|
|
DigiComp.FluidCurrentControllerExpression
|
|
|
|
Tests\Functional\Fixtures
|
|
|
|
DigiComp\FluidCurrentControllerExpression\Tests\Functional\Fixtures\Controller\TestController
|
|
|
|
html
|
2024-05-30 15:08:53 +02:00
|
|
|
',
|
|
|
|
(string)$response->getBody()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
|
|
|
public function itReturnsCurrentControllerInformationsUsedInArrays(): void
|
|
|
|
{
|
|
|
|
$response = $this->browser->request('http://localhost/test/currentcontrollerexpressions/test/inArrays');
|
|
|
|
static::assertEquals(
|
|
|
|
'Test
|
|
|
|
inArrays
|
|
|
|
DigiComp.FluidCurrentControllerExpression
|
|
|
|
Tests\Functional\Fixtures
|
|
|
|
DigiComp\FluidCurrentControllerExpression\Tests\Functional\Fixtures\Controller\TestController
|
|
|
|
html
|
2024-05-30 14:01:25 +02:00
|
|
|
',
|
|
|
|
(string)$response->getBody()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|