function ServicesResourceSystemTests::testSystemSetVariable in Services 7.3
Same name and namespace in other branches
- 6.3 tests/functional/ServicesResourceSystemTests.test \ServicesResourceSystemTests::testSystemSetVariable()
 
Test set_variable method.
File
- tests/
functional/ ServicesResourceSystemTests.test, line 89  - Call the endpoint tests when no authentication is being used.
 
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_query('SELECT value FROM {variable} WHERE name = :name', array(
    ':name' => $name,
  ))
    ->fetchField());
  $this
    ->assertEqual($value, $variable, 'Variable set value.', 'SystemResource: set_variable');
}