public function TwigExtensionFiltersTest::testAddFilterMissingArgumentException in Components! 8.2
Tests exceptions during add filter.
@covers ::addFilter
File
- tests/
src/ Unit/ TwigExtensionFiltersTest.php, line 329
Class
- TwigExtensionFiltersTest
- @coversDefaultClass \Drupal\components\Template\TwigExtension @group components
Namespace
Drupal\Tests\components\UnitCode
public function testAddFilterMissingArgumentException() {
try {
TwigExtension::addFilter([
'an-array',
], NULL, 'value');
$exception = FALSE;
} catch (\Exception $e) {
$this
->assertStringContainsString('Value for argument "at" is required for filter "add".', $e
->getMessage());
$exception = TRUE;
}
if (!$exception) {
$this
->fail('Expected Exception, none was thrown.');
}
}