Fix test of the size of lines in MagicDb (included test for it).

Signed-off-by: Mark Story <mark@mark-story.com>
This commit is contained in:
Juan Basso 2009-11-19 22:57:53 -02:00 committed by mark_story
parent 7e889d8495
commit c6c7474502
2 changed files with 4 additions and 1 deletions

View file

@ -95,7 +95,7 @@ class MagicDb extends Object {
$lines = explode("\r\n", $data);
$db = array();
$validHeader = count($lines > 3)
$validHeader = count($lines) > 3
&& preg_match('/^# Date:([0-9]{4}-[0-9]{2}-[0-9]{2})$/', $lines[1], $date)
&& preg_match('/^# Source:(.+)$/', $lines[2], $source)
&& strlen($lines[3]) == 0;

View file

@ -116,6 +116,9 @@ class MagicDbTest extends UnitTestCase {
$r = $this->Db->toArray(array('yeah'));
$this->assertTrue($r === array('yeah'));
$r = $this->Db->toArray("# FILE_ID DB\r\n# Date:2009-10-10\r\n# Source:xxx.php");
$this->assertTrue($r === array());
$r = $this->Db->toArray('foo');
$this->assertTrue($r === array());