make the default id be the timestamp of the comic

This commit is contained in:
John Bintz 2009-03-16 18:55:05 -04:00
parent c8e0c0220d
commit 8d526abe32
2 changed files with 4 additions and 1 deletions

View File

@ -25,6 +25,8 @@ class Comic {
$this->{$key} = $value; $this->{$key} = $value;
} }
} }
if (!isset($this->id) && isset($this->date)) { $this->id = $this->date; }
} }
/** /**

View File

@ -19,7 +19,8 @@ class TestComic extends PHPUnit_Framework_TestCase {
array("2006-01-01.txt"), array("2006-01-01.txt"),
array(new Comic(array('date' => '2006-01-01', array(new Comic(array('date' => '2006-01-01',
'title' => '2006-01-01', 'title' => '2006-01-01',
'copy' => ""))) 'copy' => "",
'id' => strtotime('2006-01-01'))))
) )
); );
} }