Skip to content

Commit

Permalink
Revert "Patch to write API tests to support php 5.3"
Browse files Browse the repository at this point in the history
This reverts the patch ont the write API functional tests to  support
php 5.3
  • Loading branch information
GRyall committed Jul 14, 2020
1 parent 1de2ea3 commit 53236a3
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions tests/writeAPI/extensionPropertyAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,7 @@ public function deleteExtensionPropsWrongKeys($withVals) {

#Construct a set of extension properties to delete where one has a different key to the ones we added
$propsToDelete = array_slice($this->sampleExtensionProps, 1);
$newKeyArray = array_keys(array_slice($this->sampleExtensionProps, 0, 1));
$newValueArray = array_values(array_slice($this->sampleExtensionProps, 0, 1));
$propsToDelete[$newKeyArray[0].'Not the same now'] = $newValueArray[0];
$propsToDelete[array_keys(array_slice($this->sampleExtensionProps, 0, 1))[0] . 'Not the same now'] = array_values(array_slice($this->sampleExtensionProps, 0, 1))[0];

#Use the API. (case variation in method and key is deliberate as API should be insensitive)
$APIOutput = $this->wellFormatedWriteAPICall ('DEleTE', json_encode($propsToDelete), $this->validAuthIdent, $entType, $ent->getId(), 'EXTENSIONproperties');
Expand All @@ -384,11 +382,9 @@ public function test_deleteExtensionPropsWrongVal() {
#Add the props to the entity
$this->createExtensionProperties($ent, $entType, $this->sampleExtensionProps);

$newPropKeyArray = array_keys(array_slice($this->sampleExtensionProps, 0, 1));
$newPropValArray = array_values(array_slice($this->sampleExtensionProps, 0, 1));
#Construct a set of extension properties to delete where one has a different value to the ones we added
$propsToDelete = array_slice($this->sampleExtensionProps, 1);
$propsToDelete[$newPropKeyArray[0]] = $newPropValArray[0].'Not the Same';
$propsToDelete[array_keys(array_slice($this->sampleExtensionProps, 0, 1))[0]] = array_values(array_slice($this->sampleExtensionProps, 0, 1))[0].'Not the Same';

#Use the API. (case variation in method and key is deliberate as API should be insensitive)
$APIOutput = $this->wellFormatedWriteAPICall ('DEleTE', json_encode($propsToDelete), $this->validAuthIdent, $entType, $ent->getId(), 'EXTENSIONproperties');
Expand Down Expand Up @@ -446,8 +442,7 @@ private function deleteExtensionProp($withVal, $emptyReq=false) {

#Construct the desired request body
if ($withVal) {
$propForReq = array_values(array_slice($this->sampleExtensionProps, 0, 1));
$reqBody = $this->singleValToJsonRequest($propForReq[0]);
$reqBody = $this->singleValToJsonRequest(array_values(array_slice($this->sampleExtensionProps, 0, 1))[0]);
} elseif ($emptyReq) {
$reqBody = '';
} else {
Expand All @@ -456,8 +451,7 @@ private function deleteExtensionProp($withVal, $emptyReq=false) {
$reqBody = null;
}

$propKeyArray = array_keys(array_slice($this->sampleExtensionProps, 0, 1));
$propKey = $propKeyArray [0];
$propKey = array_keys(array_slice($this->sampleExtensionProps, 0, 1))[0];

#Use the API. (case variation in method and key is deliberate as API should be insensitive)
$APIOutput = $this->wellFormatedWriteAPICall ('DEleTE', $reqBody, $this->validAuthIdent, $entType, $ent->getId(), 'EXTENSIONproperties',$propKey);
Expand Down Expand Up @@ -522,8 +516,7 @@ private function deleteNonexistentExtensionProp( $withVal, $emptyReq=false) {

#Construct the desired request body
if ($withVal) {
$propValArray = array_values(array_slice($this->sampleExtensionProps, 0, 1));
$reqBody = $this->singleValToJsonRequest($propValArray[0]);
$reqBody = $this->singleValToJsonRequest(array_values(array_slice($this->sampleExtensionProps, 0, 1))[0]);
} elseif ($emptyReq) {
$reqBody = '';
} else {
Expand All @@ -532,8 +525,7 @@ private function deleteNonexistentExtensionProp( $withVal, $emptyReq=false) {
$reqBody = null;
}

$propKeyArray = array_keys(array_slice($this->sampleExtensionProps, 0, 1));
$propKey = $propKeyArray [0] . 'this doesnt exist';
$propKey = array_keys(array_slice($this->sampleExtensionProps, 0, 1))[0] . 'this doesnt exist';

#Use the API. (case variation in method and key is deliberate as API should be insensitive)
$APIOutput = $this->wellFormatedWriteAPICall ('DEleTE', $reqBody, $this->validAuthIdent, $entType, $ent->getId(), 'EXTENSIONproperties',$propKey);
Expand All @@ -559,12 +551,10 @@ public function test_deleteExtensionPropWrongVal() {
$this->createExtensionProperties($ent, $entType, $this->sampleExtensionProps);

#Construct the request body with the wrong value
$propValArray = array_values(array_slice($this->sampleExtensionProps, 0, 1));
$reqBody = $this->singleValToJsonRequest($propValArray[0].'not correct now');
$reqBody = $this->singleValToJsonRequest(array_values(array_slice($this->sampleExtensionProps, 0, 1))[0].'not correct now');

#define the correct key
$propKeyArray = array_keys(array_slice($this->sampleExtensionProps, 0, 1));
$propKey = $propKeyArray [0];
$propKey = array_keys(array_slice($this->sampleExtensionProps, 0, 1))[0];

#Use the API. (case variation in method and key is deliberate as API should be insensitive)
$APIOutput = $this->wellFormatedWriteAPICall ('DEleTE', $reqBody, $this->validAuthIdent, $entType, $ent->getId(), 'EXTENSIONproperties', $propKey);
Expand Down

0 comments on commit 53236a3

Please sign in to comment.