You are here

public function UrlTest::testSetOptions in Drupal 8

Tests the setOptions() method.

@covers ::setOptions

File

core/tests/Drupal/Tests/Core/UrlTest.php, line 474
Contains \Drupal\Tests\Core\UrlTest.

Class

UrlTest
@coversDefaultClass \Drupal\Core\Url @group UrlTest

Namespace

Drupal\Tests\Core

Code

public function testSetOptions() {
  $url = Url::fromRoute('test_route', []);
  $this
    ->assertEquals([], $url
    ->getOptions());
  $url
    ->setOptions([
    'foo' => 'bar',
  ]);
  $this
    ->assertEquals([
    'foo' => 'bar',
  ], $url
    ->getOptions());
  $url
    ->setOptions([]);
  $this
    ->assertEquals([], $url
    ->getOptions());
}