From 7bcff79d6e875d0cb7ea5ce7537e760e52c549c8 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Wed, 6 May 2020 10:12:49 -0400 Subject: [PATCH] Fix failing test --- src/AnimeClient/API/Kitsu.php | 13 +------------ .../AnimeTransformerTest__testTransform__1.yml | 3 +++ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/AnimeClient/API/Kitsu.php b/src/AnimeClient/API/Kitsu.php index 94bc3edb..40268466 100644 --- a/src/AnimeClient/API/Kitsu.php +++ b/src/AnimeClient/API/Kitsu.php @@ -206,7 +206,7 @@ final class Kitsu { $raw = array_unique([ $data['canonicalTitle'], ...array_values($data['titles']), - ...array_values($data['abbreviatedTitles']), + ...array_values($data['abbreviatedTitles'] ?? []), ]); return array_diff($raw,[$data['canonicalTitle']]); @@ -234,17 +234,6 @@ final class Kitsu { } } - if (array_key_exists('abbreviatedTitles', $data)) - { - foreach ($data['abbreviatedTitles'] as $alternateTitle) - { - if (self::titleIsUnique($alternateTitle, $valid)) - { - $valid[] = $alternateTitle; - } - } - } - return $valid; } diff --git a/tests/AnimeClient/API/Kitsu/Transformer/__snapshots__/AnimeTransformerTest__testTransform__1.yml b/tests/AnimeClient/API/Kitsu/Transformer/__snapshots__/AnimeTransformerTest__testTransform__1.yml index f736c331..3e28a782 100644 --- a/tests/AnimeClient/API/Kitsu/Transformer/__snapshots__/AnimeTransformerTest__testTransform__1.yml +++ b/tests/AnimeClient/API/Kitsu/Transformer/__snapshots__/AnimeTransformerTest__testTransform__1.yml @@ -29,5 +29,8 @@ titles: - 'Attack on Titan' - 'Shingeki no Kyojin' - 進撃の巨人 +titles_more: + 2: 'Shingeki no Kyojin' + 3: 進撃の巨人 trailer_id: n4Nj6Y_SNYI url: 'https://kitsu.io/anime/attack-on-titan'