~coughphp/coughphp/2.0

« back to all changes in this revision

Viewing changes to tests/cough/TestCoughObject.class.php

  • Committer: Anthony Bush
  • Date: 2008-09-23 03:46:34 UTC
  • mfrom: (263.1.5 coughphp-trunk)
  • Revision ID: anthony@anthonybush.com-20080923034634-28oq6n1j9fhrxu6e
Accept trunk doc changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
2
 
 
3
/**
 
4
 * @todo consider switching to PHPUnit, especially if it has PHP5 strict compatibility.
 
5
 * @todo consider splitting out some of the test methods, and rename them in a
 
6
 * way that indicates requirements rather than what it is doing.  The
 
7
 * TestAutoloader.class.php file is a good example.  Once we do this, we can also
 
8
 * benefit from concepts like Agile Documentation {@link http://www.phpunit.de/manual/3.3/en/other-uses-for-tests.html}
 
9
 **/
3
10
class TestCoughObject extends UnitTestCase
4
11
{
5
12
        protected $db = null; // the database object
221
228
        
222
229
        public function testRetireObject()
223
230
        {
224
 
                // NOTE this is only valid if the retire conig option is set...
225
 
                // TODO make this config option aware, so skip this test if it is not set
226
 
                
227
231
                $newLibrary = new Library();
228
232
                $newLibrary->setName('James Joyce');
229
233
                $newLibrary->setCreationDatetime(date('Y-m-d H:i:s'));
233
237
                $sameLibrary->setIsRetired(true);
234
238
                $sameLibrary->save();
235
239
                
236
 
                // not sure if this one should pass... depends on how we are doing retired handling
 
240
                // constructByKey should always return the object, even if we add "retired"
 
241
                // handling. It's mostly meant as a way to keep items from showing up in related
 
242
                // collections, NOT to keep the entitity from being retrieved (just delete it in
 
243
                // that case).
237
244
                $this->assertIsA(Library::constructByKey($newLibrary->getLibraryId()), 'Library');
238
245
        }
239
246