Skip to content

Commit

Permalink
refactor: remove makeJson() since its part of the Problem-API
Browse files Browse the repository at this point in the history
refs #8
  • Loading branch information
ThorstenSuckow committed Jun 12, 2022
1 parent 17d8ffe commit 3197499
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 39 deletions.
19 changes: 0 additions & 19 deletions src/Http/Json/Problem/ProblemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,6 @@
*/
class ProblemFactory
{
/**
* Returns an array containing of the json representative for the made Problem,
* and the second index is the status used.
*
* @param int $status
* @param string|null $title
* @param string|null $detail
* @return array
*/
public static function makeJson(int $status, string $title = null, string $detail = null): array
{
$made = self::make($status, $title, $detail);

return [
$made->toJson(),
$made->getStatus()
];
}


/**
* Returns a new Problem based on the status submitted.
Expand Down
20 changes: 0 additions & 20 deletions tests/Http/Json/Problem/ProblemFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,4 @@ public function testMake()
$this->assertSame("detail", $problem->getDetail());
}

/**
* test makeJson()
*/
public function testMakeJson()
{
$statuses = [400, 405, 500, 123442];

foreach ($statuses as $status) {
$problem = ProblemFactory::makeJson($status, "title", "detail");
$this->assertIsArray($problem[0]);
$this->assertSame(
ProblemFactory::make($status, "title", "detail")->toJson(),
$problem[0]
);
$this->assertSame(
$status,
$problem[1]
);
}
}
}

0 comments on commit 3197499

Please sign in to comment.