Version 5.1 - All the GraphQL #32
@ -13,7 +13,7 @@
|
||||
</filter>
|
||||
<testsuites>
|
||||
<testsuite name="AnimeClient">
|
||||
<directory>../tests/AnimeClient</directory>
|
||||
<directory>../tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<logging>
|
||||
|
@ -12,7 +12,7 @@
|
||||
</filter>
|
||||
<testsuites>
|
||||
<testsuite name="AnimeClient">
|
||||
<directory>tests/AnimeClient</directory>
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<php>
|
||||
|
@ -9,7 +9,7 @@ class AnimeModelTest extends AnimeClient_TestCase {
|
||||
{
|
||||
parent::setUp();
|
||||
$this->animeModel = new Friend(new TestAnimeModel($this->container));
|
||||
$this->mockDir = __DIR__ . '/../../test_data/anime_list/search_mocks';
|
||||
$this->mockDir = __DIR__ . '/../test_data/anime_list/search_mocks';
|
||||
}
|
||||
|
||||
public function dataSearch()
|
||||
@ -50,7 +50,8 @@ class AnimeModelTest extends AnimeClient_TestCase {
|
||||
], "[]");
|
||||
$this->animeModel->__set('client', $client);
|
||||
|
||||
$this->setExpectedException('\RuntimeException');
|
||||
$this->expectException('RuntimeException');
|
||||
|
||||
$this->animeModel->search('');
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ class MangaModelTest extends AnimeClient_TestCase {
|
||||
parent::setUp();
|
||||
$this->container->setInstance('util', new MockUtil($this->container));
|
||||
$this->model = new Friend(new TestMangaModel($this->container));
|
||||
$this->mockDir = __DIR__ . '/../../test_data/manga_list';
|
||||
$this->mockDir = __DIR__ . '/../test_data/manga_list';
|
||||
}
|
||||
|
||||
public function testZipperLists()
|
@ -9,8 +9,8 @@ class AnimeListTransformerTest extends AnimeClient_TestCase {
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->start_file = __DIR__ . '/../../../test_data/anime_list/anime-completed.json';
|
||||
$this->res_file = __DIR__ . '/../../../test_data/anime_list/anime-completed-transformed.json';
|
||||
$this->start_file = __DIR__ . '/../test_data/anime_list/anime-completed.json';
|
||||
$this->res_file = __DIR__ . '/../test_data/anime_list/anime-completed-transformed.json';
|
||||
$this->transformer = new AnimeListTransformer();
|
||||
$this->transformerFriend = new Friend($this->transformer);
|
||||
}
|
@ -8,8 +8,8 @@ class MangaListTransformerTest extends AnimeClient_TestCase {
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->start_file = __DIR__ . '/../../../test_data/manga_list/manga-zippered.json';
|
||||
$this->res_file = __DIR__ . '/../../../test_data/manga_list/manga-transformed.json';
|
||||
$this->start_file = __DIR__ . '/../test_data/manga_list/manga-zippered.json';
|
||||
$this->res_file = __DIR__ . '/../test_data/manga_list/manga-transformed.json';
|
||||
$this->transformer = new MangaListTransformer();
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ class MangaListsZipperTest extends AnimeClient_TestCase {
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->start_file = __DIR__ . '/../../../test_data/manga_list/manga.json';
|
||||
$this->res_file = __DIR__ . '/../../../test_data/manga_list/manga-zippered.json';
|
||||
$this->start_file = __DIR__ . '/../test_data/manga_list/manga.json';
|
||||
$this->res_file = __DIR__ . '/../test_data/manga_list/manga-zippered.json';
|
||||
|
||||
$json = Json::decodeFile($this->start_file);
|
||||
$this->mangaListsZipper = new MangaListsZipper($json);
|
@ -1,78 +1,80 @@
|
||||
<?php
|
||||
|
||||
use Aviat\AnimeClient\Util;
|
||||
|
||||
class UtilTest extends AnimeClient_TestCase {
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->util = new Util($this->container);
|
||||
}
|
||||
|
||||
public function testIsSelected()
|
||||
{
|
||||
// Failure to match
|
||||
$this->assertEquals('', Util::is_selected('foo', 'bar'));
|
||||
|
||||
// Matches
|
||||
$this->assertEquals('selected', Util::is_selected('foo', 'foo'));
|
||||
}
|
||||
|
||||
public function testIsNotSelected()
|
||||
{
|
||||
// Failure to match
|
||||
$this->assertEquals('selected', Util::is_not_selected('foo', 'bar'));
|
||||
|
||||
// Matches
|
||||
$this->assertEquals('', Util::is_not_selected('foo', 'foo'));
|
||||
}
|
||||
|
||||
public function dataIsViewPage()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'uri' => '/anime/update',
|
||||
'expected' => FALSE
|
||||
],
|
||||
[
|
||||
'uri' => '/anime/watching',
|
||||
'expected' => TRUE
|
||||
],
|
||||
[
|
||||
'uri' => '/manga/reading',
|
||||
'expected' => TRUE
|
||||
],
|
||||
[
|
||||
'uri' => '/manga/update',
|
||||
'expected' => FALSE
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataIsViewPage
|
||||
*/
|
||||
public function testIsViewPage($uri, $expected)
|
||||
{
|
||||
$this->setSuperGlobals([
|
||||
'_SERVER' => [
|
||||
'REQUEST_URI' => $uri
|
||||
]
|
||||
]);
|
||||
$this->assertEquals($expected, $this->util->is_view_page());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataIsViewPage
|
||||
*/
|
||||
public function testIsFormPage($uri, $expected)
|
||||
{
|
||||
$this->setSuperGlobals([
|
||||
'_SERVER' => [
|
||||
'REQUEST_URI' => $uri
|
||||
]
|
||||
]);
|
||||
$this->assertEquals(!$expected, $this->util->is_form_page());
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
namespace Aviat\AnimeClient\Tests;
|
||||
|
||||
use Aviat\AnimeClient\Util;
|
||||
|
||||
class UtilTest extends \AnimeClient_TestCase {
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->util = new Util($this->container);
|
||||
}
|
||||
|
||||
public function testIsSelected()
|
||||
{
|
||||
// Failure to match
|
||||
$this->assertEquals('', Util::is_selected('foo', 'bar'));
|
||||
|
||||
// Matches
|
||||
$this->assertEquals('selected', Util::is_selected('foo', 'foo'));
|
||||
}
|
||||
|
||||
public function testIsNotSelected()
|
||||
{
|
||||
// Failure to match
|
||||
$this->assertEquals('selected', Util::is_not_selected('foo', 'bar'));
|
||||
|
||||
// Matches
|
||||
$this->assertEquals('', Util::is_not_selected('foo', 'foo'));
|
||||
}
|
||||
|
||||
public function dataIsViewPage()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'uri' => '/anime/update',
|
||||
'expected' => FALSE
|
||||
],
|
||||
[
|
||||
'uri' => '/anime/watching',
|
||||
'expected' => TRUE
|
||||
],
|
||||
[
|
||||
'uri' => '/manga/reading',
|
||||
'expected' => TRUE
|
||||
],
|
||||
[
|
||||
'uri' => '/manga/update',
|
||||
'expected' => FALSE
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataIsViewPage
|
||||
*/
|
||||
public function testIsViewPage($uri, $expected)
|
||||
{
|
||||
$this->setSuperGlobals([
|
||||
'_SERVER' => [
|
||||
'REQUEST_URI' => $uri
|
||||
]
|
||||
]);
|
||||
$this->assertEquals($expected, $this->util->is_view_page());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataIsViewPage
|
||||
*/
|
||||
public function testIsFormPage($uri, $expected)
|
||||
{
|
||||
$this->setSuperGlobals([
|
||||
'_SERVER' => [
|
||||
'REQUEST_URI' => $uri
|
||||
]
|
||||
]);
|
||||
$this->assertEquals(!$expected, $this->util->is_form_page());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user