HummingBirdAnimeClient/tests/AnimeClient/AnimeClientTest.php

89 lines
1.6 KiB
PHP
Raw Permalink Normal View History

2015-11-16 19:30:04 -05:00
<?php
use Aviat\AnimeClient\AnimeClient;
class AnimeClientTest extends AnimeClient_TestCase {
2015-11-18 10:31:42 -05:00
public function setUp()
{
parent::setUp();
$this->anime_client = new AnimeClient();
$this->anime_client->setContainer($this->container);
}
2015-11-16 19:30:04 -05:00
/**
* Basic sanity test for _dir function
*/
public function testDir()
{
$this->assertEquals('foo' . DIRECTORY_SEPARATOR . 'bar', \_dir('foo', 'bar'));
}
public function testIsSelected()
{
// Failure to match
$this->assertEquals('', AnimeClient::is_selected('foo', 'bar'));
// Matches
$this->assertEquals('selected', AnimeClient::is_selected('foo', 'foo'));
}
public function testIsNotSelected()
{
// Failure to match
$this->assertEquals('selected', AnimeClient::is_not_selected('foo', 'bar'));
// Matches
$this->assertEquals('', AnimeClient::is_not_selected('foo', 'foo'));
}
2015-11-18 10:31:42 -05:00
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->anime_client->is_view_page());
}
/**
* @dataProvider dataIsViewPage
*/
public function testIsFormPage($uri, $expected)
{
$this->setSuperGlobals([
'_SERVER' => [
'REQUEST_URI' => $uri
]
]);
$this->assertEquals(!$expected, $this->anime_client->is_form_page());
}
2015-11-16 19:30:04 -05:00
}