简体   繁体   中英

CodeCeption seeInDatabase showing pass when the query does not return any results

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

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]);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM