public function testGetVariableInstancesCountWithGet()
 {
     $restService = new camundaRestClient(self::$restApi);
     $vic = $restService->getVariableInstancesCount()->count;
     $this->assertGreaterThan(0, $vic);
     $vic = $restService->getVariableInstancesCount(null, true)->count;
     $this->assertGreaterThan(0, $vic);
     $vir = array('variableName' => 'amount');
     $vic = $restService->getVariableInstancesCount($vir, true)->count;
     $this->assertGreaterThan(0, $vic);
     $vir = array('variableName' => 'haha');
     $vic = $restService->getVariableInstancesCount($vir, true)->count;
     $this->assertEquals(0, $vic);
 }
 public function testUpdateGroup()
 {
     $restService = new camundaRestClient(self::$restApi);
     $groupRequest = array('name' => 'testgroup', 'id' => 'sales', 'type' => 'Organizational Unit');
     $restService->createSingleGroup($groupRequest);
     $this->assertEquals('testgroup', $restService->getSingleGroup('sales')->name);
     $update = array('name' => 'testgroup2', 'id' => 'sales', 'type' => 'Organizational Unit');
     $restService->updateSingleGroup('sales', $update);
     $this->assertEquals('testgroup2', $restService->getSingleGroup('sales')->name);
     $restService->deleteSingleGroup('sales');
 }
 /**
  * @test
  */
 public function getEngineNames()
 {
     $restClient = new camundaRestClient(self::$restApi);
     $this->assertEquals('default', $restClient->getEngineNames()[0]->name);
 }
 /**
  * TODO: Write a more accurate test!
  * embedded:app:forms/start-form.html - invoice start form in distro
  */
 public function testGetStartFormKey()
 {
     $restClient = new camundaRestClient(self::$restApi);
     foreach ($restClient->getProcessDefinitions() as $data) {
         if ($data->key == 'invoice') {
             $this->assertEquals('embedded:app:forms/start-form.html', $restClient->getStartFormKey($data->id)->key);
         }
     }
 }
 /**
  * @test
  */
 public function getActivityInstances()
 {
     $restClient = new camundaRestClient(self::$restApi);
     $pi = $restClient->getProcessInstances()[0];
     $this->assertNotEmpty(get_object_vars($restClient->getActivityInstances($pi->id)));
 }
Example #6
0
 /**
  * @test
  */
 public function updateUserProfile()
 {
     $restService = new camundaRestClient(self::$restApi);
     $user = array();
     $profile['id'] = 'shentschel';
     $profile['firstName'] = 'Stefan';
     $profile['lastName'] = 'Hentschel';
     $profile['email'] = '*****@*****.**';
     $credentials['password'] = '******';
     $user['profile'] = $profile;
     $user['credentials'] = $credentials;
     $restService->createSingleUser($user);
     $this->assertEquals('Stefan', $restService->getUserProfile('shentschel')->firstName);
     unset($profile);
     $profile = array();
     $profile['id'] = 'shentschel';
     $profile['firstName'] = 'John';
     $profile['lastName'] = 'Doe';
     $profile['email'] = '*****@*****.**';
     $restService->updateUserProfile('shentschel', $profile);
     $this->assertEquals('John', $restService->getUserProfile('shentschel')->firstName);
     $restService->deleteSingleUser('shentschel');
 }
 /**
  * @test
  */
 public function updateAndDeleteProcessVariables()
 {
     $restClient = new camundaRestClient(self::$restApi);
     $ei = $restClient->getExecutions()[0];
     $ev = array('value' => 'testValue', 'type' => 'String');
     $restClient->putLocalExecutionVariable($ei->id, 'testVariable', $ev);
     $ev = array('value' => 'testValue2', 'type' => 'String');
     $restClient->putLocalExecutionVariable($ei->id, 'testVariable2', $ev);
     $ev = array();
     $pm = array();
     $pm['testVariable'] = array();
     $pm['testVariable2'] = array();
     $pm['testVariable']['value'] = 'newTestValue';
     $pm['testVariable2']['value'] = 'newTestValue2';
     $ev['modifications'] = $pm;
     $restClient->updateOrRemoveLocalExecutionVariables($ei->id, $ev);
     $this->assertEquals('newTestValue', $restClient->getLocalExecutionVariable($ei->id, 'testVariable')->value);
     $this->assertEquals('newTestValue2', $restClient->getLocalExecutionVariable($ei->id, 'testVariable2')->value);
     $pvc = count(get_object_vars($restClient->getLocalExecutionVariables($ei->id)));
     $pm = array('testVariable', 'testVariable2');
     $ev = array('deletions' => $pm);
     $restClient->updateOrRemoveLocalExecutionVariables($ei->id, $ev);
     $this->assertEquals($pvc - 2, count(get_object_vars($restClient->getLocalExecutionVariables($ei->id))));
 }