function IconFinderTest::testGetFilesFromPathEmptyWarning

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Theme/Icon/IconFinderTest.php \Drupal\Tests\Core\Theme\Icon\IconFinderTest::testGetFilesFromPathEmptyWarning()

Test the IconFinder::getFilesFromPath method with warning.

File

core/tests/Drupal/Tests/Core/Theme/Icon/IconFinderTest.php, line 617

Class

IconFinderTest
Tests Drupal\Core\Theme\Icon\IconFinder.

Namespace

Drupal\Tests\Core\Theme\Icon

Code

public function testGetFilesFromPathEmptyWarning() : void {
  $method = new \ReflectionMethod(IconFinder::class, 'getFilesFromPath');
  $logger = $this->createMock(LoggerInterface::class);
  $logger->expects($this->once())
    ->method('warning')
    ->with('Invalid icon path extension @filename.@extension in source: @source');
  $iconFinder = new IconFinder($this->createStub(FileUrlGeneratorInterface::class), $logger, DRUPAL_ROOT);
  $method->invoke($iconFinder, self::TEST_ICONS_PATH . '/icons/flat/foo.webp', '');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.