Fix unit tests

This commit is contained in:
Timothy Warren 2017-01-10 21:13:44 -05:00
parent 39118d63e5
commit 712956d564
8 changed files with 87 additions and 44 deletions

View File

@ -19,7 +19,7 @@
"aura/router": "3.*",
"aura/session": "2.*",
"aviat/banker": "dev-master",
"aviat/ion": "dev-master",
"aviat/ion": "1.0.*",
"filp/whoops": "2.0.*",
"guzzlehttp/guzzle": "6.*",
"monolog/monolog": "1.*",
@ -44,6 +44,6 @@
"squizlabs/php_codesniffer": "^3.0.0@beta"
},
"scripts": {
"build:css": "cd public && npm run build && cd .."
}
}

View File

@ -1226,6 +1226,7 @@ a:hover, a:active {
height:100%;
width:100%;
vertical-align:middle;
line-height: 1.25em;
}
#series_list .name small {

View File

@ -488,6 +488,7 @@ a:hover, a:active {
height:100%;
width:100%;
vertical-align:middle;
line-height: 1.25em;
}
#series_list .name small {
color: #fff;

66
src/API/JsonAPI.php Normal file
View File

@ -0,0 +1,66 @@
<?php declare(strict_types=1);
/**
* Anime List Client
*
* An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
*
* PHP version 7
*
* @package AnimeListClient
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 4.0
* @link https://github.com/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API;
/**
* Class encapsulating Json API data structure for a request or response
*/
class JsonAPI {
/**
* The full data array
*
* Basic structure is generally like so:
* @example [
* 'id' => '12016665',
* 'type' => 'libraryEntries',
* 'links' => [
* 'self' => 'https://kitsu.io/api/edge/library-entries/13016665'
* ],
* 'attributes' => [
*
* ]
* ]
*
* @var array
*/
protected $data = [];
/**
* Related objects included with the request
*
* @var array
*/
protected $included = [];
/**
* Pagination links
*
* @var array
*/
protected $links = [];
/**
* Parse a JsonAPI response into its components
*
* @param array $data
*/
public function parse(array $data)
{
}
}

View File

@ -1,32 +0,0 @@
<?php declare(strict_types=1);
/**
* Anime List Client
*
* An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
*
* PHP version 7
*
* @package AnimeListClient
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 4.0
* @link https://github.com/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu\Enum;
use Aviat\Ion\Enum as BaseEnum;
/**
* Type of Anime
*/
class AnimeShowType extends BaseEnum {
const TV = 'TV';
const MOVIE = 'Movie';
const OVA = 'OVA';
const ONA = 'ONA';
const SPECIAL = 'Special';
const MUSIC = 'Music';
}
// End of AnimeShowType.php

View File

@ -220,9 +220,12 @@ class KitsuModel {
'query' => [
'filter' => [
'text' => $query
]
],
'include' => 'media'
],
'page' => [
'offset' => 0,
'limit' => 20
],
]
];
$raw = $this->getRequest($type, $options);
@ -236,6 +239,12 @@ class KitsuModel {
return $raw;
}
public function createListItem(array $data): bool
{
$data['user_id'] = $this->getUserIdByUsername($this->getUsername());
return $this->listItem->create($data);
}
public function getListItem(string $listId): array
{
$baseData = $this->listItem->get($listId);
@ -255,12 +264,6 @@ class KitsuModel {
}
}
public function createListItem(array $data): bool
{
$data['user_id'] = $this->getUserIdByUsername($this->getUsername());
return $this->listItem->create($data);
}
public function updateListItem(array $data)
{
try

View File

@ -40,7 +40,7 @@ class AnimeListTransformer extends AbstractTransformer {
$rating = (int) 2 * $item['attributes']['rating'];
$total_episodes = array_key_exists('episodeCount', $anime)
$total_episodes = array_key_exists('episodeCount', $anime) && (int) $anime['episodeCount'] !== 0
? (int) $anime['episodeCount']
: '-';

View File

@ -51,6 +51,10 @@ class AnimeClient_TestCase extends PHPUnit_Framework_TestCase {
'asset_path' => '//localhost/assets/',
'img_cache_path' => _dir(ROOT_DIR, 'public/images'),
'data_cache_path' => _dir(TEST_DATA_DIR, 'cache'),
'cache' => [
'driver' => 'null',
'connection' => []
],
'database' => [
'collection' => [
'type' => 'sqlite',