Dear all,
I’ve been trying to do some testing with my application and I got this error:
PHPUnit 3.7.24 by Sebastian Bergmann.
Configuration read from /Library/WebServer/Documents/photogallery/protected/tests/phpunit.xml
F.
Time: 1.19 seconds, Memory: 13.50Mb
There was 1 failure:
- PhotoTest::testInsert
Failed asserting that two arrays are equal.
— Expected
+++ Actual
@@ @@
'sort_order' => 1
-
‘id’ => ‘7’
-
‘created_dt’ => null
-
‘lastupdate_dt’ => null
)
/Library/WebServer/Documents/photogallery/protected/tests/unit/PhotoTest.php:33
FAILURES!
Tests: 2, Assertions: 3, Failures: 1.
And this is the test that generates this error:
function setup()
{
parent::setUp();
$_POST['Photo']['album_id']=1;
$_POST['Photo']['filename']="IMG_1234.jpg";
$_POST['Photo']['caption']="This is a photo caption" ;
$_POST['Photo']['alt_text']="This is some alt text";
$_POST['Photo']['tags']="Tag1,Tag2,Tag3";
$_POST['Photo']['sort_order']=1;
}
public function testInsert()
{
$photo=new Photo;
$photo->attributes = $_POST['Photo'];
if ($photo->save())
{
$this->photo_id=$photo->id;
$this->assertEquals($_POST['Photo'],$photo->attributes);
}
}
Seeing those errors, what should I do?