summaryrefslogtreecommitdiff
path: root/modules/node/node.test
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-07-01 12:10:32 +0000
committerDries Buytaert <dries@buytaert.net>2009-07-01 12:10:32 +0000
commit199dc7cc9d18378d4a3ca19551984381b6094744 (patch)
tree75aae493cd1247a70e71194c0f27552f007378da /modules/node/node.test
parent75d449d1eb5b87a8b94e22622102905b1ac58612 (diff)
downloadbrdo-199dc7cc9d18378d4a3ca19551984381b6094744.tar.gz
brdo-199dc7cc9d18378d4a3ca19551984381b6094744.tar.bz2
- Patch #504564 by tic2000: fixed teaser length setting and added tests.
Diffstat (limited to 'modules/node/node.test')
-rw-r--r--modules/node/node.test42
1 files changed, 42 insertions, 0 deletions
diff --git a/modules/node/node.test b/modules/node/node.test
index 246f9b2c4..1d2abd69e 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -362,6 +362,48 @@ class PageViewTestCase extends DrupalWebTestCase {
}
}
+class SummaryLengthTestCase extends DrupalWebTestCase {
+ public static function getInfo() {
+ return array(
+ 'name' => t('Summary length'),
+ 'description' => t('Test summary length.'),
+ 'group' => t('Node'),
+ );
+ }
+
+ /**
+ * Creates a node and then an anonymous and unpermissioned user attempt to edit the node.
+ */
+ function testSummaryLength() {
+ // Create a node to view.
+ $settings = array(
+ 'body' => array(array('value' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vitae arcu at leo cursus laoreet. Curabitur dui tortor, adipiscing malesuada tempor in, bibendum ac diam. Cras non tellus a libero pellentesque condimentum. What is a Drupalism? Suspendisse ac lacus libero. Ut non est vel nisl faucibus interdum nec sed leo. Pellentesque sem risus, vulputate eu semper eget, auctor in libero. Ut fermentum est vitae metus convallis scelerisque. Phasellus pellentesque rhoncus tellus, eu dignissim purus posuere id. Quisque eu fringilla ligula. Morbi ullamcorper, lorem et mattis egestas, tortor neque pretium velit, eget eleifend odio turpis eu purus. Donec vitae metus quis leo pretium tincidunt a pulvinar sem. Morbi adipiscing laoreet mauris vel placerat. Nullam elementum, nisl sit amet scelerisque malesuada, dolor nunc hendrerit quam, eu ultrices erat est in orci. Curabitur feugiat egestas nisl sed accumsan.')),
+ 'promote' => 1,
+ );
+ $node = $this->drupalCreateNode($settings);
+ $this->assertTrue(node_load($node->nid), t('Node created.'));
+
+ // Create user with permission to view the node.
+ $web_user = $this->drupalCreateUser(array('access content', 'administer content types'));
+ $this->drupalLogin($web_user);
+
+ // Attempt to access the front page.
+ $this->drupalGet("node");
+ // The node teaser when it has 600 characters in length
+ $expected = 'What is a Drupalism?';
+ $this->assertRaw($expected, t('Check that the summary is 600 characters in length'), 'Node');
+
+ // Edit the teaser lenght for 'page' content type
+ $edit = array (
+ 'teaser_length' => 200,
+ );
+ $this->drupalPost('admin/build/node-type/page', $edit, t('Save content type'));
+ // Attempt to access the front page again and check if the summary is now only 200 characters in length.
+ $this->drupalGet("node");
+ $this->assertNoRaw($expected, t('Check that the summary is not longer than 200 characters'), 'Node');
+ }
+}
+
class NodeTitleXSSTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(