xmlsitemap_user.test 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * @file
  4. * Unit tests for the xmlsitemap_user module.
  5. */
  6. class XMLSitemapUserFunctionalTest extends XMLSitemapTestHelper {
  7. protected $normal_user;
  8. protected $accounts = array();
  9. public static function getInfo() {
  10. return array(
  11. 'name' => 'XML sitemap user',
  12. 'description' => 'Functional tests for the XML sitemap user module.',
  13. 'group' => 'XML sitemap',
  14. );
  15. }
  16. function setUp($modules = array()) {
  17. $modules[] = 'xmlsitemap_user';
  18. parent::setUp($modules);
  19. // Save the user settings before creating the users.
  20. xmlsitemap_link_bundle_settings_save('user', 'user', array('status' => 1, 'priority' => 0.5));
  21. // Create the users
  22. $this->admin_user = $this->drupalCreateUser(array('administer users', 'administer permissions', 'administer xmlsitemap'));
  23. $this->normal_user = $this->drupalCreateUser(array('access content'));
  24. // Update the normal user to make its sitemap link visible.
  25. $account = clone $this->normal_user;
  26. user_save($account, array('access' => 1, 'login' => 1));
  27. }
  28. function testBlockedUser() {
  29. $this->drupalLogin($this->admin_user);
  30. $this->assertSitemapLinkVisible('user', $this->normal_user->uid);
  31. // Mark the user as blocked.
  32. $edit = array(
  33. 'status' => 0,
  34. );
  35. // This will pass when http://drupal.org/node/360925 is fixed.
  36. $this->drupalPost('user/' . $this->normal_user->uid . '/edit', $edit, t('Save'));
  37. $this->assertText('The changes have been saved.');
  38. $this->assertSitemapLinkNotVisible('user', $this->normal_user->uid);
  39. }
  40. }