public function ResourceTest::testSetDimensions in Drupal 9
Same name and namespace in other branches
- 8 core/modules/media/tests/src/Unit/ResourceTest.php \Drupal\Tests\media\Unit\ResourceTest::testSetDimensions()
- 10 core/modules/media/tests/src/Unit/ResourceTest.php \Drupal\Tests\media\Unit\ResourceTest::testSetDimensions()
@covers ::setDimensions @dataProvider setDimensionsTestCases
File
- core/
modules/ media/ tests/ src/ Unit/ ResourceTest.php, line 78
Class
- ResourceTest
- @coversDefaultClass \Drupal\media\OEmbed\Resource @group media
Namespace
Drupal\Tests\media\UnitCode
public function testSetDimensions($factory, $width, $height, $exception = NULL, $expected_width = NULL, $expected_height = NULL) {
if ($exception) {
$this
->expectException(\InvalidArgumentException::class);
$this
->expectExceptionMessage($exception);
}
$resource = Resource::$factory('foo', $width, $height);
$this
->assertSame($expected_width ?: $width, $resource
->getWidth());
$this
->assertSame($expected_height ?: $height, $resource
->getHeight());
}