mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-03 05:56:43 +00:00
⚰️ Drop useless php comparisons
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
"format_date" filter
|
||||
--CONDITION--
|
||||
PHP_VERSION_ID >= 80000 && version_compare(Symfony\Component\Intl\Intl::getIcuVersion(), '72.1', '<')
|
||||
version_compare(Symfony\Component\Intl\Intl::getIcuVersion(), '72.1', '<')
|
||||
--TEMPLATE--
|
||||
{{ 'today 23:39:12'|format_datetime('relative_short', 'none', locale='fr') }}
|
||||
{{ 'today 23:39:12'|format_datetime('relative_full', 'full', locale='fr') }}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
"format_date" filter
|
||||
--CONDITION--
|
||||
PHP_VERSION_ID >= 80000 && version_compare(Symfony\Component\Intl\Intl::getIcuVersion(), '72.1', '>=')
|
||||
version_compare(Symfony\Component\Intl\Intl::getIcuVersion(), '72.1', '>=')
|
||||
--TEMPLATE--
|
||||
{{ 'today 23:39:12'|format_datetime('relative_short', 'none', locale='fr') }}
|
||||
{{ 'today 23:39:12'|format_datetime('relative_full', 'full', locale='fr') }}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
--TEST--
|
||||
"enum" function with invalid dynamic enum class
|
||||
--CONDITION--
|
||||
\PHP_VERSION_ID >= 80100
|
||||
--TEMPLATE--
|
||||
{% set from_variable = 'Twig\Tests\NonExistentEnum' %}
|
||||
{% for c in enum(from_variable).cases() %}
|
||||
|
||||
@@ -71,18 +71,6 @@ class CallableArgumentsExtractorTest extends TestCase
|
||||
$this->getArguments('date', 'date', ['Y-m-d', 'timestamp' => null, 'unknown1' => '', 'unknown2' => '']);
|
||||
}
|
||||
|
||||
public function testResolveArgumentsWithMissingValueForOptionalArgument(): void
|
||||
{
|
||||
if (\PHP_VERSION_ID >= 80000) {
|
||||
$this->markTestSkipped('substr_compare() has a default value in 8.0, so the test does not work anymore, one should find another PHP built-in function for this test to work in PHP 8.');
|
||||
}
|
||||
|
||||
$this->expectException(SyntaxError::class);
|
||||
$this->expectExceptionMessage('Argument "case_sensitivity" could not be assigned for function "substr_compare(main_str, str, offset, length, case_sensitivity)" because it is mapped to an internal PHP function which cannot determine default value for optional argument "length".');
|
||||
|
||||
$this->getArguments('substr_compare', 'substr_compare', ['abcd', 'bc', 'offset' => 1, 'case_sensitivity' => true]);
|
||||
}
|
||||
|
||||
public function testResolveArgumentsOnlyNecessaryArgumentsForCustomFunction(): void
|
||||
{
|
||||
$this->assertEquals(['arg1'], $this->getArguments('custom_function', [$this, 'customFunction'], ['arg1' => 'arg1']));
|
||||
|
||||
Reference in New Issue
Block a user