Files
Twig/tests/Fixtures/expressions/matches.test
Fabien Potencier 3930d90842 Add more tests
2024-09-24 13:28:51 +02:00

21 lines
438 B
Plaintext

--TEST--
Twig supports the "matches" operator
--TEMPLATE--
{{ 'foo' matches '/o/' ? 'OK' : 'KO' }}
{{ 'foo' matches '/o/'|lower ? 'OK' : 'KO' }}
{{ 'foo' matches '/^fo/' ? 'OK' : 'KO' }}
{{ 'foo' matches '/^' ~ 'fo/' ? 'OK' : 'KO' }}
{{ 'foo' matches '/O/i' ? 'OK' : 'KO' }}
{{ null matches '/o/' }}
{{ markup matches '/test/' ? 'OK': 'KO' }}
--DATA--
return ['markup' => new \Twig\Markup('test', 'UTF-8')]
--EXPECT--
OK
OK
OK
OK
OK
0
OK