Loading modules/redirect_404/src/Plugin/views/field/Redirect404Operations.php +7 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,13 @@ class Redirect404Operations extends FieldPluginBase { */ protected $renderer; /** * The current user. * * @var \Drupal\Core\Session\AccountInterface */ protected $currentUser; /** * Constructor for the redirect operations view field. * Loading tests/src/Functional/RedirectUITest.php +25 −5 Original line number Diff line number Diff line Loading @@ -19,24 +19,44 @@ class RedirectUITest extends BrowserTestBase { use AssertRedirectTrait; /** * The admin user. * * @var \Drupal\Core\Session\AccountInterface */ protected $adminUser; /** * The redirect repository. * * @var \Drupal\redirect\RedirectRepository */ protected $repository; /** * The Sql conntent entity storage. * * @var \Drupal\Core\Entity\Sql\SqlContentEntityStorage */ protected $storage; /** * The maximum redirects. * * @var int */ public $maximumRedirects; /** * {@inheritdoc} */ protected static $modules = ['redirect', 'node', 'path', 'dblog', 'views', 'taxonomy']; protected static $modules = [ 'redirect', 'node', 'path', 'dblog', 'views', 'taxonomy', ]; /** * {@inheritdoc} Loading Loading @@ -156,7 +176,7 @@ class RedirectUITest extends BrowserTestBase { /** * Test the redirect loop protection and logging. */ function testRedirectLoop() { public function testRedirectLoop() { // Redirect loop redirection only works when page caching is disabled. \Drupal::service('module_installer')->uninstall(['page_cache']); Loading Loading @@ -194,7 +214,7 @@ class RedirectUITest extends BrowserTestBase { /** * Returns a new vocabulary with random properties. */ function createVocabulary() { public function createVocabulary() { // Create a vocabulary. $vocabulary = Vocabulary::create([ 'name' => $this->randomMachineName(), Loading @@ -210,7 +230,7 @@ class RedirectUITest extends BrowserTestBase { /** * Returns a new term with random properties in vocabulary $vid. */ function createTerm($vocabulary) { public function createTerm($vocabulary) { $filter_formats = filter_formats(); $format = array_pop($filter_formats); $term = Term::create([ Loading tests/src/FunctionalJavascript/RedirectJavascriptTest.php +28 −20 Original line number Diff line number Diff line Loading @@ -13,16 +13,22 @@ use Drupal\FunctionalJavascriptTests\WebDriverTestBase; class RedirectJavascriptTest extends WebDriverTestBase { /** * The admin user. * * @var \Drupal\Core\Session\AccountInterface */ protected $adminUser; /** * The redirect repository. * * @var \Drupal\redirect\RedirectRepository */ protected $repository; /** * The Sql conntent entity storage. * * @var \Drupal\Core\Entity\Sql\SqlContentEntityStorage */ protected $storage; Loading Loading @@ -75,7 +81,7 @@ class RedirectJavascriptTest extends WebDriverTestBase { 'source_query' => ['key' => 'val', 'key1' => 'val1'], 'redirect' => 'node', 'redirect_options' => ['query' => ['key' => 'val', 'key1' => 'val1']], ] ], ] ); $this->assertSession()->fieldValueEquals('redirect_source[0][path]', 'non-existing?key=val&key1=val1'); Loading Loading @@ -183,7 +189,7 @@ class RedirectJavascriptTest extends WebDriverTestBase { $page->pressButton('Save'); $this->assertSession()->responseContains('The anchor fragments are not allowed.'); // Adding path that starts with / // Adding path that starts with /. $this->drupalGet('admin/config/search/redirect/add'); $page = $this->getSession()->getPage(); $page->fillField('redirect_source[0][path]', '/page-to-redirect'); Loading Loading @@ -247,6 +253,7 @@ class RedirectJavascriptTest extends WebDriverTestBase { 'redirect_bulk_form[0]' => TRUE, 'redirect_bulk_form[1]' => TRUE, ]; $this->getSession()->getPage()->selectFieldOption("action", "redirect_delete_action", TRUE); $this->submitForm($edit, 'Apply to selected items'); $this->assertSession()->pageTextContains('Are you sure you want to delete these redirects?'); $this->clickLink('Cancel'); Loading @@ -261,6 +268,7 @@ class RedirectJavascriptTest extends WebDriverTestBase { $this->assertSession()->addressEquals('admin/config/search/redirect'); // Test the bulk delete action. $this->getSession()->getPage()->selectFieldOption("action", "redirect_delete_action", TRUE); $this->submitForm(['redirect_bulk_form[0]' => TRUE], 'Apply to selected items'); $this->assertSession()->pageTextContains('Are you sure you want to delete this redirect?'); $this->assertSession()->pageTextContains('test27'); Loading Loading
modules/redirect_404/src/Plugin/views/field/Redirect404Operations.php +7 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,13 @@ class Redirect404Operations extends FieldPluginBase { */ protected $renderer; /** * The current user. * * @var \Drupal\Core\Session\AccountInterface */ protected $currentUser; /** * Constructor for the redirect operations view field. * Loading
tests/src/Functional/RedirectUITest.php +25 −5 Original line number Diff line number Diff line Loading @@ -19,24 +19,44 @@ class RedirectUITest extends BrowserTestBase { use AssertRedirectTrait; /** * The admin user. * * @var \Drupal\Core\Session\AccountInterface */ protected $adminUser; /** * The redirect repository. * * @var \Drupal\redirect\RedirectRepository */ protected $repository; /** * The Sql conntent entity storage. * * @var \Drupal\Core\Entity\Sql\SqlContentEntityStorage */ protected $storage; /** * The maximum redirects. * * @var int */ public $maximumRedirects; /** * {@inheritdoc} */ protected static $modules = ['redirect', 'node', 'path', 'dblog', 'views', 'taxonomy']; protected static $modules = [ 'redirect', 'node', 'path', 'dblog', 'views', 'taxonomy', ]; /** * {@inheritdoc} Loading Loading @@ -156,7 +176,7 @@ class RedirectUITest extends BrowserTestBase { /** * Test the redirect loop protection and logging. */ function testRedirectLoop() { public function testRedirectLoop() { // Redirect loop redirection only works when page caching is disabled. \Drupal::service('module_installer')->uninstall(['page_cache']); Loading Loading @@ -194,7 +214,7 @@ class RedirectUITest extends BrowserTestBase { /** * Returns a new vocabulary with random properties. */ function createVocabulary() { public function createVocabulary() { // Create a vocabulary. $vocabulary = Vocabulary::create([ 'name' => $this->randomMachineName(), Loading @@ -210,7 +230,7 @@ class RedirectUITest extends BrowserTestBase { /** * Returns a new term with random properties in vocabulary $vid. */ function createTerm($vocabulary) { public function createTerm($vocabulary) { $filter_formats = filter_formats(); $format = array_pop($filter_formats); $term = Term::create([ Loading
tests/src/FunctionalJavascript/RedirectJavascriptTest.php +28 −20 Original line number Diff line number Diff line Loading @@ -13,16 +13,22 @@ use Drupal\FunctionalJavascriptTests\WebDriverTestBase; class RedirectJavascriptTest extends WebDriverTestBase { /** * The admin user. * * @var \Drupal\Core\Session\AccountInterface */ protected $adminUser; /** * The redirect repository. * * @var \Drupal\redirect\RedirectRepository */ protected $repository; /** * The Sql conntent entity storage. * * @var \Drupal\Core\Entity\Sql\SqlContentEntityStorage */ protected $storage; Loading Loading @@ -75,7 +81,7 @@ class RedirectJavascriptTest extends WebDriverTestBase { 'source_query' => ['key' => 'val', 'key1' => 'val1'], 'redirect' => 'node', 'redirect_options' => ['query' => ['key' => 'val', 'key1' => 'val1']], ] ], ] ); $this->assertSession()->fieldValueEquals('redirect_source[0][path]', 'non-existing?key=val&key1=val1'); Loading Loading @@ -183,7 +189,7 @@ class RedirectJavascriptTest extends WebDriverTestBase { $page->pressButton('Save'); $this->assertSession()->responseContains('The anchor fragments are not allowed.'); // Adding path that starts with / // Adding path that starts with /. $this->drupalGet('admin/config/search/redirect/add'); $page = $this->getSession()->getPage(); $page->fillField('redirect_source[0][path]', '/page-to-redirect'); Loading Loading @@ -247,6 +253,7 @@ class RedirectJavascriptTest extends WebDriverTestBase { 'redirect_bulk_form[0]' => TRUE, 'redirect_bulk_form[1]' => TRUE, ]; $this->getSession()->getPage()->selectFieldOption("action", "redirect_delete_action", TRUE); $this->submitForm($edit, 'Apply to selected items'); $this->assertSession()->pageTextContains('Are you sure you want to delete these redirects?'); $this->clickLink('Cancel'); Loading @@ -261,6 +268,7 @@ class RedirectJavascriptTest extends WebDriverTestBase { $this->assertSession()->addressEquals('admin/config/search/redirect'); // Test the bulk delete action. $this->getSession()->getPage()->selectFieldOption("action", "redirect_delete_action", TRUE); $this->submitForm(['redirect_bulk_form[0]' => TRUE], 'Apply to selected items'); $this->assertSession()->pageTextContains('Are you sure you want to delete this redirect?'); $this->assertSession()->pageTextContains('test27'); Loading