/** * @test */ public function updateAndDeleteExecutionVariables() { $ei = self::$es->getExecutions(new ExecutionRequest())->execution_1; $ev = new VariableRequest(); $ev->setValue('testValue')->setType('String'); self::$es->putExecutionVariable($ei->getId(), 'testVariable', $ev); $ev = new VariableRequest(); $ev->setValue('testValue2')->setType('String'); self::$es->putExecutionVariable($ei->getId(), 'testVariable2', $ev); $ev = new VariableRequest(); $pm = array(); $pm['testVariable'] = new VariableRequest(); $pm['testVariable2'] = new VariableRequest(); $pm['testVariable']->setValue('newTestValue'); $pm['testVariable2']->setValue('newTestValue2'); $ev->setModifications($pm); self::$es->updateOrDeleteExecutionVariables($ei->getId(), $ev); $this->assertEquals('newTestValue', self::$es->getExecutionVariable($ei->getId(), 'testVariable')->getValue()); $this->assertEquals('newTestValue2', self::$es->getExecutionVariable($ei->getId(), 'testVariable2')->getValue()); $pvc = count(get_object_vars(self::$es->getExecutionVariables($ei->getId()))); $ev = new VariableRequest(); $pm = array('testVariable', 'testVariable2'); $ev->setDeletions($pm); self::$es->updateOrDeleteExecutionVariables($ei->getId(), $ev); $this->assertEquals($pvc - 2, count(get_object_vars(self::$es->getExecutionVariables($ei->getId())))); }
/** * @test */ public function updateAndDeleteProcessVariables() { $pi = self::$pis->getInstances(new ProcessInstanceRequest())->instance_0; $piv = new VariableRequest(); $piv->setValue('testValue')->setType('String'); self::$pis->putProcessVariable($pi->getId(), 'testVariable', $piv); $piv = new VariableRequest(); $piv->setValue('testValue2')->setType('String'); self::$pis->putProcessVariable($pi->getId(), 'testVariable2', $piv); $piv = new VariableRequest(); $pm = array(); $pm['testVariable'] = new VariableRequest(); $pm['testVariable2'] = new VariableRequest(); $pm['testVariable']->setValue('newTestValue'); $pm['testVariable2']->setValue('newTestValue2'); $piv->setModifications($pm); self::$pis->updateOrDeleteProcessVariables($pi->getId(), $piv); $this->assertEquals('newTestValue', self::$pis->getProcessVariable($pi->getId(), 'testVariable')->getValue()); $this->assertEquals('newTestValue2', self::$pis->getProcessVariable($pi->getId(), 'testVariable2')->getValue()); $pvc = count(get_object_vars(self::$pis->getProcessVariables($pi->getId()))); $piv = new VariableRequest(); $pm = array('testVariable', 'testVariable2'); $piv->setDeletions($pm); self::$pis->updateOrDeleteProcessVariables($pi->getId(), $piv); $this->assertEquals($pvc - 2, count(get_object_vars(self::$pis->getProcessVariables($pi->getId())))); }