Skip to content

Commit aa1966c

Browse files
rubenvdlindeConduction Release Bot
andauthored
test(feed): name the failure test after the status it actually exercises (#104)
FeedRefreshServiceTest::testRefreshFeed500RecordsFailurePreservesItems stubs IResponse::getStatusCode() to 503 and asserts the recorded failure reason starts with "503". The name and the docblock both said 500 — a status nothing in the test produces or checks. The test itself is sound and load-bearing; only the label was wrong. REQ-FRJ-006 is written about per-feed failure tolerance generally and does not single out a status, so 503 is a faithful representative and no coverage changes hands. Renamed, docblock corrected, and the reason for the old label recorded so it is not "fixed" back. Behaviour unchanged; this is a rename plus comments. Co-authored-by: Conduction Release Bot <release-bot@conduction.nl>
1 parent 19e9b49 commit aa1966c

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

tests/Unit/Service/FeedRefreshServiceTest.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,18 @@ public function testRefreshFeed200ParsesAndPersists(): void
283283
}//end testRefreshFeed200ParsesAndPersists()
284284

285285
/**
286-
* `refreshFeed` on HTTP 500: records `"500 ..."` failure reason,
286+
* `refreshFeed` on HTTP 503: records `"503 ..."` failure reason,
287287
* leaves prior `itemsJson` untouched (REQ-FRJ-006).
288288
*
289+
* The stub answers 503 and the assertion pins `"503 ..."`; the name and
290+
* this docblock both used to say 500, which named a status the body never
291+
* exercises. REQ-FRJ-006 is written about failure tolerance generally and
292+
* does not single out a status, so 503 is a faithful representative — the
293+
* only thing wrong here was the label.
294+
*
289295
* @return void
290296
*/
291-
public function testRefreshFeed500RecordsFailurePreservesItems(): void
297+
public function testRefreshFeed503RecordsFailurePreservesItems(): void
292298
{
293299
$existing = new FeedCache();
294300
$existing->setFeedUrl('https://gone.example.com/rss');
@@ -322,7 +328,7 @@ public function testRefreshFeed500RecordsFailurePreservesItems(): void
322328
$this->assertNotNull(actual: $captured);
323329
$this->assertStringStartsWith(prefix: '503', string: (string) $captured->getLastFailureReason());
324330
$this->assertCount(expectedCount: 1, haystack: $captured->decodeItems());
325-
}//end testRefreshFeed500RecordsFailurePreservesItems()
331+
}//end testRefreshFeed503RecordsFailurePreservesItems()
326332

327333
/**
328334
* `refreshFeed` on transport exception (e.g. timeout): records

0 commit comments

Comments
 (0)