function DeprecatedPathHooksTest::testDelete

@covers ::delete

@expectedDeprecation The deprecated hook hook_path_delete() is implemented in these functions: path_deprecated_test_path_delete(). It will be removed before Drupal 9.0.0. Use hook_ENTITY_TYPE_delete() for the 'path_alias' entity type instead. See https://www.drupal.org/node/3013865.

File

core/modules/system/tests/src/Kernel/DeprecatedPathHooksTest.php, line 65

Class

DeprecatedPathHooksTest
@coversDefaultClass \Drupal\Core\Path\AliasStorage

Namespace

Drupal\Tests\system\Kernel

Code

public function testDelete() {
    $source = '/' . $this->randomMachineName();
    $alias = '/' . $this->randomMachineName();
    $alias_storage = \Drupal::service('path.alias_storage');
    $alias_storage->save($source, $alias);
    $path = $alias_storage->load([
        'source' => $source,
    ]);
    $alias_storage->delete([
        'pid' => $path['pid'],
    ]);
}

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