X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fpathauto%2Fsrc%2FTests%2FPathautoUserWebTest.php;fp=web%2Fmodules%2Fcontrib%2Fpathauto%2Fsrc%2FTests%2FPathautoUserWebTest.php;h=54832df9dc5b1f8288d4a8f63dabf5acd289da0a;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/modules/contrib/pathauto/src/Tests/PathautoUserWebTest.php b/web/modules/contrib/pathauto/src/Tests/PathautoUserWebTest.php new file mode 100644 index 000000000..54832df9d --- /dev/null +++ b/web/modules/contrib/pathauto/src/Tests/PathautoUserWebTest.php @@ -0,0 +1,92 @@ +adminUser = $this->drupalCreateUser($permissions); + $this->drupalLogin($this->adminUser); + + $this->createPattern('user', '/users/[user:name]'); + } + + + /** + * Basic functional testing of Pathauto with users. + */ + function testUserEditing() { + // There should be no Pathauto checkbox on user forms. + $this->drupalGet('user/' . $this->adminUser->id() . '/edit'); + $this->assertNoFieldById('path[0][pathauto]'); + } + + /** + * Test user operations. + */ + function testUserOperations() { + $account = $this->drupalCreateUser(); + + // Delete all current URL aliases. + $this->deleteAllAliases(); + + // Find the position of just created account in the user_admin_people view. + $view = Views::getView('user_admin_people'); + $view->initDisplay(); + $view->preview('page_1'); + + + foreach ($view->result as $key => $row) { + if ($view->field['name']->getValue($row) == $account->getUsername()) { + break; + } + } + + $edit = array( + 'action' => 'pathauto_update_alias_user', + "user_bulk_form[$key]" => TRUE, + ); + $this->drupalPostForm('admin/people', $edit, t('Apply to selected items')); + $this->assertText('Update URL alias was applied to 1 item.'); + + $this->assertEntityAlias($account, '/users/' . Unicode::strtolower($account->getUsername())); + $this->assertEntityAlias($this->adminUser, '/user/' . $this->adminUser->id()); + } + +}