Ensure the date_update is the same as the date_created>
(annotation) <#7. Edit a row to create a change>
(annotation) <#8. Check that the date_updated is more recent than the date_created>
Within testInsert() there is a reasonable amount of set up code. (#5) and (#6 ) are the actual tests that we
want to conduct, but to do them, we need to have inserted a new record into the database. As you can see,
Zend_Db_Table??™s fetchNew() function returns an empty object, of type User that represents a row in the
database. We can then set the fields that we need and then insert it into the database using the save() method.
The row??™s save() method uses that table gateway??™s insert() or update() as appropriate which then uses our
overridden functions to ensure that the date_created and date_updated fields are correctly filled in.
The testUpdate() function does the same basic test, but here we just edit one of the rows in the database
that was created by the setUp() functions. It is important to get the row from the database again though to
Licensed to Menshu You
Please post comments or corrections to the Author Online forum at
http://www.manning-sandbox.com/forum.jspa?forumID=329
ensure that the date_created field has been changed in the database itself.
Pages:
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175