public function FileMatcherTest::testFileMatcherWithExtensionFiler in Linkit 8.5
Tests file matcher with extension filer.
File
- tests/
src/ Kernel/ Matchers/ FileMatcherTest.php, line 70
Class
- FileMatcherTest
- Tests file matcher.
Namespace
Drupal\Tests\linkit\Kernel\MatchersCode
public function testFileMatcherWithExtensionFiler() {
/** @var \Drupal\linkit\MatcherInterface $plugin */
$plugin = $this->manager
->createInstance('entity:file', [
'settings' => [
'file_extensions' => 'png',
],
]);
$suggestions = $plugin
->execute('image-test');
$this
->assertEquals(1, count($suggestions
->getSuggestions()), 'Correct number of suggestions with single file extension filter.');
/** @var \Drupal\linkit\MatcherInterface $plugin */
$plugin = $this->manager
->createInstance('entity:file', [
'settings' => [
'file_extensions' => 'png jpg',
],
]);
$suggestions = $plugin
->execute('image-test');
$this
->assertEquals(2, count($suggestions
->getSuggestions()), 'Correct number of suggestions with multiple file extension filter.');
}