You are here

function ServicesResourceSystemTests::testSystemSetVariable in Services 6.3

Same name and namespace in other branches
  1. 7.3 tests/functional/ServicesResourceSystemTests.test \ServicesResourceSystemTests::testSystemSetVariable()

Test set_variable method.

File

tests/functional/ServicesResourceSystemTests.test, line 92

Class

ServicesResourceSystemTests
Run test cases for the endpoint with no authentication turned on.

Code

function testSystemSetVariable() {
  $path = $this->endpoint->path;
  $name = $this
    ->randomName();
  $value = $this
    ->randomString();
  $response = $this
    ->servicesPost($path . '/system/set_variable', array(
    'name' => $name,
    'value' => $value,
  ));

  // We can't use variable_get as variables get cached to global variable.
  $variable = unserialize(db_result(db_query('SELECT value FROM {variable} WHERE name = "%s"', $name)));
  $this
    ->assertEqual($value, $variable, t('Variable set value.'), 'SystemResource: set_variable');
}