summaryrefslogtreecommitdiff
path: root/modules/node/node.test
diff options
context:
space:
mode:
Diffstat (limited to 'modules/node/node.test')
-rw-r--r--modules/node/node.test85
1 files changed, 71 insertions, 14 deletions
diff --git a/modules/node/node.test b/modules/node/node.test
index 37d05e529..9ef4c2586 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -832,7 +832,11 @@ class NodeRSSContentTestCase extends DrupalWebTestCase {
// viewing node.
$this->drupalGet("node/$node->nid");
$this->assertNoText($rss_only_content, t('Node content designed for RSS doesn\'t appear when viewing node.'));
-
+
+ // Check that the node feed page does not try to interpret additional path
+ // components as arguments for node_feed() and returns default content.
+ $this->drupalGet('rss.xml/' . $this->randomName() . '/' . $this->randomName());
+ $this->assertText($rss_only_content, t('Ignore page arguments when delivering rss.xml.'));
}
}
@@ -2030,9 +2034,9 @@ class NodeQueryAlter extends DrupalWebTestCase {
// Create user with simple node access permission. The 'node test view'
// permission is implemented and granted by the node_access_test module.
- $this->accessUser = $this->drupalCreateUser(array('access content', 'node test view'));
- $this->noAccessUser = $this->drupalCreateUser(array('access content'));
- $this->noAccessUser2 = $this->drupalCreateUser(array('access content'));
+ $this->accessUser = $this->drupalCreateUser(array('access content overview', 'access content', 'node test view'));
+ $this->noAccessUser = $this->drupalCreateUser(array('access content overview', 'access content'));
+ $this->noAccessUser2 = $this->drupalCreateUser(array('access content overview', 'access content'));
}
/**
@@ -2045,11 +2049,19 @@ class NodeQueryAlter extends DrupalWebTestCase {
$this->assertText('Yes, 4 nodes', "4 nodes were found for access user");
$this->assertNoText('Exception', "No database exception");
+ // Test the content overview page.
+ $this->drupalGet('admin/content');
+ $table_rows = $this->xpath('//tbody/tr');
+ $this->assertEqual(4, count($table_rows), "4 nodes were found for access user");
+
// Verify that a user with no access permission cannot see nodes.
$this->drupalLogin($this->noAccessUser);
$this->drupalGet('node_access_test_page');
$this->assertText('No nodes', "No nodes were found for no access user");
$this->assertNoText('Exception', "No database exception");
+
+ $this->drupalGet('admin/content');
+ $this->assertText(t('No content available.'));
}
/**
@@ -2474,24 +2486,24 @@ class NodeAccessPagerTestCase extends DrupalWebTestCase {
// View the node page. With the default 50 comments per page there should
// be two pages (0, 1) but no third (2) page.
$this->drupalGet('node/' . $node->nid);
- $this->assertText($node->title, t('Node title found.'));
- $this->assertText(t('Comments'), t('Has a comments section.'));
- $this->assertRaw('page=1', t('Secound page exists.'));
- $this->assertNoRaw('page=2', t('No third page exists.'));
+ $this->assertText($node->title);
+ $this->assertText(t('Comments'));
+ $this->assertRaw('page=1');
+ $this->assertNoRaw('page=2');
}
/**
* Tests the forum node pager for nodes with multiple grants per realm.
*/
public function testForumPager() {
- // Lookup the forums vocabulary vid.
+ // Look up the forums vocabulary ID.
$vid = variable_get('forum_nav_vocabulary', 0);
- $this->assertTrue($vid, t('Forum navigation vocabulary found.'));
+ $this->assertTrue($vid, 'Forum navigation vocabulary ID is set.');
- // Lookup the general discussion term.
+ // Look up the general discussion term.
$tree = taxonomy_get_tree($vid, 0, 1);
$tid = reset($tree)->tid;
- $this->assertTrue($tid, t('General discussion term found.'));
+ $this->assertTrue($tid, 'General discussion term is found in the forum vocabulary.');
// Create 30 nodes.
for ($i = 0; $i < 30; $i++) {
@@ -2510,8 +2522,8 @@ class NodeAccessPagerTestCase extends DrupalWebTestCase {
// page there should be two pages for 30 nodes, no more.
$this->drupalLogin($this->web_user);
$this->drupalGet('forum/' . $tid);
- $this->assertRaw('page=1', t('Secound page exists.'));
- $this->assertNoRaw('page=2', t('No third page exists.'));
+ $this->assertRaw('page=1');
+ $this->assertNoRaw('page=2');
}
}
@@ -2589,3 +2601,48 @@ class NodeAccessFieldTestCase extends NodeWebTestCase {
$this->assertRaw($default, 'The updated default value is displayed when creating a new node.');
}
}
+
+/**
+ * Tests changing view modes for nodes.
+ */
+class NodeEntityViewModeAlterTest extends NodeWebTestCase {
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Node entity view mode',
+ 'description' => 'Test changing view mode.',
+ 'group' => 'Node'
+ );
+ }
+
+ function setUp() {
+ parent::setUp(array('node_test'));
+ }
+
+ /**
+ * Create a "Basic page" node and verify its consistency in the database.
+ */
+ function testNodeViewModeChange() {
+ $web_user = $this->drupalCreateUser(array('create page content', 'edit own page content'));
+ $this->drupalLogin($web_user);
+
+ // Create a node.
+ $edit = array();
+ $langcode = LANGUAGE_NONE;
+ $edit["title"] = $this->randomName(8);
+ $edit["body[$langcode][0][value]"] = t('Data that should appear only in the body for the node.');
+ $edit["body[$langcode][0][summary]"] = t('Extra data that should appear only in the teaser for the node.');
+ $this->drupalPost('node/add/page', $edit, t('Save'));
+
+ $node = $this->drupalGetNodeByTitle($edit["title"]);
+
+ // Set the flag to alter the view mode and view the node.
+ variable_set('node_test_change_view_mode', 'teaser');
+ $this->drupalGet('node/' . $node->nid);
+
+ // Check that teaser mode is viewed.
+ $this->assertText('Extra data that should appear only in the teaser for the node.', 'Teaser text present');
+ // Make sure body text is not present.
+ $this->assertNoText('Data that should appear only in the body for the node.', 'Body text not present');
+ }
+}