a few more assertions for sidebar
This commit is contained in:
parent
dae7abcbb5
commit
09d50fab0e
|
@ -1,7 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ComicPressSidebarStandard extends ComicPressView {
|
class ComicPressSidebarStandard extends ComicPressView {
|
||||||
function ComicPressSidebarStandard() {
|
function ComicPressSidebarStandard() {}
|
||||||
|
|
||||||
|
function _get_subdir_path() {
|
||||||
|
global $comicpress_manager;
|
||||||
|
|
||||||
|
$this->subdir_path = '';
|
||||||
|
if (($subdir = $comicpress_manager->get_subcomic_directory()) !== false) {
|
||||||
|
$this->subdir_path .= '/' . $subdir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _all_comic_dates_ok() {
|
||||||
global $comicpress_manager;
|
global $comicpress_manager;
|
||||||
|
|
||||||
$this->all_comic_dates_ok = true;
|
$this->all_comic_dates_ok = true;
|
||||||
|
@ -18,16 +29,15 @@ class ComicPressSidebarStandard extends ComicPressView {
|
||||||
if ($this->all_comic_dates_ok) {
|
if ($this->all_comic_dates_ok) {
|
||||||
$this->too_many_comics_message = ", <em>" . __("multiple files on the same date!", 'comicpress-manager') . "</em>";
|
$this->too_many_comics_message = ", <em>" . __("multiple files on the same date!", 'comicpress-manager') . "</em>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->subdir_path = '';
|
|
||||||
if (($subdir = $comicpress_manager->get_subcomic_directory()) !== false) {
|
|
||||||
$this->subdir_path .= '/' . $subdir;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
global $comicpress_manager;
|
global $comicpress_manager;
|
||||||
|
|
||||||
|
$this->_get_subdir_path();
|
||||||
|
$this->_all_comic_dates_ok();
|
||||||
|
$this->_get_thumbnail_generation_info();
|
||||||
|
|
||||||
import($this->_partial_path("sidebar"));
|
import($this->_partial_path("sidebar"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,35 @@ require_once(realpath(dirname(__FILE__) . '/../classes/views/ComicPressSidebarSt
|
||||||
require_once(realpath(dirname(__FILE__) . '/../../mockpress/mockpress.php'));
|
require_once(realpath(dirname(__FILE__) . '/../../mockpress/mockpress.php'));
|
||||||
|
|
||||||
class ComicPressSidebarStandardTest extends PHPUnit_Framework_TestCase {
|
class ComicPressSidebarStandardTest extends PHPUnit_Framework_TestCase {
|
||||||
function testInitialize() {
|
function testAllComicDatesOK() {
|
||||||
global $comicpress_manager;
|
global $comicpress_manager;
|
||||||
|
|
||||||
$this->markTestIncomplete();
|
// no comics
|
||||||
|
$comicpress_manager = $this->getMock('ComicPressManager');
|
||||||
|
$comicpress_manager->comic_files = array();
|
||||||
|
|
||||||
|
$v = new ComicPressSidebarStandard();
|
||||||
|
$v->_all_comic_dates_ok();
|
||||||
|
$this->assertTrue($v->all_comic_dates_ok);
|
||||||
|
|
||||||
|
// one comic
|
||||||
|
$comicpress_manager = $this->getMock('ComicPressManager', array('breakdown_comic_filename'));
|
||||||
|
$comicpress_manager->comic_files = array("test");
|
||||||
|
$comicpress_manager->expects($this->once())->method('breakdown_comic_filename')->will($this->returnValue(array('date' => "test")));
|
||||||
|
|
||||||
|
$v = new ComicPressSidebarStandard();
|
||||||
|
$v->_all_comic_dates_ok();
|
||||||
|
$this->assertTrue($v->all_comic_dates_ok);
|
||||||
|
|
||||||
|
// two comics
|
||||||
|
|
||||||
|
$comicpress_manager = $this->getMock('ComicPressManager', array('breakdown_comic_filename'));
|
||||||
|
$comicpress_manager->comic_files = array("test", "test2");
|
||||||
|
$comicpress_manager->expects($this->exactly(2))->method('breakdown_comic_filename')->will($this->returnValue(array('date' => "test")));
|
||||||
|
|
||||||
|
$v = new ComicPressSidebarStandard();
|
||||||
|
$v->_all_comic_dates_ok();
|
||||||
|
$this->assertFalse($v->all_comic_dates_ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
function providerTestThumbnailGenerationInfo() {
|
function providerTestThumbnailGenerationInfo() {
|
||||||
|
@ -60,11 +85,11 @@ class ComicPressSidebarStandardTest extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
$comicpress_manager = $this->getMock('ComicPressManager', array('breakdown_comic_filename', 'get_subcomic_directory', 'get_cpm_option'));
|
$comicpress_manager = $this->getMock('ComicPressManager', array('breakdown_comic_filename', 'get_subcomic_directory', 'get_cpm_option'));
|
||||||
|
|
||||||
$comicpress_manager->expects($this->at(2))
|
$comicpress_manager->expects($this->at(1))
|
||||||
->method('get_cpm_option')
|
->method('get_cpm_option')
|
||||||
->with('cpm-archive-generate-thumbnails')
|
->with('cpm-archive-generate-thumbnails')
|
||||||
->will($this->returnValue($info['option-archive']));
|
->will($this->returnValue($info['option-archive']));
|
||||||
$comicpress_manager->expects($this->at(3))
|
$comicpress_manager->expects($this->at(2))
|
||||||
->method('get_cpm_option')
|
->method('get_cpm_option')
|
||||||
->with('cpm-rss-generate-thumbnails')
|
->with('cpm-rss-generate-thumbnails')
|
||||||
->will($this->returnValue($info['option-archive']));
|
->will($this->returnValue($info['option-archive']));
|
||||||
|
|
Loading…
Reference in New Issue