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

StackOverflow https://stackoverflow.com/questions/22796374

  •  25-06-2023
  •  | 
  •  

Domanda

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

È stato utile?

Soluzione

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]);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top