Question

Inside Project\tests\acceptance\TestCept.php I have something like:

<?php
$I = new WebPerson($scenario);

$today = date("Y-m-d H:i:s");
echo $today;

$I->wantTo('Test');

$I->seeInDatabase('email',['Emailid' => '1'], ['EmailSubject' => 'Test'], ['SendDate' => $today]);

I run:

codecept run acceptance --steps

I get:

* I see in database "Email",{"Emailid":"1"},{"EmailSubject":"Test"},{"SendDate":"2014-04-01 22:28:11"}
PASSED

When I run the following query:

SELECT * FROM email WHERE emailid= '1' AND EmailSubject='Test' AND SendDate = "2014-04-01 22:28:11";

I get zero results.

What am I overlooking? Why does CodeCeption return a PASS when no records exist for this query?

Thank you

Was it helpful?

Solution

seeInDatabese() method should get only two arguments! You pass your WHERE criteria as three separate arrays, so only the first would be passed to SELECT query.

You should write:

$I->seeInDatabase('email',['Emailid' => '1', 'EmailSubject' => 'Test', 'SendDate' => $today]);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top