You are here

public function UrlTest::testMergeOptions in Drupal 8

Tests the mergeOptions() method.

@covers ::mergeOptions

File

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

Class

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

Namespace

Drupal\Tests\Core

Code

public function testMergeOptions() {
  $url = Url::fromRoute('test_route', [], [
    'foo' => 'bar',
    'bar' => [
      'key' => 'value',
    ],
  ]);
  $url
    ->mergeOptions([
    'bar' => [
      'key' => 'value1',
      'key2' => 'value2',
    ],
  ]);
  $this
    ->assertEquals([
    'foo' => 'bar',
    'bar' => [
      'key' => 'value1',
      'key2' => 'value2',
    ],
  ], $url
    ->getOptions());
}