namespace Drupal\pathauto\Tests;
+use Drupal\Core\Url;
use Drupal\simpletest\WebTestBase;
use Drupal\pathauto\Entity\PathautoPattern;
// 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');
$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.');
$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.');
// 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.');