Change logger methods to be inline with interface, fix Manga Model tests
This commit is contained in:
parent
9b03f102f3
commit
6ff4ee2746
@ -67,8 +67,8 @@ class Dispatcher extends RoutingBase {
|
||||
$raw_route = $this->request->url->get(PHP_URL_PATH);
|
||||
$route_path = "/" . trim($raw_route, '/');
|
||||
|
||||
$logger->addDebug('Dispatcher - Routing data from get_route method');
|
||||
$logger->addDebug(print_r([
|
||||
$logger->debug('Dispatcher - Routing data from get_route method');
|
||||
$logger->debug(print_r([
|
||||
'route_path' => $route_path
|
||||
], TRUE));
|
||||
|
||||
@ -100,8 +100,8 @@ class Dispatcher extends RoutingBase {
|
||||
{
|
||||
$route = $this->get_route();
|
||||
|
||||
$logger->addDebug('Dispatcher - Route invoke arguments');
|
||||
$logger->addDebug(print_r($route, TRUE));
|
||||
$logger->debug('Dispatcher - Route invoke arguments');
|
||||
$logger->debug(print_r($route, TRUE));
|
||||
}
|
||||
|
||||
if($route)
|
||||
@ -241,8 +241,8 @@ class Dispatcher extends RoutingBase {
|
||||
$controller = new $controller_name($this->container);
|
||||
|
||||
// Run the appropriate controller method
|
||||
$logger->addDebug('Dispatcher - controller arguments');
|
||||
$logger->addDebug(print_r($params, TRUE));
|
||||
$logger->debug('Dispatcher - controller arguments');
|
||||
$logger->debug(print_r($params, TRUE));
|
||||
call_user_func_array([$controller, $method], $params);
|
||||
}
|
||||
|
||||
|
@ -161,8 +161,8 @@ class Anime extends API {
|
||||
|
||||
if ($response->getStatusCode() != 200)
|
||||
{
|
||||
$logger->addWarning("Non 200 response for search api call");
|
||||
$logger->addWarning($response->getBody());
|
||||
$logger->warning("Non 200 response for search api call");
|
||||
$logger->warning($response->getBody());
|
||||
|
||||
throw new RuntimeException($response->getEffectiveUrl());
|
||||
}
|
||||
|
@ -57,43 +57,35 @@ class MangaModelTest extends AnimeClient_TestCase {
|
||||
|
||||
public function testGetList()
|
||||
{
|
||||
$this->markTestSkipped();
|
||||
if (($var = getenv('CI')))
|
||||
{
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
$data = $this->model->get_all_lists();
|
||||
$this->assertEquals($data['Reading'], $this->model->get_list('Reading'));
|
||||
$data = file_get_contents($this->mockDir . '/manga.json');
|
||||
$client = $this->getMockClient(200, [
|
||||
'Content-type' => 'application/json'
|
||||
], $data);
|
||||
$this->model->__set('client', $client);
|
||||
|
||||
$expected = Json::decodeFile($this->mockDir . '/get-all-lists.json');
|
||||
$this->assertEquals($expected['Reading'], $this->model->get_list('Reading'));
|
||||
}
|
||||
|
||||
public function testGetAllLists()
|
||||
{
|
||||
$this->markTestSkipped();
|
||||
if (($var = getenv('CI')))
|
||||
{
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
$data = Json::decodeFile($this->mockDir . '/manga-mapped.json');
|
||||
$data = file_get_contents($this->mockDir . '/manga.json');
|
||||
$client = $this->getMockClient(200, [
|
||||
'Content-type' => 'application/json'
|
||||
], $data);
|
||||
$this->model->__set('client', $client);
|
||||
|
||||
foreach($data as &$val)
|
||||
{
|
||||
$this->sort_by_name($val);
|
||||
}
|
||||
|
||||
$this->assertEquals($data, $this->model->get_all_lists());
|
||||
}
|
||||
|
||||
private function sort_by_name(&$array)
|
||||
{
|
||||
$sort = array();
|
||||
|
||||
foreach ($array as $key => $item)
|
||||
{
|
||||
$sort[$key] = $item['manga']['title'];
|
||||
}
|
||||
|
||||
array_multisort($sort, SORT_ASC, $array);
|
||||
$expected = Json::decodeFile($this->mockDir . '/get-all-lists.json');
|
||||
$this->assertEquals($expected, $this->model->get_all_lists());
|
||||
}
|
||||
}
|
1
tests/test_data/manga_list/get-all-lists.json
Normal file
1
tests/test_data/manga_list/get-all-lists.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user