Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
|
@ -44,7 +44,7 @@ class PathautoBulkUpdateTest extends WebTestBase {
|
|||
protected $patterns;
|
||||
|
||||
/**
|
||||
* {inheritdoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
@ -103,7 +103,7 @@ class PathautoBulkUpdateTest extends WebTestBase {
|
|||
$this->assertText('No new URL aliases to generate.');
|
||||
$this->assertNoEntityAliasExists($new_node);
|
||||
|
||||
// Make sure existing aliases can be overriden.
|
||||
// Make sure existing aliases can be overridden.
|
||||
$this->drupalPostForm('admin/config/search/path/settings', ['update_action' => PathautoGeneratorInterface::UPDATE_ACTION_DELETE], t('Save configuration'));
|
||||
|
||||
// Patterns did not change, so no aliases should be regenerated.
|
||||
|
@ -111,16 +111,17 @@ class PathautoBulkUpdateTest extends WebTestBase {
|
|||
$this->drupalPostForm('admin/config/search/path/update_bulk', $edit, t('Update'));
|
||||
$this->assertText('No new URL aliases to generate.');
|
||||
|
||||
// Update the node pattern, and leave other patterns alone. Existing nodes should get a new alias,
|
||||
// except the node above whose alias is manually set. Other aliases must be left alone.
|
||||
// Update the node pattern, and leave other patterns alone. Existing nodes
|
||||
// should get a new alias, except the node above whose alias is manually
|
||||
// set. Other aliases must be left alone.
|
||||
$this->patterns['node']->delete();
|
||||
$this->patterns['node'] = $this->createPattern('node', '/archive/node-[node:nid]');
|
||||
|
||||
$this->drupalPostForm('admin/config/search/path/update_bulk', $edit, t('Update'));
|
||||
$this->assertText('Generated 5 URL aliases.');
|
||||
|
||||
// Prevent existing aliases to be overriden. The bulk generate page should only offer
|
||||
// to create an alias for paths which have none.
|
||||
// Prevent existing aliases to be overridden. The bulk generate page should
|
||||
// only offer to create an alias for paths which have none.
|
||||
$this->drupalPostForm('admin/config/search/path/settings', ['update_action' => PathautoGeneratorInterface::UPDATE_ACTION_NO_NEW], t('Save configuration'));
|
||||
|
||||
$this->drupalGet('admin/config/search/path/update_bulk');
|
||||
|
|
|
@ -13,6 +13,7 @@ use Drupal\comment\Tests\CommentTestTrait;
|
|||
class PathautoEnablingEntityTypesTest extends WebTestBase {
|
||||
|
||||
use PathautoTestHelperTrait;
|
||||
|
||||
use CommentTestTrait;
|
||||
|
||||
/**
|
||||
|
@ -30,7 +31,7 @@ class PathautoEnablingEntityTypesTest extends WebTestBase {
|
|||
protected $adminUser;
|
||||
|
||||
/**
|
||||
* {inheritdoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
|
|
@ -87,7 +87,21 @@ class PathautoLocaleTest extends WebTestBase {
|
|||
* Test that patterns work on multilingual content.
|
||||
*/
|
||||
function testLanguagePatterns() {
|
||||
$this->drupalLogin($this->rootUser);
|
||||
|
||||
// Allow other modules to add additional permissions for the admin user.
|
||||
$permissions = array(
|
||||
'administer pathauto',
|
||||
'administer url aliases',
|
||||
'create url aliases',
|
||||
'bypass node access',
|
||||
'access content overview',
|
||||
'administer languages',
|
||||
'translate any entity',
|
||||
'administer content translation'
|
||||
|
||||
);
|
||||
$admin_user = $this->drupalCreateUser($permissions);
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
// Add French language.
|
||||
$edit = array(
|
||||
|
@ -134,8 +148,9 @@ class PathautoLocaleTest extends WebTestBase {
|
|||
'title[0][value]' => 'English node',
|
||||
'langcode[0][value]' => 'en',
|
||||
);
|
||||
$this->drupalPostForm('node/add/article', $edit, t('Save and publish'));
|
||||
$this->drupalPostForm('node/add/article', $edit, t('Save'));
|
||||
$english_node = $this->drupalGetNodeByTitle('English node');
|
||||
return;
|
||||
$this->assertAlias('/node/' . $english_node->id(), '/the-articles/english-node', 'en');
|
||||
|
||||
$this->drupalGet('node/' . $english_node->id() . '/translations');
|
||||
|
@ -143,7 +158,7 @@ class PathautoLocaleTest extends WebTestBase {
|
|||
$edit = array(
|
||||
'title[0][value]' => 'French node',
|
||||
);
|
||||
$this->drupalPostForm(NULL, $edit, t('Save and keep published (this translation)'));
|
||||
$this->drupalPostForm(NULL, $edit, t('Save (this translation)'));
|
||||
$this->rebuildContainer();
|
||||
$english_node = $this->drupalGetNodeByTitle('English node');
|
||||
$french_node = $english_node->getTranslation('fr');
|
||||
|
|
|
@ -49,9 +49,8 @@ class PathautoMassDeleteTest extends WebTestBase {
|
|||
*/
|
||||
protected $terms;
|
||||
|
||||
|
||||
/**
|
||||
* {inheritdoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
@ -136,14 +135,16 @@ class PathautoMassDeleteTest extends WebTestBase {
|
|||
* Helper function to generate aliases.
|
||||
*/
|
||||
function generateAliases() {
|
||||
// Delete all aliases to avoid duplicated aliases. They will be recreated below.
|
||||
// Delete all aliases to avoid duplicated aliases. They will be recreated
|
||||
// below.
|
||||
$this->deleteAllAliases();
|
||||
|
||||
// We generate a bunch of aliases for nodes, users and taxonomy terms. If
|
||||
// the entities are already created we just update them, otherwise we create
|
||||
// them.
|
||||
if (empty($this->nodes)) {
|
||||
// Create a large number of nodes (100+) to make sure that the batch code works.
|
||||
// Create a large number of nodes (100+) to make sure that the batch code
|
||||
// works.
|
||||
for ($i = 1; $i <= 105; $i++) {
|
||||
// Set the alias of two nodes manually.
|
||||
$settings = ($i > 103) ? ['path' => ['alias' => "/custom_alias_$i", 'pathauto' => PathautoState::SKIP]] : [];
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\pathauto\Tests;
|
||||
|
||||
use Drupal\pathauto\Entity\PathautoPattern;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\pathauto\PathautoState;
|
||||
|
@ -30,7 +31,7 @@ class PathautoNodeWebTest extends WebTestBase {
|
|||
protected $adminUser;
|
||||
|
||||
/**
|
||||
* {inheritdoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
@ -43,7 +44,6 @@ class PathautoNodeWebTest extends WebTestBase {
|
|||
'administer pathauto',
|
||||
'administer url aliases',
|
||||
'create url aliases',
|
||||
'administer nodes',
|
||||
'bypass node access',
|
||||
'access content overview',
|
||||
);
|
||||
|
@ -57,14 +57,15 @@ class PathautoNodeWebTest extends WebTestBase {
|
|||
* Tests editing nodes with different settings.
|
||||
*/
|
||||
function testNodeEditing() {
|
||||
// Ensure that the Pathauto checkbox is checked by default on the node add form.
|
||||
// Ensure that the Pathauto checkbox is checked by default on the node add
|
||||
// form.
|
||||
$this->drupalGet('node/add/page');
|
||||
$this->assertFieldChecked('edit-path-0-pathauto');
|
||||
|
||||
// Create a node by saving the node form.
|
||||
$title = ' Testing: node title [';
|
||||
$automatic_alias = '/content/testing-node-title';
|
||||
$this->drupalPostForm(NULL, array('title[0][value]' => $title), t('Save and publish'));
|
||||
$this->drupalPostForm(NULL, array('title[0][value]' => $title), t('Save'));
|
||||
$node = $this->drupalGetNodeByTitle($title);
|
||||
|
||||
// Look for alias generated in the form.
|
||||
|
@ -82,7 +83,7 @@ class PathautoNodeWebTest extends WebTestBase {
|
|||
'path[0][pathauto]' => FALSE,
|
||||
'path[0][alias]' => $manual_alias,
|
||||
);
|
||||
$this->drupalPostForm($node->toUrl('edit-form'), $edit, t('Save and keep published'));
|
||||
$this->drupalPostForm($node->toUrl('edit-form'), $edit, t('Save'));
|
||||
$this->assertText(t('@type @title has been updated.', array('@type' => 'page', '@title' => $title)));
|
||||
|
||||
// Check that the automatic alias checkbox is now unchecked by default.
|
||||
|
@ -91,7 +92,7 @@ class PathautoNodeWebTest extends WebTestBase {
|
|||
$this->assertFieldByName('path[0][alias]', $manual_alias);
|
||||
|
||||
// Submit the node form with the default values.
|
||||
$this->drupalPostForm(NULL, array('path[0][pathauto]' => FALSE), t('Save and keep published'));
|
||||
$this->drupalPostForm(NULL, array('path[0][pathauto]' => FALSE), t('Save'));
|
||||
$this->assertText(t('@type @title has been updated.', array('@type' => 'page', '@title' => $title)));
|
||||
|
||||
// Test that the old (automatic) alias has been deleted and only accessible
|
||||
|
@ -109,7 +110,7 @@ class PathautoNodeWebTest extends WebTestBase {
|
|||
'path[0][pathauto]' => TRUE,
|
||||
'path[0][alias]' => '/should-not-get-created',
|
||||
);
|
||||
$this->drupalPostForm('node/add/page', $edit, t('Save and publish'));
|
||||
$this->drupalPostForm('node/add/page', $edit, t('Save'));
|
||||
$this->assertNoAliasExists(array('alias' => 'should-not-get-created'));
|
||||
$node = $this->drupalGetNodeByTitle($title);
|
||||
$this->assertEntityAlias($node, '/content/automatic-title');
|
||||
|
@ -130,7 +131,7 @@ class PathautoNodeWebTest extends WebTestBase {
|
|||
$edit = array();
|
||||
$edit['title'] = 'My test article';
|
||||
$this->drupalCreateNode($edit);
|
||||
//$this->drupalPostForm(NULL, $edit, t('Save and keep published'));
|
||||
//$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$node = $this->drupalGetNodeByTitle($edit['title']);
|
||||
|
||||
// Pathauto checkbox should still not exist.
|
||||
|
@ -271,7 +272,7 @@ class PathautoNodeWebTest extends WebTestBase {
|
|||
'title[0][value]' => 'Sample article',
|
||||
'path[0][alias]' => '/sample-article',
|
||||
];
|
||||
$this->drupalPostForm('node/add/article', $edit, t('Save and publish'));
|
||||
$this->drupalPostForm('node/add/article', $edit, t('Save'));
|
||||
$this->assertText(t('article Sample article has been created.'));
|
||||
|
||||
// Test the alias.
|
||||
|
|
|
@ -85,7 +85,7 @@ class PathautoSettingsFormWebTest extends WebTestBase {
|
|||
);
|
||||
|
||||
/**
|
||||
* {inheritdoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
@ -97,7 +97,6 @@ class PathautoSettingsFormWebTest extends WebTestBase {
|
|||
'notify of path changes',
|
||||
'administer url aliases',
|
||||
'create url aliases',
|
||||
'administer nodes',
|
||||
'bypass node access',
|
||||
);
|
||||
$this->adminUser = $this->drupalCreateUser($permissions);
|
||||
|
@ -133,11 +132,11 @@ class PathautoSettingsFormWebTest extends WebTestBase {
|
|||
$title = 'Verbose settings test';
|
||||
$this->drupalGet('/node/add/article');
|
||||
$this->assertFieldChecked('edit-path-0-pathauto');
|
||||
$this->drupalPostForm(NULL, array('title[0][value]' => $title), t('Save and publish'));
|
||||
$this->drupalPostForm(NULL, array('title[0][value]' => $title), t('Save'));
|
||||
$this->assertText('Created new alias /content/verbose-settings-test for');
|
||||
|
||||
$node = $this->drupalGetNodeByTitle($title);
|
||||
$this->drupalPostForm('/node/' . $node->id() . '/edit', array('title[0][value]' => 'Updated title'), t('Save and keep published'));
|
||||
$this->drupalPostForm('/node/' . $node->id() . '/edit', array('title[0][value]' => 'Updated title'), t('Save'));
|
||||
$this->assertText('Created new alias /content/updated-title for');
|
||||
$this->assertText('replacing /content/verbose-settings-test.');
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class PathautoTaxonomyWebTest extends WebTestBase {
|
|||
protected $adminUser;
|
||||
|
||||
/**
|
||||
* {inheritdoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
@ -45,7 +45,6 @@ class PathautoTaxonomyWebTest extends WebTestBase {
|
|||
$this->createPattern('taxonomy_term', '/[term:vocabulary]/[term:name]');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Basic functional testing of Pathauto with taxonomy terms.
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Drupal\pathauto\Tests;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Language\Language;
|
||||
use Drupal\Core\Render\BubbleableMetadata;
|
||||
|
@ -34,7 +33,7 @@ trait PathautoTestHelperTrait {
|
|||
$type = ($entity_type_id == 'forum') ? 'forum' : 'canonical_entities:' . $entity_type_id;
|
||||
|
||||
$pattern = PathautoPattern::create([
|
||||
'id' => Unicode::strtolower($this->randomMachineName()),
|
||||
'id' => mb_strtolower($this->randomMachineName()),
|
||||
'type' => $type,
|
||||
'pattern' => $pattern,
|
||||
'weight' => $weight,
|
||||
|
@ -51,7 +50,7 @@ trait PathautoTestHelperTrait {
|
|||
* @param string $entity_type
|
||||
* The entity type ID.
|
||||
* @param string $bundle
|
||||
* The bundle
|
||||
* The bundle.
|
||||
*/
|
||||
protected function addBundleCondition(PathautoPatternInterface $pattern, $entity_type, $bundle) {
|
||||
$plugin_id = $entity_type == 'node' ? 'node_type' : 'entity_bundle:' . $entity_type;
|
||||
|
@ -142,10 +141,11 @@ trait PathautoTestHelperTrait {
|
|||
|
||||
/**
|
||||
* @param array $values
|
||||
*
|
||||
* @return \Drupal\taxonomy\VocabularyInterface
|
||||
*/
|
||||
public function addVocabulary(array $values = array()) {
|
||||
$name = Unicode::strtolower($this->randomMachineName(5));
|
||||
$name = mb_strtolower($this->randomMachineName(5));
|
||||
$values += array(
|
||||
'name' => $name,
|
||||
'vid' => $name,
|
||||
|
@ -158,7 +158,7 @@ trait PathautoTestHelperTrait {
|
|||
|
||||
public function addTerm(VocabularyInterface $vocabulary, array $values = array()) {
|
||||
$values += array(
|
||||
'name' => Unicode::strtolower($this->randomMachineName(5)),
|
||||
'name' => mb_strtolower($this->randomMachineName(5)),
|
||||
'vid' => $vocabulary->id(),
|
||||
);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Drupal\pathauto\Tests;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\pathauto\Entity\PathautoPattern;
|
||||
|
||||
|
@ -29,7 +30,7 @@ class PathautoUiTest extends WebTestBase {
|
|||
protected $adminUser;
|
||||
|
||||
/**
|
||||
* {inheritdoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
@ -132,7 +133,8 @@ class PathautoUiTest extends WebTestBase {
|
|||
// Edit workflow, set a new label and weight for the pattern.
|
||||
$this->drupalPostForm('/admin/config/search/path/patterns', ['entities[page_pattern][weight]' => '4'], t('Save'));
|
||||
$this->clickLink(t('Edit'));
|
||||
$this->assertUrl('/admin/config/search/path/patterns/page_pattern');
|
||||
$destination_query = ['query' => ['destination' => Url::fromRoute('entity.pathauto_pattern.collection')->toString()]];
|
||||
$this->assertUrl('/admin/config/search/path/patterns/page_pattern', $destination_query);
|
||||
$this->assertFieldByName('pattern', '[node:title]');
|
||||
$this->assertFieldByName('label', 'Page pattern');
|
||||
$this->assertFieldChecked('edit-status');
|
||||
|
@ -148,7 +150,7 @@ class PathautoUiTest extends WebTestBase {
|
|||
$this->drupalGet('/admin/config/search/path/patterns');
|
||||
$this->assertNoLink(t('Enable'));
|
||||
$this->clickLink(t('Disable'));
|
||||
$this->assertUrl('/admin/config/search/path/patterns/page_pattern/disable');
|
||||
$this->assertUrl('/admin/config/search/path/patterns/page_pattern/disable', $destination_query);
|
||||
$this->drupalPostForm(NULL, [], t('Disable'));
|
||||
$this->assertText('Disabled pattern Test.');
|
||||
|
||||
|
@ -167,7 +169,7 @@ class PathautoUiTest extends WebTestBase {
|
|||
$this->drupalGet('/admin/config/search/path/patterns');
|
||||
$this->assertNoLink(t('Disable'));
|
||||
$this->clickLink(t('Enable'));
|
||||
$this->assertUrl('/admin/config/search/path/patterns/page_pattern/enable');
|
||||
$this->assertUrl('/admin/config/search/path/patterns/page_pattern/enable', $destination_query);
|
||||
$this->drupalPostForm(NULL, [], t('Enable'));
|
||||
$this->assertText('Enabled pattern Test.');
|
||||
|
||||
|
@ -178,7 +180,7 @@ class PathautoUiTest extends WebTestBase {
|
|||
// Delete workflow.
|
||||
$this->drupalGet('/admin/config/search/path/patterns');
|
||||
$this->clickLink(t('Delete'));
|
||||
$this->assertUrl('/admin/config/search/path/patterns/page_pattern/delete');
|
||||
$this->assertUrl('/admin/config/search/path/patterns/page_pattern/delete', $destination_query);
|
||||
$this->assertText(t('This action cannot be undone.'));
|
||||
$this->drupalPostForm(NULL, [], t('Delete'));
|
||||
$this->assertText('The pathauto pattern Test has been deleted.');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\pathauto\Tests;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\views\Views;
|
||||
|
||||
|
@ -29,7 +29,7 @@ class PathautoUserWebTest extends WebTestBase {
|
|||
protected $adminUser;
|
||||
|
||||
/**
|
||||
* {inheritdoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
@ -47,7 +47,6 @@ class PathautoUserWebTest extends WebTestBase {
|
|||
$this->createPattern('user', '/users/[user:name]');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Basic functional testing of Pathauto with users.
|
||||
*/
|
||||
|
@ -71,7 +70,6 @@ class PathautoUserWebTest extends WebTestBase {
|
|||
$view->initDisplay();
|
||||
$view->preview('page_1');
|
||||
|
||||
|
||||
foreach ($view->result as $key => $row) {
|
||||
if ($view->field['name']->getValue($row) == $account->getUsername()) {
|
||||
break;
|
||||
|
@ -85,7 +83,7 @@ class PathautoUserWebTest extends WebTestBase {
|
|||
$this->drupalPostForm('admin/people', $edit, t('Apply to selected items'));
|
||||
$this->assertText('Update URL alias was applied to 1 item.');
|
||||
|
||||
$this->assertEntityAlias($account, '/users/' . Unicode::strtolower($account->getUsername()));
|
||||
$this->assertEntityAlias($account, '/users/' . mb_strtolower($account->getUsername()));
|
||||
$this->assertEntityAlias($this->adminUser, '/user/' . $this->adminUser->id());
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue