You are here

public function PathautoKernelTest::testPathDeleteMultiple in Pathauto 8

Test pathauto_path_delete_multiple().

File

tests/src/Kernel/PathautoKernelTest.php, line 260

Class

PathautoKernelTest
Unit tests for Pathauto functions.

Namespace

Drupal\Tests\pathauto\Kernel

Code

public function testPathDeleteMultiple() {
  $this
    ->createPathAlias('/node/1', '/node-1-alias');
  $this
    ->createPathAlias('/node/1/view', '/node-1-alias/view');
  $this
    ->createPathAlias('/node/1', '/node-1-alias-en', 'en');
  $this
    ->createPathAlias('/node/1', '/node-1-alias-fr', 'fr');
  $this
    ->createPathAlias('/node/2', '/node-2-alias');
  $this
    ->createPathAlias('/node/10', '/node-10-alias');
  \Drupal::service('pathauto.alias_storage_helper')
    ->deleteBySourcePrefix('/node/1');
  $this
    ->assertNoAliasExists([
    'path' => "/node/1",
  ]);
  $this
    ->assertNoAliasExists([
    'path' => "/node/1/view",
  ]);
  $this
    ->assertAliasExists([
    'path' => "/node/2",
  ]);
  $this
    ->assertAliasExists([
    'path' => "/node/10",
  ]);
}