mardi 17 juillet 2018

Test Driven Laravel, testing views: integers

How would you correctly test an integer value of a view?

Laravel version 5.6.

Consider the code below.

// ViewMatchTest
$response->assertSee($match->goals_away); // 0
$reponse->assertSee($match->start_time); // 13:00

// match\show.blade.php
<li>  </li>
<li>  </li>

If you would run this test, then it outputs: "OK". But even if you remove the line:

<li>  </li>

The test would still pass because of the "0" in the start_time (13:00) of that match.

Aucun commentaire:

Enregistrer un commentaire