function IconFinderTest::testGetFileContents

Test the IconFinder::getFileContents method.

Attributes

#[DataProvider('providerGetFileContents')]

Parameters

string $uri: The uri to test result.

bool $expected: The result of the file content is expected or not.

File

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

Class

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

Namespace

Drupal\Tests\Core\Theme\Icon

Code

public function testGetFileContents(string $uri, bool $expected) : void {
  if ($expected) {
    $result = $this->iconFinder
      ->getFileContents($uri);
    $this->assertEquals(file_get_contents($uri), $result);
    return;
  }
  $this->assertFalse($this->iconFinder
    ->getFileContents($uri));
}

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