123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- class Redis_Tests_Admin_VariableTestCase extends DrupalWebTestCase
- {
- public static function getInfo()
- {
- return array(
- 'name' => 'Redis variables',
- 'description' => 'Checks that Redis module variables are correctly type hinted when saved.',
- 'group' => 'Redis',
- );
- }
- protected $adminUser;
- public function setUp()
- {
- parent::setUp('redis');
- }
- public function testSave()
- {
- $this->adminUser = $this->drupalCreateUser(array('administer site configuration'));
- $this->drupalLogin($this->adminUser);
- // Tests port is an int.
- $this->drupalGet('admin/config/development/performance/redis');
- $edit = array(
- 'redis_client_base' => '',
- 'redis_client_port' => '1234',
- 'redis_client_host' => 'localhost',
- 'redis_client_interface' => '',
- );
- $this->drupalPost('admin/config/development/performance/redis', $edit, t('Save configuration'));
- // Force variable cache to refresh.
- $test = variable_initialize();
- $conf = &$GLOBALS['conf'];
- $this->assertFalse(array_key_exists('redis_client_base', $conf), "Empty int value has been removed");
- $this->assertFalse(array_key_exists('redis_client_interface', $conf), "Empty string value has been removed");
- $this->assertIdentical($conf['redis_client_port'], 1234, "Saved int is an int");
- $this->assertIdentical($conf['redis_client_host'], 'localhost', "Saved string is a string");
- $this->drupalGet('admin/config/development/performance/redis');
- $edit = array(
- 'redis_client_base' => '0',
- 'redis_client_port' => '1234',
- 'redis_client_host' => 'localhost',
- 'redis_client_interface' => '',
- );
- $this->drupalPost('admin/config/development/performance/redis', $edit, t('Save configuration'));
- // Force variable cache to refresh.
- $test = variable_initialize();
- $conf = &$GLOBALS['conf'];
- $this->assertIdentical($conf['redis_client_base'], 0, "Saved 0 valueed int is an int");
- }
- }
|