Shore up coverage
This commit is contained in:
parent
b68a68b500
commit
aed3749da8
3 changed files with 11 additions and 1 deletions
|
@ -31,7 +31,8 @@ class Exception extends \JKingWeb\Arsse\AbstractException {
|
|||
} elseif (preg_match("/^cURL error (\d+):/", $msg, $match)) {
|
||||
$msgID = self::CURL_ERROR_MAP[(int) $match[1]] ?? "internalError";
|
||||
} else {
|
||||
$msgID = "internalError";
|
||||
// Fallback for future Guzzle exceptions we may not know about
|
||||
$msgID = "internalError"; // @codeCoverageIgnore
|
||||
}
|
||||
} elseif ($e instanceof PicoFeedException) {
|
||||
$className = get_class($e);
|
||||
|
|
|
@ -315,6 +315,9 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
$this->assertNan($act, $msg);
|
||||
} elseif (is_scalar($exp)) {
|
||||
$this->assertSame($exp, $act, $msg);
|
||||
} elseif ($exp instanceof \DateInterval && $act instanceof \DateInterval) {
|
||||
$format = "\Py\Ym\Md\D\Th\HiMs\S";
|
||||
$this->assertSame($exp->format($format), $act->format($format), $msg);
|
||||
} else {
|
||||
$this->assertEquals($exp, $act, $msg);
|
||||
}
|
||||
|
@ -532,6 +535,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
[$this->i("P2DT1H"), [null,true], [true, false], [(48 + 1) * 60 * 60, false], [1.0 * (48 + 1) * 60 * 60, false], ["P2DT1H", true], [[$this->i("P2DT1H")], false], [$this->i("P2DT1H"), true]],
|
||||
[$this->i("PT0H"), [null,true], [true, false], [0, false], [0.0, false], ["PT0S", true], [[$this->i("PT0H")], false], [$this->i("PT0H"), true]],
|
||||
[$dateDiff, [null,true], [true, false], [366 * 24 * 60 * 60, false], [1.0 * 366 * 24 * 60 * 60, false], ["P366D", true], [[$dateDiff], false], [$dateNorm, true]],
|
||||
["1 year, 2 days", [null,true], [true, false], [0, false], [0.0, false], ["1 year, 2 days", true], [["1 year, 2 days"], false], [$this->i("P1Y2D"), false]],
|
||||
["P1Y2D", [null,true], [true, false], [0, false], [0.0, false], ["P1Y2D", true], [["P1Y2D"], false], [$this->i("P1Y2D"), true]],
|
||||
] as $set) {
|
||||
// shift the input value off the set
|
||||
|
|
|
@ -169,6 +169,11 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
];
|
||||
}
|
||||
|
||||
public function testRejectMalformedData(): void {
|
||||
$exp = V1::respError(["InvalidBodyJSON", "Syntax error"], 400);
|
||||
$this->assertMessage($exp, $this->req("POST", "/discover", "{"));
|
||||
}
|
||||
|
||||
public function testRejectBadlyTypedData(): void {
|
||||
$exp = V1::respError(["InvalidInputType", 'field' => "url", 'expected' => "string", 'actual' => "integer"], 422);
|
||||
$this->assertMessage($exp, $this->req("POST", "/discover", ['url' => 2112]));
|
||||
|
|
Loading…
Reference in a new issue