You are here

public function LinkBindingTest::testOnIndexed in Drupal 7 to 8/9 Module Upgrader 8

File

tests/src/Unit/Routing/LinkBinding/LinkBindingTest.php, line 49

Class

LinkBindingTest
@group DMU.Routing

Namespace

Drupal\Tests\drupalmoduleupgrader\Unit\Routing\LinkBinding

Code

public function testOnIndexed() {
  $binding = $this
    ->getMockBinding();
  $index = new LinkIndex();
  $index
    ->addBinding($binding);
  $this
    ->assertSame('diff.settings', $binding
    ->getIdentifier());

  // If a binding is added with the same identifier (which could easily happen,
  // depending on how the binding computes its identifier), _0, _1, etc. should
  // be appended to it by the index.
  $clone = clone $binding;
  $index
    ->addBinding($clone);
  $this
    ->assertSame('diff.settings_0', $clone
    ->getIdentifier());
}