Add methods to manipulate shared slices #1441
continuous-integration.yml
on: push
ci
/
Generate job matrix
9s
PHPUnit Coverage
38s
Check for missing dependencies
28s
Mutation Tests
1m 35s
Matrix: ci / QA Checks
Annotations
1 error and 10 warnings
Mutation Tests
Process completed with exit code 1.
|
Mutation Tests:
src/BaseClient.php#L78
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
$body = Json::decodeToArray((string) $response->getBody());
$list = [];
foreach ($body as $item) {
- Assert::isArray($item);
+
$definition = Definition::fromArray($item);
$list[$definition->id()] = $definition;
}
|
Mutation Tests:
src/BaseClient.php#L202
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
$body = Json::decodeToArray((string) $response->getBody());
$list = [];
foreach ($body as $item) {
- Assert::isArray($item);
+
$definition = SharedSlice::fromArray($item);
$list[$definition->id] = $definition;
}
|
Mutation Tests:
src/BaseClient.php#L227
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
throw InsertFailed::forSlice($definition, $request, $response);
}
if ($response->getStatusCode() !== 201) {
- throw UnexpectedStatusCode::withExpectedCode(201, $request, $response);
+ throw UnexpectedStatusCode::withExpectedCode(200, $request, $response);
}
}
public function updateSharedSlice(SharedSlice $definition) : void
|
Mutation Tests:
src/BaseClient.php#L227
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
throw InsertFailed::forSlice($definition, $request, $response);
}
if ($response->getStatusCode() !== 201) {
- throw UnexpectedStatusCode::withExpectedCode(201, $request, $response);
+ throw UnexpectedStatusCode::withExpectedCode(202, $request, $response);
}
}
public function updateSharedSlice(SharedSlice $definition) : void
|
Mutation Tests:
src/BaseClient.php#L248
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
throw UpdateFailed::forSlice($definition, $request, $response);
}
if ($response->getStatusCode() !== 204) {
- throw UnexpectedStatusCode::withExpectedCode(204, $request, $response);
+ throw UnexpectedStatusCode::withExpectedCode(203, $request, $response);
}
}
public function saveSharedSlice(SharedSlice $slice) : void
|
Mutation Tests:
src/BaseClient.php#L248
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
throw UpdateFailed::forSlice($definition, $request, $response);
}
if ($response->getStatusCode() !== 204) {
- throw UnexpectedStatusCode::withExpectedCode(204, $request, $response);
+ throw UnexpectedStatusCode::withExpectedCode(205, $request, $response);
}
}
public function saveSharedSlice(SharedSlice $slice) : void
|
Mutation Tests:
src/BaseClient.php#L257
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
try {
$current = $this->getSharedSlice($slice->id);
} catch (DefinitionNotFound) {
- $this->createSharedSlice($slice);
+
return;
}
if ($slice->equals($current)) {
|
Mutation Tests:
src/BaseClient.php#L289
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
$request = $this->request('DELETE', sprintf('/slices/%s', $id));
$response = $this->send($request);
if ($response->getStatusCode() !== 204) {
- throw UnexpectedStatusCode::withExpectedCode(204, $request, $response);
+ throw UnexpectedStatusCode::withExpectedCode(203, $request, $response);
}
}
}
|
Mutation Tests:
src/BaseClient.php#L289
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
$request = $this->request('DELETE', sprintf('/slices/%s', $id));
$response = $this->send($request);
if ($response->getStatusCode() !== 204) {
- throw UnexpectedStatusCode::withExpectedCode(204, $request, $response);
+ throw UnexpectedStatusCode::withExpectedCode(205, $request, $response);
}
}
}
|
Mutation Tests:
src/Json.php#L28
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
public static function decodeToArray(string $json) : array
{
try {
- $decoded = json_decode($json, true, 512, JSON_THROW_ON_ERROR);
+ $decoded = json_decode($json, true, 511, JSON_THROW_ON_ERROR);
Assert::isArray($decoded);
return $decoded;
} catch (JsonException $e) {
|