manning-sandbox.com/forum.jspa?forumID=329
TestConfiguration.php has two functions initialiseTests() and setupDatabase(). The initialiseTests() function sets up
environment for the tests and registers the Zend_Db connection. It loads the config.ini file, section called ???test??™, so
that we can specify a different database (places_test) to ensure that we don??™t accidentally affect our main database.
The source code supplied with the book contains the test suite files, and as they are basically cloned from the
instructions on the PHPUnit website, I will not go through them here.
3.4.3 The home page controller
The home page controller??™s action is the default action of the default controller and so the url /index/index will
also display the home page. This maps to the indexAction() function within the class IndexController. In this
function, all we need to do is collect the data from the Places model and assign to the view.
The Zend_Db_Table provides the fetchAll() function to retrieve multiple rows from the database, so we
could just directly call it from the controller. I am, however, going to encapsulate the requirements for the
home page??™s list within the Places class. This is so that we keep the database code where it belongs: in the
model.
Pages:
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111