changing the format of the expression detections to avoid accidently being identified as objectaccessor and adding a test, where that happend with the previous expression
Some checks failed
ci/woodpecker/push/code-style Pipeline was successful
ci/woodpecker/push/functional-tests/1 Pipeline failed
ci/woodpecker/push/functional-tests/2 Pipeline failed
ci/woodpecker/push/functional-tests/3 Pipeline failed
ci/woodpecker/push/functional-tests/4 Pipeline failed
Some checks failed
ci/woodpecker/push/code-style Pipeline was successful
ci/woodpecker/push/functional-tests/1 Pipeline failed
ci/woodpecker/push/functional-tests/2 Pipeline failed
ci/woodpecker/push/functional-tests/3 Pipeline failed
ci/woodpecker/push/functional-tests/4 Pipeline failed
This commit is contained in:
parent
b3430789ec
commit
f75b21a874
6 changed files with 47 additions and 13 deletions
|
@ -16,7 +16,7 @@ class CurrentControllerExpressionNode extends AbstractExpressionNode implements
|
|||
* note: this could be readonly in PHP8
|
||||
* @var string
|
||||
*/
|
||||
public static string $detectionExpression = '/{currentController:([a-z0-9]+)}/i';
|
||||
public static string $detectionExpression = '/\{#currentController\.([a-z0-9]+)\}/';
|
||||
|
||||
public static function evaluateExpression(RenderingContextInterface $renderingContext, $expression, array $matches)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<f:render section="Test" arguments="{controllername: '{#currentController.name}'}" /><f:section name="Test">{controllername}
|
||||
{#currentController.actionName}
|
||||
{#currentController.packageKey}
|
||||
{#currentController.subpackageKey}
|
||||
{#currentController.objectName}
|
||||
{#currentController.format}</f:section>
|
|
@ -1,6 +1,6 @@
|
|||
{currentController:name}
|
||||
{currentController:actionName}
|
||||
{currentController:packageKey}
|
||||
{currentController:subpackageKey}
|
||||
{currentController:objectName}
|
||||
{currentController:format}
|
||||
{#currentController.name}
|
||||
{#currentController.actionName}
|
||||
{#currentController.packageKey}
|
||||
{#currentController.subpackageKey}
|
||||
{#currentController.objectName}
|
||||
{#currentController.format}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<f:layout name="Test" />
|
||||
<f:section name="Content">{currentController:name}
|
||||
{currentController:actionName}
|
||||
{currentController:packageKey}
|
||||
{currentController:subpackageKey}
|
||||
{currentController:objectName}
|
||||
{currentController:format}</f:section>
|
||||
<f:section name="Content">{#currentController.name}
|
||||
{#currentController.actionName}
|
||||
{#currentController.packageKey}
|
||||
{#currentController.subpackageKey}
|
||||
{#currentController.objectName}
|
||||
{#currentController.format}</f:section>
|
||||
|
|
|
@ -49,7 +49,13 @@ html
|
|||
',
|
||||
(string)$response->getBody()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function itReturnsCurrentControllerInformationsUsedInLayouts(): void
|
||||
{
|
||||
$response = $this->browser->request('http://localhost/test/currentcontrollerexpressions/test/withlayout');
|
||||
static::assertEquals(
|
||||
'Test
|
||||
|
@ -58,6 +64,24 @@ DigiComp.FluidCurrentControllerExpression
|
|||
Tests\Functional\Fixtures
|
||||
DigiComp\FluidCurrentControllerExpression\Tests\Functional\Fixtures\Controller\TestController
|
||||
html
|
||||
',
|
||||
(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
|
||||
',
|
||||
(string)$response->getBody()
|
||||
);
|
||||
|
|
|
@ -15,4 +15,8 @@ class TestController extends ActionController
|
|||
public function withLayoutAction()
|
||||
{
|
||||
}
|
||||
|
||||
public function inArraysAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue