function IconFinderTest::testGetFilesFromSourcesUrl

Test the IconFinder::getFilesFromSources method with urls.

@dataProvider providerGetFilesFromSourcesUrl

Parameters

array<string> $sources: The list of remote.

array<string, string> $expected: The expected result.

File

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

Class

IconFinderTest
@coversDefaultClass \Drupal\Core\Theme\Icon\IconFinder[[api-linebreak]]

Namespace

Drupal\Tests\Core\Theme\Icon

Code

public function testGetFilesFromSourcesUrl(array $sources, array $expected = []) : void {
  $result = $this->iconFinder
    ->getFilesFromSources($sources, '');
  // Prepare result array matching getFileFromHttpUrl() to minimize test data.
  $expected_result = [];
  foreach ($expected as $expected_icon_id => $expected_source) {
    $expected_result[$expected_icon_id] = [
      'icon_id' => $expected_icon_id,
      'source' => $expected_source,
      'absolute_path' => $expected_source,
    ];
  }
  $this->assertEquals($expected_result, $result);
}

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