make backend generate from id work staticly

This commit is contained in:
John Bintz 2009-11-13 14:49:23 -05:00
parent 722c495f0c
commit eb5d2c945f
2 changed files with 3 additions and 3 deletions

View File

@ -77,8 +77,8 @@ class ComicPressBackendAttachment extends ComicPressBackend {
}
function generate_from_id($id) {
if (strpos($id, $this->root_id . '-') === 0) {
$id = str_replace($this->root_id . '-', '', $id);
if (strpos($id, 'attachment-') === 0) {
$id = str_replace('attachment-', '', $id);
if (is_numeric($id)) {
$post = get_post($id);
if (!empty($post)) {

View File

@ -98,7 +98,7 @@ class ComicPressBackendAttachmentTest extends PHPUnit_Framework_TestCase {
$return = false;
}
$this->assertEquals($return, $this->ba->generate_from_id($id));
$this->assertEquals($return, call_user_func(array('ComicPressBackendAttachment', 'generate_from_id'), $id));
}
function testGetInfo() {