function ResourceTest::testSetDimensions

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

Code

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());
}

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