Skip to content

Commit 0376445

Browse files
committed
Quality Fixes
1 parent 57ee841 commit 0376445

File tree

5 files changed

+11
-2
lines changed

5 files changed

+11
-2
lines changed

src/Endpoint/Abstracts/AbstractSugarBeanEndpoint.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,13 @@ protected function configurePayload(): mixed
188188
if (isset($data[AbstractSugarBeanCollectionEndpoint::SUGAR_FIELDS_DATA_PROPERTY])) {
189189
$fields = $data[AbstractSugarBeanCollectionEndpoint::SUGAR_FIELDS_DATA_PROPERTY];
190190
}
191+
191192
$data->reset();
192193
$data->set($this->toArray());
193194
if (!empty($fields)) {
194195
$data[AbstractSugarBeanCollectionEndpoint::SUGAR_FIELDS_DATA_PROPERTY] = $fields;
195196
}
197+
196198
$syncKeyField = $this->getSyncKeyField();
197199
if (!empty($syncKeyField)) {
198200
$data[Integrate::DATA_SYNC_KEY_FIELD] = $syncKeyField;
@@ -250,8 +252,10 @@ protected function parseResponse(Response $response): void
250252
} else {
251253
$model = $body[Integrate::INTEGRATE_RESPONSE_PROP];
252254
}
255+
253256
$this->syncFromApi($model);
254257
}
258+
255259
return;
256260
}
257261
}

src/Endpoint/Integrate.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ protected function configureAction(string $action, array $arguments = []): void
105105
$action = self::INTEGRATE_ACTION_RETRIEVE;
106106
break;
107107
}
108+
108109
if ($this->_action !== $action) {
109110
$this->_action = $action;
110111
}
@@ -188,6 +189,7 @@ protected function parseResponse(Response $response): void
188189
} else {
189190
$model = $body[Integrate::INTEGRATE_RESPONSE_PROP];
190191
}
192+
191193
$this->syncFromApi($model);
192194
if (isset($this->_sugarBean)) {
193195
$this->_sugarBean->set($this->toArray());

src/Endpoint/Traits/IntegrateSyncKeyTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function getSyncKey(): string|int|null
4242
} elseif (property_exists($this, '_attributes')) {
4343
$key = $this->_attributes[$field];
4444
}
45+
4546
//@codeCoverageIgnoreEnd
4647
return $key;
4748
}

tests/Endpoint/AbstractSugarBeanEndpointTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function testCompileRequest(): void
5555

5656
$Bean->setUrlArgs(['Accounts','12345']);
5757
$Bean->setCurrentAction(AbstractSugarBeanEndpoint::BEAN_ACTION_UPSERT);
58+
5859
$Bean->sync_key = '67890';
5960
$Request = $Bean->compileRequest();
6061
$this->assertEquals("PATCH", $Request->getMethod());
@@ -780,7 +781,7 @@ public function testUpsertAction(): void
780781
$Bean->set([
781782
'name' => 'Test Account',
782783
'account_type' => 'Prospect',
783-
'sync_key' => '098765'
784+
'sync_key' => '098765',
784785
]);
785786
$Bean->upsert();
786787

@@ -811,7 +812,7 @@ public function testUpsertAction(): void
811812
'account_type' => 'Prospect',
812813
'sync_key' => '098765',
813814
'sync_key_field_value' => '098765',
814-
'fields' => ['test']
815+
'fields' => ['test'],
815816
], json_decode($payload, true));
816817
$this->assertEquals('12345', $Bean->id);
817818
$this->assertEquals('foobar', $Bean->test);

tests/Endpoint/IntegrateTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ public function testGetBySyncKey(): void
197197
$this->client->mockResponses->append(new Response('200', [], json_encode($this->responsePayload)));
198198
$endpoint->setCurrentAction(Integrate::MODEL_ACTION_RETRIEVE);
199199
$endpoint->execute();
200+
200201
$request = $this->client->mockResponses->getLastRequest();
201202
$this->assertEquals('GET', $request->getMethod());
202203
$this->assertEquals('/rest/v11/integrate/Accounts', $request->getUri()->getPath());

0 commit comments

Comments
 (0)