function ResourceTest::testSetDimensions

Same name in other branches
  1. 9 core/modules/media/tests/src/Unit/ResourceTest.php \Drupal\Tests\media\Unit\ResourceTest::testSetDimensions()
  2. 8.9.x core/modules/media/tests/src/Unit/ResourceTest.php \Drupal\Tests\media\Unit\ResourceTest::testSetDimensions()
  3. 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 80

Class

ResourceTest
@coversDefaultClass \Drupal\media\OEmbed\Resource @group media

Namespace

Drupal\Tests\media\Unit

Code

public function testSetDimensions($factory, $width, $height, $exception = NULL, $expected_width = NULL, $expected_height = NULL) : void {
    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());
}

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