A little more test coverage
All checks were successful
timw4mail/HummingBirdAnimeClient/pipeline/head This commit looks good

This commit is contained in:
Timothy Warren 2020-12-10 17:04:45 -05:00
parent 292d9bbaaf
commit 71ee0a324c
4 changed files with 15 additions and 34 deletions

View File

@ -64,28 +64,4 @@ final class Anilist {
MangaReadingStatus::DROPPED => KMRS::DROPPED,
MangaReadingStatus::PLAN_TO_READ => KMRS::PLAN_TO_READ,
];
public static function getIdToWatchingStatusMap(): array
{
return [
'CURRENT' => AnimeWatchingStatus::WATCHING,
'COMPLETED' => AnimeWatchingStatus::COMPLETED,
'PAUSED' => AnimeWatchingStatus::ON_HOLD,
'DROPPED' => AnimeWatchingStatus::DROPPED,
'PLANNING' => AnimeWatchingStatus::PLAN_TO_WATCH,
'REPEATING' => AnimeWatchingStatus::WATCHING,
];
}
public static function getIdToReadingStatusMap(): array
{
return [
'CURRENT' => MangaReadingStatus::READING,
'COMPLETED' => MangaReadingStatus::COMPLETED,
'PAUSED' => MangaReadingStatus::ON_HOLD,
'DROPPED' => MangaReadingStatus::DROPPED,
'PLANNING' => MangaReadingStatus::PLAN_TO_READ,
'REPEATING' => MangaReadingStatus::READING,
];
}
}

View File

@ -49,15 +49,7 @@ final class MenuGenerator extends UrlGenerator {
*/
public static function new(ContainerInterface $container): self
{
try
{
return new static($container);
}
catch (\Throwable $e)
{
dump($e);
die();
}
return new self($container);
}
/**
@ -67,7 +59,7 @@ final class MenuGenerator extends UrlGenerator {
* @throws ConfigException
* @return string
*/
public function generate($menu) : string
public function generate(string $menu) : string
{
$menus = $this->config->get('menus');
$parsedConfig = $this->parseConfig($menus);

View File

@ -110,7 +110,9 @@ class UrlGenerator extends RoutingBase {
if ($defaultPath !== NULL)
{
// @codeCoverageIgnoreStart
return $this->url("{$type}/{$defaultPath}");
// @codeCoverageIgnoreEnd
}
throw new InvalidArgumentException("Invalid default type: '{$type}'");

View File

@ -18,6 +18,7 @@ namespace Aviat\AnimeClient\Tests;
use Aviat\AnimeClient\UrlGenerator;
use Aviat\Ion\Config;
use Aviat\Ion\Exception\DoubleRenderException;
class UrlGeneratorTest extends AnimeClientTestCase {
@ -49,4 +50,14 @@ class UrlGeneratorTest extends AnimeClientTestCase {
$result = $urlGenerator->assetUrl(...$args);
$this->assertEquals($expected, $result);
}
public function testDefaultUrlInvalidType(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage("Invalid default type: 'foo'");
$urlGenerator = new UrlGenerator($this->container);
$url = $urlGenerator->defaultUrl('foo');
}
}