public function PathautoBulkUpdateTest::testBulkUpdateExistingContent in Pathauto 8
Tests alias generation for nodes that existed before installing Pathauto.
File
- tests/
src/ Functional/ PathautoBulkUpdateTest.php, line 142
Class
- PathautoBulkUpdateTest
- Bulk update functionality tests.
Namespace
Drupal\Tests\pathauto\FunctionalCode
public function testBulkUpdateExistingContent() {
// Create a node.
$node = $this
->drupalCreateNode();
// Delete its alias and Pathauto metadata.
\Drupal::service('pathauto.alias_storage_helper')
->deleteEntityPathAll($node);
$node->path
->first()
->get('pathauto')
->purge();
\Drupal::entityTypeManager()
->getStorage('node')
->resetCache([
$node
->id(),
]);
// Execute bulk generation.
// Bulk create aliases.
$edit = [
'update[canonical_entities:node]' => TRUE,
];
$this
->drupalPostForm('admin/config/search/path/update_bulk', $edit, t('Update'));
// Verify that the alias was created for the node.
$this
->assertText('Generated 1 URL alias.');
}