[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/xmlsitemap/xmlsitemap_user/ -> xmlsitemap_user.test (source)

   1  <?php
   2  // $Id: xmlsitemap_user.test,v 1.1.2.3 2010/02/15 16:53:18 davereid Exp $
   3  
   4  /**
   5   * @file
   6   * Unit tests for the xmlsitemap_user module.
   7   */
   8  
   9  class XMLSitemapUserFunctionalTest extends XMLSitemapTestHelper {
  10    protected $normal_user;
  11    protected $accounts = array();
  12  
  13    public static function getInfo() {
  14      return array(
  15        'name' => 'XML sitemap user',
  16        'description' => 'Functional tests for the XML sitemap user module.',
  17        'group' => 'XML sitemap',
  18      );
  19    }
  20  
  21    function setUp() {
  22      parent::setUp('xmlsitemap_user');
  23  
  24      // Save the user settings before creating the users.
  25      xmlsitemap_link_bundle_settings_save('user', 'user', array('status' => 1, 'priority' => 0.5));
  26  
  27      // Create the users
  28      $this->admin_user = $this->drupalCreateUser(array('administer users', 'administer permissions', 'administer xmlsitemap'));
  29      $this->normal_user = $this->drupalCreateUser(array('access content'));
  30  
  31      // Update the normal user to make its sitemap link visible.
  32      $account = clone $this->normal_user;
  33      user_save($account, array('access' => 1, 'login' => 1));
  34    }
  35  
  36    function testBlockedUser() {
  37      $this->drupalLogin($this->admin_user);
  38      $this->assertSitemapLinkVisible('user', $this->normal_user->uid);
  39  
  40      // Mark the user as blocked.
  41      $edit = array(
  42        'status' => 0,
  43      );
  44  
  45      // This will pass when http://drupal.org/node/360925 is fixed.
  46      $this->drupalPost('user/' . $this->normal_user->uid . '/edit', $edit, t('Save'));
  47      $this->assertText('The changes have been saved.');
  48      $this->assertSitemapLinkNotVisible('user', $this->normal_user->uid);
  49    }
  50  
  51    /*function testUserAdminRegister() {
  52      $this->drupalLogin($this->admin_user);
  53  
  54      $this->drupalGet('admin/user/user/create');
  55      $this->assertFieldByName('xmlsitemap[status]', 'default');
  56      $this->assertFieldByName('xmlsitemap[priority]', 'default');
  57  
  58      $edit = array(
  59        'name' => $this->randomName(),
  60        'mail' => $this->randomName() . '@example.com',
  61        'pass[pass1]' => 'test',
  62        'pass[pass2]' => 'test',
  63      );
  64      $this->drupalPost(NULL, $edit, 'Create new account');
  65      $this->assertText('Created a new user account');
  66    }*/
  67  
  68    /*function testUserRegister() {
  69      variable_set('user_email_verification', 0);
  70  
  71      $this->drupalGet('user/register');
  72      $this->assertNoFieldByName('xmlsitemap[status]');
  73      $this->assertNoFieldByName('xmlsitemap[priority]');
  74  
  75      $edit = array(
  76        'name' => $this->randomName(),
  77        'mail' => $this->randomName() . '@example.com',
  78        'pass[pass1]' => 'test',
  79        'pass[pass2]' => 'test',
  80      );
  81      $this->drupalPost(NULL, $edit, 'Create new account');
  82      $this->assertText('Registration successful. You are now logged in.');
  83  
  84      $account = user_load(array('name' => $edit['name']));
  85      $this->assertUserSitemapLinkVisible($account);
  86      $link = xmlsitemap_link_load('user', $account->uid);
  87    }*/
  88  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7