From 4607d146a4030941fba43abcd60efa56a60681f2 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Mon, 29 Aug 2016 17:09:56 -0400 Subject: [PATCH] Move tests to tests/ directory --- build/phpunit.xml | 2 +- phpunit.xml | 2 +- tests/{AnimeClient => }/AnimeClientTest.php | 0 .../Auth/HummingbirdAuthTest.php | 0 .../Command/BaseCommandTest.php | 0 tests/{AnimeClient => }/ControllerTest.php | 0 tests/{AnimeClient => }/DispatcherTest.php | 0 .../Helper/MenuHelperTest.php | 0 tests/{AnimeClient => }/MenuGeneratorTest.php | 0 .../Model/AnimeCollectionModelTest.php | 0 .../Model/AnimeModelTest.php | 5 +- .../Model/BaseApiModelTest.php | 0 .../Model/MangaModelTest.php | 2 +- tests/{AnimeClient => }/RequirementsTest.php | 0 tests/{AnimeClient => }/RoutingBaseTest.php | 0 .../Transformer/AnimeListTransformerTest.php | 4 +- .../Transformer/MangaListTransformerTest.php | 4 +- .../Transformer/MangaListsZipperTest.php | 4 +- tests/{AnimeClient => }/UrlGeneratorTest.php | 0 tests/{AnimeClient => }/UtilTest.php | 158 +++++++++--------- 20 files changed, 92 insertions(+), 89 deletions(-) rename tests/{AnimeClient => }/AnimeClientTest.php (100%) rename tests/{AnimeClient => }/Auth/HummingbirdAuthTest.php (100%) rename tests/{AnimeClient => }/Command/BaseCommandTest.php (100%) rename tests/{AnimeClient => }/ControllerTest.php (100%) rename tests/{AnimeClient => }/DispatcherTest.php (100%) rename tests/{AnimeClient => }/Helper/MenuHelperTest.php (100%) rename tests/{AnimeClient => }/MenuGeneratorTest.php (100%) rename tests/{AnimeClient => }/Model/AnimeCollectionModelTest.php (100%) rename tests/{AnimeClient => }/Model/AnimeModelTest.php (90%) rename tests/{AnimeClient => }/Model/BaseApiModelTest.php (100%) rename tests/{AnimeClient => }/Model/MangaModelTest.php (97%) rename tests/{AnimeClient => }/RequirementsTest.php (100%) rename tests/{AnimeClient => }/RoutingBaseTest.php (100%) rename tests/{AnimeClient/Hummingbird => }/Transformer/AnimeListTransformerTest.php (86%) rename tests/{AnimeClient/Hummingbird => }/Transformer/MangaListTransformerTest.php (93%) rename tests/{AnimeClient/Hummingbird => }/Transformer/MangaListsZipperTest.php (77%) rename tests/{AnimeClient => }/UrlGeneratorTest.php (100%) rename tests/{AnimeClient => }/UtilTest.php (91%) diff --git a/build/phpunit.xml b/build/phpunit.xml index eb673fed..c4e9b784 100644 --- a/build/phpunit.xml +++ b/build/phpunit.xml @@ -13,7 +13,7 @@ - ../tests/AnimeClient + ../tests diff --git a/phpunit.xml b/phpunit.xml index b71b4a2e..73a77ae7 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -12,7 +12,7 @@ - tests/AnimeClient + tests diff --git a/tests/AnimeClient/AnimeClientTest.php b/tests/AnimeClientTest.php similarity index 100% rename from tests/AnimeClient/AnimeClientTest.php rename to tests/AnimeClientTest.php diff --git a/tests/AnimeClient/Auth/HummingbirdAuthTest.php b/tests/Auth/HummingbirdAuthTest.php similarity index 100% rename from tests/AnimeClient/Auth/HummingbirdAuthTest.php rename to tests/Auth/HummingbirdAuthTest.php diff --git a/tests/AnimeClient/Command/BaseCommandTest.php b/tests/Command/BaseCommandTest.php similarity index 100% rename from tests/AnimeClient/Command/BaseCommandTest.php rename to tests/Command/BaseCommandTest.php diff --git a/tests/AnimeClient/ControllerTest.php b/tests/ControllerTest.php similarity index 100% rename from tests/AnimeClient/ControllerTest.php rename to tests/ControllerTest.php diff --git a/tests/AnimeClient/DispatcherTest.php b/tests/DispatcherTest.php similarity index 100% rename from tests/AnimeClient/DispatcherTest.php rename to tests/DispatcherTest.php diff --git a/tests/AnimeClient/Helper/MenuHelperTest.php b/tests/Helper/MenuHelperTest.php similarity index 100% rename from tests/AnimeClient/Helper/MenuHelperTest.php rename to tests/Helper/MenuHelperTest.php diff --git a/tests/AnimeClient/MenuGeneratorTest.php b/tests/MenuGeneratorTest.php similarity index 100% rename from tests/AnimeClient/MenuGeneratorTest.php rename to tests/MenuGeneratorTest.php diff --git a/tests/AnimeClient/Model/AnimeCollectionModelTest.php b/tests/Model/AnimeCollectionModelTest.php similarity index 100% rename from tests/AnimeClient/Model/AnimeCollectionModelTest.php rename to tests/Model/AnimeCollectionModelTest.php diff --git a/tests/AnimeClient/Model/AnimeModelTest.php b/tests/Model/AnimeModelTest.php similarity index 90% rename from tests/AnimeClient/Model/AnimeModelTest.php rename to tests/Model/AnimeModelTest.php index 796a9f8b..10821e43 100644 --- a/tests/AnimeClient/Model/AnimeModelTest.php +++ b/tests/Model/AnimeModelTest.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(''); } } \ No newline at end of file diff --git a/tests/AnimeClient/Model/BaseApiModelTest.php b/tests/Model/BaseApiModelTest.php similarity index 100% rename from tests/AnimeClient/Model/BaseApiModelTest.php rename to tests/Model/BaseApiModelTest.php diff --git a/tests/AnimeClient/Model/MangaModelTest.php b/tests/Model/MangaModelTest.php similarity index 97% rename from tests/AnimeClient/Model/MangaModelTest.php rename to tests/Model/MangaModelTest.php index 9eca4ca0..8835df9a 100644 --- a/tests/AnimeClient/Model/MangaModelTest.php +++ b/tests/Model/MangaModelTest.php @@ -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() diff --git a/tests/AnimeClient/RequirementsTest.php b/tests/RequirementsTest.php similarity index 100% rename from tests/AnimeClient/RequirementsTest.php rename to tests/RequirementsTest.php diff --git a/tests/AnimeClient/RoutingBaseTest.php b/tests/RoutingBaseTest.php similarity index 100% rename from tests/AnimeClient/RoutingBaseTest.php rename to tests/RoutingBaseTest.php diff --git a/tests/AnimeClient/Hummingbird/Transformer/AnimeListTransformerTest.php b/tests/Transformer/AnimeListTransformerTest.php similarity index 86% rename from tests/AnimeClient/Hummingbird/Transformer/AnimeListTransformerTest.php rename to tests/Transformer/AnimeListTransformerTest.php index 26e98ecc..396203fa 100644 --- a/tests/AnimeClient/Hummingbird/Transformer/AnimeListTransformerTest.php +++ b/tests/Transformer/AnimeListTransformerTest.php @@ -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); } diff --git a/tests/AnimeClient/Hummingbird/Transformer/MangaListTransformerTest.php b/tests/Transformer/MangaListTransformerTest.php similarity index 93% rename from tests/AnimeClient/Hummingbird/Transformer/MangaListTransformerTest.php rename to tests/Transformer/MangaListTransformerTest.php index 65c4d244..36f0913c 100644 --- a/tests/AnimeClient/Hummingbird/Transformer/MangaListTransformerTest.php +++ b/tests/Transformer/MangaListTransformerTest.php @@ -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(); } diff --git a/tests/AnimeClient/Hummingbird/Transformer/MangaListsZipperTest.php b/tests/Transformer/MangaListsZipperTest.php similarity index 77% rename from tests/AnimeClient/Hummingbird/Transformer/MangaListsZipperTest.php rename to tests/Transformer/MangaListsZipperTest.php index eb105e91..d5bc9aa3 100644 --- a/tests/AnimeClient/Hummingbird/Transformer/MangaListsZipperTest.php +++ b/tests/Transformer/MangaListsZipperTest.php @@ -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); diff --git a/tests/AnimeClient/UrlGeneratorTest.php b/tests/UrlGeneratorTest.php similarity index 100% rename from tests/AnimeClient/UrlGeneratorTest.php rename to tests/UrlGeneratorTest.php diff --git a/tests/AnimeClient/UtilTest.php b/tests/UtilTest.php similarity index 91% rename from tests/AnimeClient/UtilTest.php rename to tests/UtilTest.php index 67492ce5..de9e8840 100644 --- a/tests/AnimeClient/UtilTest.php +++ b/tests/UtilTest.php @@ -1,78 +1,80 @@ -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()); - } -} +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()); + } +}