HummingBirdAnimeClient/tests/base/FunctionsTest.php
Scrutinizer Auto-Fixer 3b0a19af2f Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
2015-06-29 14:26:50 +00:00

84 lines
1.5 KiB
PHP

<?php
use \AnimeClient\Config;
class FunctionsTest extends AnimeClient_TestCase {
public function setUp()
{
parent::setUp();
global $config;
$config = new Config([
'config' => [
'asset_path' => '//localhost/assets/'
],
'base_config' => [
]
]);
}
/**
* 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('', is_selected('foo', 'bar'));
// Matches
$this->assertEquals('selected', is_selected('foo', 'foo'));
}
public function testIsNotSelected()
{
// Failure to match
$this->assertEquals('selected', is_not_selected('foo', 'bar'));
// Matches
$this->assertEquals('', is_not_selected('foo', 'foo'));
}
public function assetUrlProvider()
{
return [
'single argument' => [
'args' => [
'images'
],
'expected' => '//localhost/assets/images',
],
'multiple arguments' => [
'args' => [
'images', 'anime', 'foo.png'
],
'expected' => '//localhost/assets/images/anime/foo.png'
]
];
}
/**
* @dataProvider assetUrlProvider
*/
public function testAssetUrl($args, $expected)
{
$result = call_user_func_array('asset_url', $args);
$this->assertEquals($expected, $result);
}
public function testIsLoggedIn()
{
$this->assertFalse(is_logged_in());
$_SESSION['hummingbird_anime_token'] = 'foobarbadsessionid';
$this->assertTrue(is_logged_in());
}
}