function ImageStyleCustomStreamWrappersTest::testCustomStreamWrappers
Same name in other branches
- 9 core/modules/image/tests/src/Kernel/ImageStyleCustomStreamWrappersTest.php \Drupal\Tests\image\Kernel\ImageStyleCustomStreamWrappersTest::testCustomStreamWrappers()
- 8.9.x core/modules/image/tests/src/Kernel/ImageStyleCustomStreamWrappersTest.php \Drupal\Tests\image\Kernel\ImageStyleCustomStreamWrappersTest::testCustomStreamWrappers()
- 11.x core/modules/image/tests/src/Kernel/ImageStyleCustomStreamWrappersTest.php \Drupal\Tests\image\Kernel\ImageStyleCustomStreamWrappersTest::testCustomStreamWrappers()
Tests derivative creation with several source on a local writable stream.
@dataProvider providerTestCustomStreamWrappers
Parameters
string $source_scheme: The source stream wrapper scheme.
string $expected_scheme: The derivative expected stream wrapper scheme.
File
-
core/
modules/ image/ tests/ src/ Kernel/ ImageStyleCustomStreamWrappersTest.php, line 80
Class
- ImageStyleCustomStreamWrappersTest
- Tests derivative generation with source images using stream wrappers.
Namespace
Drupal\Tests\image\KernelCode
public function testCustomStreamWrappers($source_scheme, $expected_scheme) : void {
$derivative_uri = $this->imageStyle
->buildUri("{$source_scheme}://some/path/image.png");
$derivative_scheme = StreamWrapperManager::getScheme($derivative_uri);
// Check that the derivative scheme is the expected scheme.
$this->assertSame($expected_scheme, $derivative_scheme);
// Check that the derivative URI is the expected one.
$expected_uri = "{$expected_scheme}://styles/{$this->imageStyle->id()}/{$source_scheme}/some/path/image.png";
$this->assertSame($expected_uri, $derivative_uri);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.