diff options
-rw-r--r-- | modules/path/path.test | 39 |
1 files changed, 10 insertions, 29 deletions
diff --git a/modules/path/path.test b/modules/path/path.test index 6479abc03..479cd1f06 100644 --- a/modules/path/path.test +++ b/modules/path/path.test @@ -16,7 +16,7 @@ class PathTestCase extends DrupalWebTestCase { function setUp() { parent::setUp('path'); // create and login user - $web_user = $this->drupalCreateUser(array('edit own page content', 'create page content', 'administer url aliases', 'create url aliases')); + $web_user = $this->drupalCreateUser(array('edit any page content', 'create page content', 'administer url aliases', 'create url aliases')); $this->drupalLogin($web_user); } @@ -25,7 +25,7 @@ class PathTestCase extends DrupalWebTestCase { */ function testAdminAlias() { // create test node - $node1 = $this->createNode(); + $node1 = $this->drupalCreateNode(); // Create alias. $edit = array(); @@ -54,7 +54,7 @@ class PathTestCase extends DrupalWebTestCase { $this->assertResponse(404); // Create second test node. - $node2 = $this->createNode(); + $node2 = $this->drupalCreateNode(); // Set alias to second test node. $edit['src'] = 'node/' . $node2->nid; @@ -77,7 +77,7 @@ class PathTestCase extends DrupalWebTestCase { */ function testNodeAlias() { // Create test node. - $node1 = $this->createNode(); + $node1 = $this->drupalCreateNode(); // Create alias. $edit = array(); @@ -103,7 +103,7 @@ class PathTestCase extends DrupalWebTestCase { $this->assertResponse(404); // Create second test node. - $node2 = $this->createNode(); + $node2 = $this->drupalCreateNode(); // Set alias to second test node. // Leave $edit['path'] the same. @@ -123,20 +123,6 @@ class PathTestCase extends DrupalWebTestCase { function getPID($dst) { return db_result(db_query("SELECT pid FROM {url_alias} WHERE dst = '%s'", $dst)); } - - function createNode() { - $edit = array(); - $edit['title'] = '!SimpleTest test node! ' . $this->randomName(10); - $edit['body'] = '!SimpleTest test body! ' . $this->randomName(32) . ' ' . $this->randomName(32); - $this->drupalPost('node/add/page', $edit, t('Save')); - - // Check to make sure the node was created. - $node = $this->drupalGetNodeByTitle($edit['title']); - - $this->assertNotNull(($node === FALSE ? NULL : $node), 'Node found in database. %s'); - - return $node; - } } class PathLanguageTestCase extends DrupalWebTestCase { @@ -155,7 +141,7 @@ class PathLanguageTestCase extends DrupalWebTestCase { parent::setUp('path', 'locale', 'translation'); // Create and login user. - $web_user = $this->drupalCreateUser(array('edit own page content', 'create page content', 'administer url aliases', 'create url aliases', 'administer languages', 'translate content', 'access administration pages')); + $web_user = $this->drupalCreateUser(array('edit any page content', 'create page content', 'administer url aliases', 'create url aliases', 'administer languages', 'translate content', 'access administration pages')); $this->drupalLogin($web_user); // Enable French language. @@ -178,18 +164,13 @@ class PathLanguageTestCase extends DrupalWebTestCase { // Set 'page' content type to enable translation. variable_set('language_content_type_page', 2); - // Create a page in English. + $english_node = $this->drupalCreateNode(array('type' => 'page')); + + // Edit the node to set language and path. $edit = array(); - $edit['title'] = $this->randomName(); - $edit['body'] = $this->randomName(); $edit['language'] = 'en'; $edit['path'] = $this->randomName(); - - $this->drupalPost('node/add/page', $edit, t('Save')); - - // Check to make sure the node was created. - $english_node = $this->drupalGetNodeByTitle($edit['title']); - $this->assertTrue(($english_node), 'Node found in database.'); + $this->drupalPost('node/' . $english_node->nid . '/edit', $edit, t('Save')); // Confirm that the alias works. $this->drupalGet($edit['path']); |