HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux newsites.squeezer-software.com 6.8.0-90-generic #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 14:14:30 UTC 2025 x86_64
User: www-data (33)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/sites/orpis/sites/all/modules/contrib/variable/variable.test
<?php

/**
 * @file
 * Tests for variable.module.
 */

/**
 * Helper class for module test cases.
 */
class VariableTestCase extends DrupalWebTestCase {
  protected $admin_user;

  public static function getInfo() {
    return array(
      'name' => 'Test Variable API',
      'description' => 'Exercise the Variable API, default values, save and delete variables, etc.',
      'group' => 'Variable',
    );
  }

  function setUp() {
    parent::setUp('variable', 'variable_admin');

    $this->admin_user = $this->drupalCreateUser(array('access administration pages', 'administer site configuration'));
    $this->drupalLogin($this->admin_user);
  }

  /**
   * Test that all core modules can be enabled, disabled and uninstalled.
   */
  function testVariableAPI() {
    // Check default values, set, get, delete.
    $this->assertEqual(variable_get_value('site_name'), 'Drupal', 'Function variable_get_value() returns proper default values.');
    $name = 'My test site';
    variable_set_value('site_name', $name);
    $this->assertTrue(variable_get('site_name'), 'Variable has been set using Variable API.');
    $this->drupalGet('');
    $this->assertText($name, 'Site name set with variable_set_value() is displayed.');
    variable_delete('site_name');
    $this->assertFalse(variable_get('site_name'), 'Variable has been deleted using Variable API.');
    $this->assertEqual(variable_get_value('site_name'), 'Drupal', 'Variable has been reset to its default value.');
    // Find variable information and specific variable in module and group list
    $variable = variable_get_info('site_name');
    $this->assertEqual($variable['title'], t('Site name'), 'Variable information can be retrieved for specific variable.');
    // Check our admin pages just to make sure all variable widgets are properly displayed.
    $this->drupalGet('admin/config/system/variable');
    $this->drupalGet('admin/config/system/variable/module');
    $this->drupalGet('admin/config/system/variable/edit/site_name');
  }


}