Skip to content

Commit

Permalink
Remove custom twig functions returning hookable data and configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubtobiasz committed Feb 5, 2024
1 parent 17e2cdd commit a154813
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 48 deletions.
2 changes: 0 additions & 2 deletions src/TwigHooks/src/Twig/HooksExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public function getFunctions(): array
{
return [
new TwigFunction('hook_name', [HooksRuntime::class, 'createHookName']),
new TwigFunction('hookable_data', [HooksRuntime::class, 'getHookableData'], ['needs_context' => true]),
new TwigFunction('hookable_configuration', [HooksRuntime::class, 'getHookableConfiguration'], ['needs_context' => true]),
];
}

Expand Down
20 changes: 0 additions & 20 deletions src/TwigHooks/src/Twig/Runtime/HooksRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,6 @@ private function formatBaseString(string $base): string
return implode('.', $resultParts);
}

/**
* @param array<string, mixed> $context
*
* @return array<string, string>
*/
public function getHookableData(array $context): array
{
return $context[self::HOOKABLE_DATA_PARAMETER] ?? [];
}

/**
* @param array<string, mixed> $context
*
* @return array<string, string>
*/
public function getHookableConfiguration(array $context): array
{
return $context[self::HOOKABLE_CONFIGURATION_PARAMETER] ?? [];
}

/**
* @param array<string> $hooksNames
* @param array<string, mixed> $data
Expand Down
26 changes: 0 additions & 26 deletions src/TwigHooks/tests/Integration/Twig/Runtime/HooksRuntimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,6 @@ public function testItConvertsStringsToHookNames(string $input, string $expected
$this->assertSame($expectedOutput, $this->getTestSubject()->createHookName($input, ...$suffix));
}

public function testItReturnsHookableData(): void
{
$context = [
'hookable_data' => ['foo' => 'bar'],
'other' => 'data',
];

$this->assertSame(
['foo' => 'bar'],
$this->getTestSubject()->getHookableData($context)
);
}

public function testItReturnsHookableConfiguration(): void
{
$context = [
'hookable_configuration' => ['foo' => 'bar'],
'other' => 'data',
];

$this->assertSame(
['foo' => 'bar'],
$this->getTestSubject()->getHookableConfiguration($context)
);
}

public function testItRendersHook(): void
{
$this->markTestSkipped('Not implemented yet.');
Expand Down

0 comments on commit a154813

Please sign in to comment.