Tests ordering

This test method exercises the two features of the fetchLatest() method. First, we check that the number of records returned is correct O, then we check the ordering by ensuring that the correct record is returned ©. The second test shows why we need to control our dataset and ensure that tests do not interact with each other. I have set up the test data so that the second database row, with an ID of 2, has the most recent date_created. If this changed, the test would fail.

We have created our model for the data that will be displayed on the home page, so we'll now move on to the controller function itself. THE CONTROLLER ACTION

The controller's indexAction() method needs to ensure that the view contains everything it will display to the user. Note that this is the data specific to the main content on this page, and does not include the data that is created elsewhere, such as the ads to be displayed or any of the header or footer data.

Was this article helpful?

0 0

Post a comment