I have a Drupal 8 module for banning users based on country.
In it, I have the following test.
public function setUp() { parent::setUp(); $this->drupalLogin($this->adminSitesUser); } public function testCompleteBan() { // node/1. $this->addBanNode("Read only page"); // node/2. $this->addBanNode("Complete ban page"); $this->drupalGet(IP_BAN_ADMIN_FORM_PATH); $edit = [ // Set the United States to Read Only // 0 = no action / 1 = Read Only / 2 = Complete Ban. 'ip_ban_US' => 2, // Set the test IP address to a known Google US address. 'ip_ban_test_ip' => '66.249.84.22', // Configure the paths for read-only and complete ban. 'ip_ban_readonly_path' => '/node/1', 'ip_ban_completeban_path' => '/node/2', ]; $this->drupalPostForm(IP_BAN_ADMIN_FORM_PATH, $edit, t('Save configuration')); $this->assertOptionSelected('edit-ip-ban-us', 2, 'Complete ban set correctly in country list table.'); // Should be redirected to complete ban page after logout. $this->drupalGet('user/logout'); $this->assertUrl('node/2'); }
However, I get an error on the last line (assertURL()
): "Expected ‘http://d8.dev/node/2’ matches current URL (http://d8.dev/). Value ‘http://d8.dev/’ is equal to value ‘http://d8.dev/node/2’."
It seems as if the page is not redirected on logout the way it is when manually testing with an extremely minimal installation and using the exact same settings (including permissions)/workflow as the tests.
Note all the form-based tests are working as well.
Any idea why this is not working in D8? (It works fine in D7.)
Sponsored by SupremePR