Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
4 changed files with 50 additions and 67 deletions
Showing only changes of commit ca402bd826 - Show all commits

View File

@ -6,6 +6,9 @@
<br />
<br />
<table class="media_details">
<tr>
<th colspan="2">General</th>
</tr>
<tr>
<td>Location</td>
<td><?= $attributes['location'] ?></td>
@ -18,7 +21,7 @@
<tr>
<td><?= $escape->html($attributes['waifuOrHusbando']) ?></td>
<td>
<?php
<?php
$character = $relationships['waifu']['attributes'];
echo $helper->a(
$url->generate('character', ['slug' => $character['slug']]),
@ -28,6 +31,21 @@
</td>
</tr>
<?php endif ?>
<tr>
<th colspan="2">User Stats</th>
</tr>
<tr>
<td># of Posts</td>
<td><?= $attributes['postsCount'] ?></td>
</tr>
<tr>
<td># of Comments</td>
<td><?= $attributes['commentsCount'] ?></td>
</tr>
<tr>
<td># of Media Rated</td>
<td><?= $attributes['ratingsCount'] ?></td>
</tr>
</table>
</div>
<div>
@ -35,9 +53,30 @@
<dt>About:</dt>
<dd><?= $escape->html($attributes['bio']) ?></dd>
</dl>
<?php /* <pre><?= json_encode($attributes, \JSON_PRETTY_PRINT) ?></pre>
<pre><?= json_encode($relationships, \JSON_PRETTY_PRINT) ?></pre>
<pre><?= json_encode($included, \JSON_PRETTY_PRINT) ?></pre> */ ?>
<?php if ( ! empty($favorites)): ?>
<h3>Favorites:</h3>
<?php if ( ! empty($favorites['characters'])): ?>
<section>
<h4>Characters</h4>
<div class="flex flex-wrap">
<?php foreach($favorites['characters'] as $char): ?>
<?php if ( ! empty($char['image']['original'])): ?>
<div class="small_character">
<?php $link = $url->generate('character', ['slug' => $char['slug']]) ?>
<?= $helper->a($link, $char['name']); ?>
<br />
<a href="<?= $link ?>">
<?= $helper->img($char['image']['original'], [
'width' => '225'
]) ?>
</a>
</div>
<?php endif ?>
<?php endforeach ?>
</div>
</section>
<?php endif ?>
<?php endif ?>
</div>
</section>
</main>

View File

@ -80,31 +80,12 @@ class ControllerTest extends AnimeClientTestCase {
$this->assertTrue(is_object($this->BaseController));
}
public function dataGet()
public function testFormatTitle()
{
return [
'response' => [
'key' => 'response',
],
'config' => [
'key' => 'config',
]
];
}
/**
* @dataProvider dataGet
*/
public function testGet($key)
{
$result = $this->BaseController->__get($key);
$this->assertEquals($this->container->get($key), $result);
}
public function testGetNull()
{
$result = $this->BaseController->__get('foo');
$this->assertNull($result);
$this->assertEquals(
$this->BaseController->formatTitle('foo', 'bar', 'baz'),
'foo &middot; bar &middot; baz'
);
}
}

View File

@ -1,39 +0,0 @@
<?php declare(strict_types=1);
/**
* Hummingbird Anime List Client
*
* An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
*
* PHP version 7
*
* @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2017 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 4.0
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Tests;
use Aviat\AnimeClient\ControllerTrait;
class ControllerTraitTest extends AnimeClientTestCase {
public function setUp()
{
parent::setUp();
$this->controller = new class {
use ControllerTrait;
};
}
public function testFormatTitle()
{
$this->assertEquals(
$this->controller->formatTitle('foo', 'bar', 'baz'),
'foo &middot; bar &middot; baz'
);
}
}

View File

@ -229,6 +229,7 @@ class DispatcherTest extends AnimeClientTestCase {
'manga' => 'Aviat\AnimeClient\Controller\Manga',
'collection' => 'Aviat\AnimeClient\Controller\Collection',
'character' => 'Aviat\AnimeClient\Controller\Character',
'index' => 'Aviat\AnimeClient\Controller\Index',
]
],
'empty_controller_list' => [
@ -249,6 +250,7 @@ class DispatcherTest extends AnimeClientTestCase {
'manga' => 'Aviat\AnimeClient\Controller\Manga',
'collection' => 'Aviat\AnimeClient\Controller\Collection',
'character' => 'Aviat\AnimeClient\Controller\Character',
'index' => 'Aviat\AnimeClient\Controller\Index',
]
]
];