t('Verify settings'), 'description' => t('Verify settings get set through bootstrap process.'), 'group' => t('Database tweaks'), ); } function setUp() { parent::setUp('db_tweaks'); } /** * Create two different users and make sure they see what they're supposed to. */ function testSettingsAccess() { $web_user = $this->drupalCreateUser(array('access content')); $this->drupalLogin($web_user); $this->drupalGet('admin/settings/db_tweaks'); $this->assertResponse(403, t('Access denied to settings page.')); $web_user = $this->drupalCreateUser(array('administer database')); $this->drupalLogin($web_user); $this->drupalGet('admin/settings/db_tweaks'); $this->assertResponse(200, t('Access granted to settings page.')); global $db_type; if ($db_type == 'mysql' || $db_type == 'mysqli') { $this->assertFieldByName('mysql_sql_big_selects', 'ON', t('Big selects field exists.')); $this->assertFieldByName('mysql_max_join_size', -1, t('Max join size field exists.')); $this->assertFieldByName('mysql_max_allowed_packet', 32, t('Max allowed packet size field exists.')); $this->assertFieldByName('mysql_wait_timeout', 28800, t('Wait timeout field exists.')); $this->assertField('mysql_sql_mode[]', t('SQL mode field exists.')); } else { $this->assertNoField('mysql_sql_big_selects', t('Big selects field exists.')); $this->assertNoField('mysql_max_join_size', t('Max join size field exists.')); $this->assertNoField('mysql_max_allowed_packet', t('Max allowed packet size field exists.')); $this->assertNoField('mysql_wait_timeout', t('Wait timeout field exists.')); $this->assertNoField('mysql_sql_mode', t('SQL mode field exists.')); } } /** * Verify the SQL mode is set during bootstrap. */ function testSQLMode() { $web_user = $this->drupalCreateUser(array('administer site configuration')); $this->drupalLogin($web_user); variable_set('mysql_sql_mode', array('POSTGRESQL')); $this->drupalGet('admin/reports/status'); $this->assertText('POSTGRESQL', t('Session SQL mode set to POSTGRESQL.')); variable_set('mysql_sql_mode', array('STRICT_ALL_TABLES')); $this->drupalGet('admin/reports/status'); $this->assertText('STRICT_ALL_TABLES', t('Session SQL mode set to STRICT_ALL_TABLES.')); } }