You are here

public function AcsfVariableStorageMock::set in Acquia Cloud Site Factory Connector 8

Same name and namespace in other branches
  1. 8.2 tests/AcsfVariableStorageMock.php \AcsfVariableStorageMock::set()

Sets a named variable with an optional group.

Parameters

string $name: The name of the variable.

mixed $value: The value of the variable.

string $group: The group name of the variable. Optional.

Return value

int 1 if an INSERT query was executed, 2 for UPDATE.

File

tests/AcsfVariableStorageMock.php, line 43

Class

AcsfVariableStorageMock
Mock AcsfVariableStorage class used for testing.

Code

public function set($name, $value, $group = NULL) {
  $response = 1;
  if (isset($this->storage[$name])) {
    $response = 2;
  }
  $this->storage[$name] = [
    'group_name' => $group,
    'value' => serialize($value),
  ];
  $this->group[$group][] = $name;
  return $response;
}