Issue Type: Improvement Created: 2006-06-19T23:15:33.000+0000 Last Updated: 2007-07-05T14:43:08.000+0000 Status: Resolved Fix version(s): - 0.2.0 (29/Oct/06)
Reporter: Zend Framework (zend_framework) Assignee: Bill Karwin (bkarwin) Tags: - Zend_Db
Related issues: Attachments: - db_patch3.patch
We need unit tests for the entire Zend_Db sub tree. The attached patch provides a first cut at testing the Zend_Db_Adapter_Pdo_* sub tree.
I've concentrated more on the structure for the tests and have covered some of the simple cases. (It also picks up the error described in #32).
I would appreciate comments especially on the layout of the test files.
Posted by Zend Framework (zend_framework) on 2006-06-19T23:15:45.000+0000
05/07/06 15:05:02: Modified by email@example.com
* attachment db_tests.patch added.
unit tests for Zend_Db_Adapter_Pdo_* v1 05/07/06 15:05:45: Modified by firstname.lastname@example.org
Note that the attached patch was created from within the tests subdirectory. 05/07/06 15:42:26: Modified by email@example.com
Notes from email sent to fw-general list:
The main test files are tests/Zend/Db/Adapter/Pdo/MssqlTest.php and MysqlTest.php. The classes are Zend_Db_Adapter_Pdo_MssqlTest and Zend_Db_Adapter_Pdo_MysqlTest respectively.
Both these classes inherit from Zend_Db_Adapter_Pdo_Common which is an abstract (empty) class that inherits from Zend_Db_Adapter_Common.
Zend_Db_Adapter_Common is an abstract class that inherits from PHPUnit2_Framework_TestCase. It contains common set up code to create and drop a test table (actual SQL required delegated down to the concrete classes). It also contains tests for functionality that should work regardless of the concrete Adapter used, such as testing insert. 05/30/06 15:46:46: Modified by gavin
When the patch is integrated into the next release, also make sure we have coverage to detect problems like those in #102.
Posted by Mark Evans (sparky) on 2006-06-20T06:21:17.000+0000
Just a thought... can we not use mock objects here also?
Posted by Mark Evans (sparky) on 2006-06-30T06:18:46.000+0000
Added the patch from Rob from the old Trac system
Posted by Gavin (gavin) on 2006-07-05T15:59:03.000+0000
Help needed! Volunteers wanted!
We need to update the patch to reflect changes, and expand coverage. Also, test covering resolved issues need to be added.
Posted by Rob Allen (rob) on 2006-07-06T01:25:35.000+0000
Correct version of patch from the old Trac system.
Posted by Rob Allen (rob) on 2006-07-06T15:59:32.000+0000
The patch didn't seem to apply cleanly for me. I have fixed my trunk so that my patch works again. Will post a patch tomorrow as it's late here!
Posted by Gavin (gavin) on 2006-07-06T16:27:52.000+0000
Woot! Thanks much Rob =)
Posted by Rob Allen (rob) on 2006-07-07T04:07:25.000+0000
db_tests2.patch is a diff against revision 845.
I created this patch file using svn diff > db_tests2.patch from the trunk/tests directory, but I can't get it to apply to a clean tree!
This is the result:
ralle@robnb /c/wwwroot/php_include/zf_trunk_tmp/tests $ patch --dry-run < db_tests2.patch
(Stripping trailing CRs from patch.) patching file TestConfiguration.php.dist (Stripping trailing CRs from patch.) patching file AllTests.php Hunk #1 FAILED at 20. Hunk #2 FAILED at 33. Hunk #3 FAILED at 46. 3 out of 3 hunks FAILED -- saving rejects to file AllTests.php.rej (Stripping trailing CRs from patch.) patching file MssqlTest.php (Stripping trailing CRs from patch.) patching file MysqlTest.php (Stripping trailing CRs from patch.) patching file Common.php (Stripping trailing CRs from patch.) patching file Common.php (Stripping trailing CRs from patch.) patching file AllTests.php
It seems like it tries to patch tests/AllTests.php rather than tests/Zend/AllTests.php and I've no idea why.
Any ideas how to get patch.exe to apply this diff or is there another way to do it?
Posted by Rob Allen (rob) on 2006-07-08T03:11:16.000+0000
Another attempt at a patch that can be applied... (Thanks Gavin!). This patch is against revision 855.
To apply, copy db_patch3.patch to trunk/ and then from the trunk/ directory, type:
$ patch -p0 < db_patch3.patch
Posted by Mark Evans (sparky) on 2006-07-09T08:15:00.000+0000
I have just created the unit tests for Pdo_Sqlite, I dont think I can easily create a patch for this since the starting unit tests are not in the repository.
A quick comment on the tests
Is spaced using tabs not spaces.
Can we get this patch checked into trunk so we can start creating patches for futher unit tests?
Posted by Rob Allen (rob) on 2006-07-09T16:12:23.000+0000
Fixed the tab issue that Mark Evans noticed.
Posted by Gavin (gavin) on 2006-07-12T18:26:50.000+0000
Thanks guys! Committed (see the FishEye link for details). Ok, lets get your patch next Mark.
Posted by Mark Evans (sparky) on 2006-07-13T09:36:38.000+0000
Here is the basic tests for sqlite... I have just copied the tests from mysql and modified them to work with sqlite quoting etc.
Posted by Gavin (gavin) on 2006-07-13T11:06:53.000+0000
Committed. Now we need developers to test the tests ;) .. and increase code coverage further.
Posted by Gavin (gavin) on 2006-08-18T19:21:31.000+0000
Would anyone like to work on tests for the other Zend_Db classes (e.g. table, row)?
Posted by Bill Karwin (bkarwin) on 2006-11-04T07:11:01.000+0000
This was committed months ago, but the issue never resolved.
Have you found an issue?
See the Overview section for more details.