Commit 6aa4b7c6 authored by Berdir's avatar Berdir Committed by Berdir
Browse files

Issue #3004108 by bobbygryzynger, Berdir, hugronaphor, andreyjan, Sahana _N:...

Issue #3004108 by bobbygryzynger, Berdir, hugronaphor, andreyjan, Sahana _N: ContextDefinition object for an entity type is deprecated
parent e70ac57b
name : 'Pathauto'
description : 'Provides a mechanism for modules to automatically generate aliases for the content they manage.'
core: 8.x
core_version_requirement: ^8.7.7 || ^9
type: module
dependencies:
- ctools:ctools
- drupal:path
- drupal:system (>=8.6)
- token:token
configure: entity.pathauto_pattern.collection
......
......@@ -6,7 +6,6 @@ use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\Core\Plugin\Context\ContextDefinition;
use Drupal\Core\Plugin\Context\EntityContextDefinition;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
......@@ -86,8 +85,8 @@ class EntityAliasTypeDeriver extends DeriverBase implements ContainerDeriverInte
$this->derivatives[$entity_type_id]['label'] = $entity_type->getLabel();
$this->derivatives[$entity_type_id]['types'] = [$this->tokenEntityMapper->getTokenTypeForEntityType($entity_type_id)];
$this->derivatives[$entity_type_id]['provider'] = $entity_type->getProvider();
$this->derivatives[$entity_type_id]['context'] = [
$entity_type_id => EntityContextDefinition::fromEntityType($entity_type)->setLabel($this->t('@label being aliased', ['@label' => $entity_type->getLabel()]))
$this->derivatives[$entity_type_id]['context_definitions'] = [
$entity_type_id => new EntityContextDefinition("entity:$entity_type_id", $this->t('@label being aliased', ['@label' => $entity_type->getLabel()]))
];
}
}
......
......@@ -19,7 +19,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* label = @Translation("Forum"),
* types = {"term"},
* provider = "forum",
* context = {
* context_definitions = {
* "taxonomy_term" = @ContextDefinition("entity:taxonomy_term")
* }
* )
......
name: 'Pathauto testing module'
type: module
core: '8.x'
core_version_requirement: ^8.7.7 || ^9
description: 'Pathauto for Entity with string ID.'
package: Testing
dependencies:
......
......@@ -2,6 +2,6 @@ name: 'Views Test Config'
type: module
description: 'Provides default views for tests.'
package: Testing
core: 8.x
core_version_requirement: ^8.7.7 || ^9
dependencies:
- drupal:views
......@@ -15,6 +15,11 @@ class PathautoBulkUpdateTest extends BrowserTestBase {
use PathautoTestHelperTrait;
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stable';
/**
* Modules to enable.
*
......
......@@ -16,6 +16,11 @@ class PathautoEnablingEntityTypesTest extends BrowserTestBase {
use CommentTestTrait;
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stable';
/**
* Modules to enable.
*
......
......@@ -14,6 +14,11 @@ class PathautoMassDeleteTest extends BrowserTestBase {
use PathautoTestHelperTrait;
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stable';
/**
* Modules to enable.
*
......
......@@ -16,6 +16,11 @@ class PathautoNodeWebTest extends BrowserTestBase {
use PathautoTestHelperTrait;
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stable';
/**
* Modules to enable.
*
......
......@@ -14,6 +14,11 @@ class PathautoSettingsFormWebTest extends BrowserTestBase {
use PathautoTestHelperTrait;
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stable';
/**
* Modules to enable.
*
......
......@@ -13,6 +13,11 @@ class PathautoTaxonomyWebTest extends BrowserTestBase {
use PathautoTestHelperTrait;
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stable';
/**
* Modules to enable.
*
......
......@@ -129,7 +129,7 @@ trait PathautoTestHelperTrait {
public function assertAliasExists($conditions) {
$path = \Drupal::service('path.alias_storage')->load($conditions);
$this->assertTrue($path, t('Alias with conditions @conditions found.', ['@conditions' => var_export($conditions, TRUE)]));
$this->assertNotEmpty($path, t('Alias with conditions @conditions found.', ['@conditions' => var_export($conditions, TRUE)]));
return $path;
}
......
......@@ -15,6 +15,11 @@ class PathautoUserWebTest extends BrowserTestBase {
use PathautoTestHelperTrait;
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stable';
/**
* Modules to enable.
*
* @var array
......
......@@ -18,6 +18,11 @@ class PathautoLocaleTest extends WebDriverTestBase {
use PathautoTestHelperTrait;
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stable';
/**
* Modules to enable.
*
......
......@@ -16,6 +16,11 @@ class PathautoUiTest extends WebDriverTestBase {
use PathautoTestHelperTrait;
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stable';
/**
* Modules to enable.
*
......@@ -63,15 +68,15 @@ class PathautoUiTest extends WebDriverTestBase {
}
function testPatternsWorkflow() {
$this->drupalPlaceBlock('local_tasks_block');
$this->drupalPlaceBlock('local_tasks_block', ['id' => 'local-tasks-block']);
$this->drupalPlaceBlock('local_actions_block');
$this->drupalPlaceBlock('page_title_block');
$this->drupalGet('admin/config/search/path');
$this->assertSession()->elementContains('css', '.block-local-tasks-block', 'Patterns');
$this->assertSession()->elementContains('css', '.block-local-tasks-block', 'Settings');
$this->assertSession()->elementContains('css', '.block-local-tasks-block', 'Bulk generate');
$this->assertSession()->elementContains('css', '.block-local-tasks-block', 'Delete aliases');
$this->assertSession()->elementContains('css', '#block-local-tasks-block', 'Patterns');
$this->assertSession()->elementContains('css', '#block-local-tasks-block', 'Settings');
$this->assertSession()->elementContains('css', '#block-local-tasks-block', 'Bulk generate');
$this->assertSession()->elementContains('css', '#block-local-tasks-block', 'Delete aliases');
$this->drupalGet('admin/config/search/path/patterns');
$this->clickLink('Add Pathauto pattern');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment