develop #37

Merged
timw4mail merged 15 commits from develop into master 2021-02-03 10:07:11 -05:00
4 changed files with 15 additions and 34 deletions
Showing only changes of commit 71ee0a324c - Show all commits

View File

@ -64,28 +64,4 @@ final class Anilist {
MangaReadingStatus::DROPPED => KMRS::DROPPED, MangaReadingStatus::DROPPED => KMRS::DROPPED,
MangaReadingStatus::PLAN_TO_READ => KMRS::PLAN_TO_READ, 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 public static function new(ContainerInterface $container): self
{ {
try return new self($container);
{
return new static($container);
}
catch (\Throwable $e)
{
dump($e);
die();
}
} }
/** /**
@ -67,7 +59,7 @@ final class MenuGenerator extends UrlGenerator {
* @throws ConfigException * @throws ConfigException
* @return string * @return string
*/ */
public function generate($menu) : string public function generate(string $menu) : string
{ {
$menus = $this->config->get('menus'); $menus = $this->config->get('menus');
$parsedConfig = $this->parseConfig($menus); $parsedConfig = $this->parseConfig($menus);

View File

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

View File

@ -18,6 +18,7 @@ namespace Aviat\AnimeClient\Tests;
use Aviat\AnimeClient\UrlGenerator; use Aviat\AnimeClient\UrlGenerator;
use Aviat\Ion\Config; use Aviat\Ion\Config;
use Aviat\Ion\Exception\DoubleRenderException;
class UrlGeneratorTest extends AnimeClientTestCase { class UrlGeneratorTest extends AnimeClientTestCase {
@ -49,4 +50,14 @@ class UrlGeneratorTest extends AnimeClientTestCase {
$result = $urlGenerator->assetUrl(...$args); $result = $urlGenerator->assetUrl(...$args);
$this->assertEquals($expected, $result); $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');
}
} }