Add tests for title uniqueness check
This commit is contained in:
parent
a18c0bd7b5
commit
2f789cc4cf
@ -416,7 +416,7 @@ final class Kitsu {
|
||||
* @param array $existingTitles
|
||||
* @return bool
|
||||
*/
|
||||
private static function titleIsUnique(?string $title = '', array $existingTitles = []): bool
|
||||
protected static function titleIsUnique(?string $title = '', array $existingTitles = []): bool
|
||||
{
|
||||
if (empty($title))
|
||||
{
|
||||
|
@ -122,4 +122,36 @@ class KitsuTest extends TestCase {
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
public function testFilterLocalizedTitles()
|
||||
{
|
||||
$input = [
|
||||
'canonical' => 'foo',
|
||||
'localized' => [
|
||||
'en' => 'Foo the Movie',
|
||||
'fr' => '',
|
||||
'jp' => NULL,
|
||||
],
|
||||
'alternatives' => [],
|
||||
];
|
||||
|
||||
$actual = Kitsu::filterLocalizedTitles($input);
|
||||
|
||||
$this->assertEquals(['Foo the Movie'], $actual);
|
||||
}
|
||||
|
||||
public function testGetFilteredTitles()
|
||||
{
|
||||
$input = [
|
||||
'canonical' => 'foo',
|
||||
'localized' => [
|
||||
'en' => 'Foo the Movie'
|
||||
],
|
||||
'alternatives' => [],
|
||||
];
|
||||
|
||||
$actual = Kitsu::getFilteredTitles($input);
|
||||
|
||||
$this->assertEquals(['Foo the Movie'], $actual);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user