mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
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:
parent
7e889d8495
commit
c6c7474502
2 changed files with 4 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue