start media handling

This commit is contained in:
John Bintz 2009-12-01 21:07:10 -05:00
parent 07c3a9e9f2
commit d9b46aa63e
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,20 @@
<?php
class ComicPressMediaHandling {
function _bundle_global_variables() {
global $comic_folder, $archive_comic_folder, $rss_comic_folder, $mini_comic_folder;
$bundle = array();
foreach (array('comic', 'archive', 'rss', 'mini') as $which) {
switch ($which) {
case 'comic':
$bundle['comic'] = $comic_folder;
break;
default:
$bundle[$which] = ${"${which}_comic_folder"};
break;
}
}
return $bundle;
}
}

View File

@ -0,0 +1,29 @@
<?php
require_once('PHPUnit/Framework.php');
require_once('MockPress/mockpress.php');
require_once('vfsStream/vfsStream.php');
require_once(dirname(__FILE__) . '/../classes/ComicPressMediaHandling.inc');
class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase {
function setUp() {
_reset_wp();
$this->cpmh = new ComicPressMediaHandling();
}
function testBundleGlobalVariables() {
global $comic_folder, $archive_comic_folder, $rss_comic_folder, $mini_comic_folder;
$comic_folder = 'comic';
$archive_comic_folder = 'archive';
$rss_comic_folder = 'rss';
$mini_comic_folder = 'mini';
$this->assertEquals(array(
'comic' => 'comic',
'archive' => 'archive',
'rss' => 'rss',
'mini' => 'mini'
), $this->cpmh->_bundle_global_variables());
}
}