Skip to content

Commit

Permalink
Fix tests not passing on Twig ^3.15
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreyu committed Nov 19, 2024
1 parent be388fa commit 5774392
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/Unit/Twig/DataTableThemeTokenParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Twig\Node\Expression\ArrayExpression;
use Twig\Node\Expression\ConstantExpression;
use Twig\Node\Expression\NameExpression;
use Twig\Node\Expression\Variable\ContextVariable;
use Twig\Parser;
use Twig\Source;

Expand Down Expand Up @@ -42,7 +43,7 @@ public static function provideCompileCases(): iterable
yield 'single theme' => [
'{% data_table_theme data_table "foo" %}',
new DataTableThemeNode(
new NameExpression('data_table', 1),
class_exists(ContextVariable::class) ? new ContextVariable('data_table', 1) : new NameExpression('data_table', 1),
new ArrayExpression([
new ConstantExpression(0, 1),
new ConstantExpression('foo', 1),
Expand All @@ -56,7 +57,7 @@ public static function provideCompileCases(): iterable
yield 'multiple themes without only' => [
'{% data_table_theme data_table with ["foo", "bar"] %}',
new DataTableThemeNode(
new NameExpression('data_table', 1),
class_exists(ContextVariable::class) ? new ContextVariable('data_table', 1) : new NameExpression('data_table', 1),
new ArrayExpression([
new ConstantExpression(0, 1),
new ConstantExpression('foo', 1),
Expand All @@ -72,7 +73,7 @@ public static function provideCompileCases(): iterable
yield 'multiple themes with only' => [
'{% data_table_theme data_table with ["foo", "bar"] only %}',
new DataTableThemeNode(
new NameExpression('data_table', 1),
class_exists(ContextVariable::class) ? new ContextVariable('data_table', 1) : new NameExpression('data_table', 1),
new ArrayExpression([
new ConstantExpression(0, 1),
new ConstantExpression('foo', 1),
Expand Down

0 comments on commit 5774392

Please sign in to comment.