12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- /**
- * @file
- * External Link tests.
- */
- /**
- * Base class for External Link tests.
- *
- * Provides common setup stuff and various helper functions.
- */
- class ExtlinkBaseWebTestCase extends DrupalWebTestCase {
- /**
- * User with various administrative permissions.
- *
- * @var Drupaluser
- */
- protected $adminUser;
- /**
- * Normal visitor with limited permissions.
- *
- * @var Drupaluser
- */
- protected $normalUser;
- /**
- * Drupal path of the (general) External Links admin page.
- */
- const EXTLINK_ADMIN_PATH = 'admin/config/user-interface/extlink';
- /**
- * Set up tests.
- */
- public function setUp() {
- // Enable any module that you will need in your tests.
- parent::setUp('extlink');
- // Create a normal user.
- $permissions = array(
- 'access comments', 'post comments', 'skip comment approval',
- 'access content', 'create page content', 'edit own page content',
- );
- $this->normalUser = $this->drupalCreateUser($permissions);
- // Create an admin user.
- $permissions[] = 'administer site configuration';
- $permissions[] = 'administer permissions';
- $permissions[] = 'administer content types';
- $this->adminUser = $this->drupalCreateUser($permissions);
- }
- }
- /**
- * Test Case for External Links administration functionality.
- */
- class ExtlinkAdminTestCase extends ExtlinkBaseWebTestCase {
- /**
- * Get test info.
- */
- public static function getInfo() {
- return array(
- 'name' => t('External Links administration functionality'),
- 'description' => t('Testing of the External Links administration interface and functionality.'),
- 'group' => t('External Links'),
- );
- }
- /**
- * Test access to the admin pages.
- */
- public function testAdminAccess() {
- $this->drupalLogin($this->normalUser);
- $this->drupalGet(self::EXTLINK_ADMIN_PATH);
- $this->assertText(t('Access denied'), 'Normal users should not be able to access the External Links admin pages', 'External Links');
- $this->drupalLogin($this->adminUser);
- $this->drupalGet(self::EXTLINK_ADMIN_PATH);
- $this->assertNoText(t('Access denied'), 'Admin users should be able to access the External Links admin pages', 'External Links');
- }
- }
|