? modules/shortcut/shortcut.test ? sites/all/modules/devel ? sites/default/files ? sites/default/private ? sites/default/settings.php Index: modules/user/user.test =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.test,v retrieving revision 1.78 diff -u -p -r1.78 user.test --- modules/user/user.test 29 Jan 2010 13:50:14 -0000 1.78 +++ modules/user/user.test 30 Jan 2010 15:08:38 -0000 @@ -713,6 +713,69 @@ class UserCancelTestCase extends DrupalW } } +class UserSignatureTestCase extends DrupalWebTestCase { + + public static function getInfo() { + return array( + 'name' => 'User signatures', + 'description' => 'Assure that users can create signatures and that they appear on comments.', + 'group' => 'User' + ); + } + + function setUp() { + parent::setUp(); + // Enable user pictures. + variable_set('user_signatures', 1); + } + + /** + * Do the test: + * - User can create signature. + * - Users' signatures are properly appended to comments. + * + * results: The image should be uploaded because ImageGDToolkit resizes the picture + */ + function testUserSignature() { + // Create a user with a signature and log in. + $this->user = $this->drupalCreateUser(array('access content', 'post comments without approval', 'access comments', 'post comments')); + $this->drupalLogin($this->user); + + // Try to create an invalid signature and assert error. + $sig = $this->randomName(500); + $this->drupalPost('user/' . $this->user->uid . '/edit', array('signature' => $sig), t('Save')); + $this->assertText(t('The signature is too long'), t('Invalid signature throws error.')); + + // Create a valid signature. + $sig = $this->randomName(50); + $this->drupalPost('user/' . $this->user->uid . '/edit', array('signature' => $sig), t('Save')); + $this->assertText(t('The changes have been saved.'), t('Properly created signature.')); + + // @todo: this assertTrue *should* work, but for some reason it + // is not registering the edits to $this->user's account. + //$this->user = user_load($this->user->uid); + //debug($this->user); + //$this->assertTrue($this->user->signature == $sig, 'User created a signature.'); + + // Create a node to comment on. + $settings = array( + 'title' => $this->randomName(32), + 'type' => 'article', + ); + $node = $this->drupalCreateNode($settings); + + // Leave a comment. + $this->drupalGet('comment/reply/'.$node->nid); + $form_data = array( + 'subject' => $this->randomString(10), + 'comment_body[und][0][value]' => $this->randomString(50), + ); + $this->drupalPost(NULL, $form_data, t('Save')); + $this->assertText($sig, t('The users signature was properly appended to the comment.')); + } + +} + class UserPictureTestCase extends DrupalWebTestCase { protected $user; protected $_directory_test; @@ -1199,6 +1262,19 @@ class UserBlocksUnitTests extends Drupal ); } + function testWhosNewBlock() { + // Generate users; one active and one blocked. + $user1 = $this->drupalCreateUser(array('access content')); + $user2 = $this->drupalCreateUser(array('access content')); + user_save($user2, array('status' => 0)); + + // Test block output. + $block = user_block_view('new'); + $this->drupalSetContent($block['content']); + $this->assertText($user1->name, t('Active user found on "Who\'s New" list.')); + $this->assertNoText($user2->name, t('Blocked user not found on "Who\'s New" list.')); + } + /** * Test the user login block. */