protected function PathautoTest::pathautoTestSetup in Entity Share 8.2
Same name and namespace in other branches
- 8.3 modules/entity_share_client/tests/src/Functional/PathautoTest.php \Drupal\Tests\entity_share_client\Functional\PathautoTest::pathautoTestSetup()
Helper function.
Parameters
string $behavior: The behavior of the pathauto field enahancer plugin.
3 calls to PathautoTest::pathautoTestSetup()
- PathautoTest::testExposeCurrentState in modules/
entity_share_client/ tests/ src/ Functional/ PathautoTest.php - Test pathauto plugin.
- PathautoTest::testForceDisable in modules/
entity_share_client/ tests/ src/ Functional/ PathautoTest.php - Test pathauto plugin.
- PathautoTest::testForceEnable in modules/
entity_share_client/ tests/ src/ Functional/ PathautoTest.php - Test pathauto plugin.
File
- modules/
entity_share_client/ tests/ src/ Functional/ PathautoTest.php, line 134
Class
- PathautoTest
- General functional test class for path field.
Namespace
Drupal\Tests\entity_share_client\FunctionalCode
protected function pathautoTestSetup($behavior) {
$this->entityTypeManager
->getStorage('jsonapi_resource_config')
->create([
'id' => 'node--es_test',
'disabled' => FALSE,
'path' => 'node/es_test',
'resourceType' => 'node--es_test',
'resourceFields' => [
'path' => [
'fieldName' => 'path',
'publicName' => 'path',
'enhancer' => [
'id' => 'entity_share_pathauto',
'settings' => [
'behavior' => $behavior,
],
],
'disabled' => FALSE,
],
],
])
->save();
/** @var \Drupal\Core\Config\Entity\ConfigEntityStorageInterface $pathauto_pattern_storage */
$pathauto_pattern_storage = $this->entityTypeManager
->getStorage('pathauto_pattern');
/** @var \Drupal\pathauto\PathautoPatternInterface $pattern */
$pattern = $pathauto_pattern_storage
->create([
'id' => 'server',
'label' => 'Test',
'type' => 'canonical_entities:node',
'pattern' => 'server/[node:title]',
]);
$pattern
->save();
$this
->prepareContent();
$this
->populateRequestService();
$this
->deleteContent();
/** @var \Drupal\pathauto\PathautoPatternInterface $pattern */
$pattern = $pathauto_pattern_storage
->create([
'id' => 'client',
'label' => 'Test',
'type' => 'canonical_entities:node',
'pattern' => 'client/[node:title]',
]);
$pattern
->save();
$this
->pullEveryChannels();
}