8000 test: coverage for genre/magazine/producer lists + Watch; fix apple-touch-icon and 2 latent bugs by irfan-dahir · Pull Request #624 · jikan-me/jikan · GitHub
[go: up one dir, main page]

Skip to content

test: coverage for genre/magazine/producer lists + Watch; fix apple-touch-icon and 2 latent bugs - #624

Merged
irfan-dahir merged 1 commit into
5.0.0from
feat/parser-coverage-genre-watch-488
Oct 11, 2026
Merged

irfan-dahir merged 1 commit into
5.0.0from
feat/parser-coverage-genre-watch-488

Conversation

@irfan-dahir
Copy link
Copy Markdown
Collaborator

What / why

Closes 8 of the reported coverage gaps (composer endpoints:check): getAnimeGenres, getMangaGenres, getMagazines, getProducers, getPopularEpisodes, getRecentEpisodes, getPopularPromotionalVideos, getRecentPromotionalVideos. Coverage debt 30 → 22.

All new tests construct the endpoint parser from a recorded page and assert content the batch-1 way (ids / titles / counts / pagination):

New test Parser Endpoints
test/unit/Parser/Genre/AnimeGenreListParserTest.php Genre\AnimeGenreListParser getAnimeGenres
test/unit/Parser/Genre/MangaGenreListParserTest.php Genre\MangaGenreListParser getMangaGenres
test/unit/Parser/Magazine/MagazineListParserTest.php Magazine\MagazineListParser getMagazines
test/unit/Parser/Producer/ProducerListParserTest.php Producer\ProducerListParser getProducers
test/unit/Parser/Watch/WatchEpisodesParserTest.php Watch\WatchEpisodesParser getRecentEpisodes + getPopularEpisodes
test/unit/Parser/Watch/WatchPromotionalVideosParserTest.php Watch\WatchPromotionalVideosParser getRecentPromotionalVideos + getPopularPromotionalVideos

Fixtures live in jikan-fixtures PR #6 — all recorded live 2026-10-12, status 200, no redirects.

Task A — jikan#488 apple-touch-icon

Verified live today on an artless anime page and an artless manga page: both serve https://cdn.myanimelist.net/img/sp/icon/apple-touch-icon-256.png as og:image (no cover, "Add Picture" button). ImagePlaceholder now matches that fragment, and a recorded artless detail page (anime/43535) proves AnimeParser::getImageURL() → null:

  • test/unit/Parser/Anime/AnimePlaceholderImageTest.php
  • ImagePlaceholderTest extended (positive + negative cases, including other apple-touch-icon sizes as non-matches).

Two latent bugs the new coverage surfaced (now fixed)

  1. Model\Watch\EpisodeListItem::getEpisodes() declared return type RecentEpisodeListItem but received the array the parser builds — every call threw a TypeError. Now returns the RecentEpisodeListItem[] list.
  2. Genre list parsers read sections by position. manga.php prepends an "adapted from" genre-link block (All / Airing Now / Upcoming) before the genre sections, so MangaGenreListParser returned that block as "Genres". Both genre-list parsers now anchor the four sections by content (blocks whose links are /genre/ URLs) — verified identical results on both anime.php and manga.php.

Verification

  • composer test — 449 tests (428 baseline + 21 new), 8 skipped (News), 0 failures
  • php-cs-fixer fix --dry-run clean; grumphp pre-commit (cs-fixer, blacklist, paratest, phplint) + backend-suite gates (error_handling, test_network_coupling) clean
  • composer endpoints:check — manifest OK, coverage 22 (down from 30); endpoints.json + llm.txt regenerated
  • No live requests in test/ (recorded fixtures only)

Remaining coverage debt (22)

recommended batch 3: CharactersAndStaff, Forum (×2), Reviews, MangaMoreInfo, Pictures (character/person), Character/Manga/Person search, Search recent-online-users + user search, NewsList/Article, Recent/User recommendations, User clubs/friends/reviews/username — plus the two raw JSON list readers (getUserAnimeList/getUserMangaList, no parser, skip).

8000
…-touch-icon + 2 latent bugs

Closes 8 of the reported coverage gaps (scripts/generate_endpoints.php
--check): getAnimeGenres, getMangaGenres, getMagazines, getProducers,
getPopularEpisodes, getRecentEpisodes, getPopularPromotionalVideos,
getRecentPromotionalVideos now each have a test that drives the endpoint
parser. Coverage debt 30 -> 22.

New tests (all hermetic against fixture PR jikan-fixtures#6, recorded live
2026-10-12):
- test/unit/Parser/Genre/{Anime,Manga}GenreListParserTest
- test/unit/Parser/Magazine/MagazineListParserTest
- test/unit/Parser/Producer/ProducerListParserTest
- test/unit/Parser/Watch/{WatchEpisodesParserTest,WatchPromotionalVideosParserTest}

Bug fixes surfaced by the coverage work:
- ImagePlaceholder (jikan#488): artless anime/manga detail pages fall back to
  the MAL site icon (/img/sp/icon/apple-touch-icon-256.png) as og:image; it is
  now treated as a placeholder so getImageURL() resolves to null. Recorded
  proof: AnimePlaceholderImageTest on anime/43535.
- Genre list parsers read the genre sections by position, which misaligns on
  manga.php where MAL prepends an 'adapted from' genre-link block; both
  parsers now anchor the four sections by content (blocks whose links are
  /genre/ URLs).
- Model\Watch\EpisodeListItem::getEpisodes() declared return type
  RecentEpisodeListItem but receives an array - every call threw a TypeError.

Also: CHANGELOG Fixed entries, DECISIONS fragment list refresh, regenerated
endpoint catalog (endpoints.json + llm.txt).
@irfan-dahir
irfan-dahir merged commit 50b5929 into 5.0.0 Oct 11, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0