PathAliasResourceTestBase.php
Same filename in other branches
Namespace
Drupal\Tests\path_alias\Functional\RestFile
-
core/
modules/ path_alias/ tests/ src/ Functional/ Rest/ PathAliasResourceTestBase.php
View source
<?php
namespace Drupal\Tests\path_alias\Functional\Rest;
use Drupal\Core\Language\LanguageInterface;
use Drupal\path_alias\Entity\PathAlias;
use Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
/**
* Base class for path_alias EntityResource tests.
*/
abstract class PathAliasResourceTestBase extends EntityResourceTestBase {
use BcTimestampNormalizerUnixTestTrait;
/**
* {@inheritdoc}
*/
public static $modules = [
'path_alias',
];
/**
* {@inheritdoc}
*/
protected static $entityTypeId = 'path_alias';
/**
* {@inheritdoc}
*/
protected static $patchProtectedFieldNames = [];
/**
* {@inheritdoc}
*/
protected static $firstCreatedEntityId = 3;
/**
* {@inheritdoc}
*/
protected static $secondCreatedEntityId = 4;
/**
* {@inheritdoc}
*/
protected function setUpAuthorization($method) {
$this->grantPermissionsToTestedRole([
'administer url aliases',
]);
}
/**
* {@inheritdoc}
*/
protected function createEntity() {
$path_alias = PathAlias::create([
'path' => '/<front>',
'alias' => '/frontpage1',
]);
$path_alias->save();
return $path_alias;
}
/**
* {@inheritdoc}
*/
protected function getExpectedNormalizedEntity() {
return [
'id' => [
[
'value' => 1,
],
],
'revision_id' => [
[
'value' => 1,
],
],
'langcode' => [
[
'value' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
],
],
'path' => [
[
'value' => '/<front>',
],
],
'alias' => [
[
'value' => '/frontpage1',
],
],
'status' => [
[
'value' => TRUE,
],
],
'uuid' => [
[
'value' => $this->entity
->uuid(),
],
],
];
}
/**
* {@inheritdoc}
*/
protected function getNormalizedPostEntity() {
return [
'path' => [
[
'value' => '/<front>',
],
],
'alias' => [
[
'value' => '/frontpage1',
],
],
];
}
/**
* {@inheritdoc}
*/
protected function getExpectedCacheContexts() {
return [
'user.permissions',
];
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
PathAliasResourceTestBase | Base class for path_alias EntityResource tests. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.