function PathautoBulkUpdateTestCase::testBulkUpdate in Pathauto 6.2
Same name and namespace in other branches
- 7 pathauto.test \PathautoBulkUpdateTestCase::testBulkUpdate()
File
- ./
pathauto.test, line 706 - Functionality tests for Pathauto.
Class
- PathautoBulkUpdateTestCase
- Bulk update functionality tests.
Code
function testBulkUpdate() {
// Create some nodes.
$this->nodes = array();
for ($i = 1; $i <= 5; $i++) {
$node = $this
->drupalCreateNode();
$this->nodes[$node->nid] = $node;
}
// Clear out all aliases.
$this
->deleteAllAliases();
// Bulk create aliases.
$edit = array(
'update[node_pathauto_bulk_update_batch_process]' => TRUE,
'update[user_pathauto_bulk_update_batch_process]' => TRUE,
);
$this
->drupalPost('admin/build/path/update_bulk', $edit, t('Update'));
$this
->assertText('Generated 7 URL aliases.');
// 5 nodes + 2 users
// Check that aliases have actually been created.
foreach ($this->nodes as $node) {
$this
->assertEntityAliasExists('node', $node);
}
$this
->assertEntityAliasExists('user', $this->admin_user);
// Add a new node.
$new_node = $this
->drupalCreateNode(array(
'alias' => '',
'pathauto_perform_alias' => FALSE,
));
// Run the update again which should only run against the new node.
$this
->drupalPost('admin/build/path/update_bulk', $edit, t('Update'));
$this
->assertText('Generated 1 URL alias.');
// 1 node + 0 users
$this
->assertEntityAliasExists('node', $new_node);
}