[dev] Test related improvements

Michael M Slusarz slusarz at horde.org
Fri Apr 19 19:58:59 UTC 2013


1) We should add a test runner that runs all *application* tests (as  
opposed to framework tests)

2) horde_lz4 is currently our only PECL package.  AFAICT, PHPUnit does  
not support PECL style tests - we are limited to built-in PEAR tests.   
Correct?

3) If #2 is correct, we should also add a test runner that runs PECL tests.

4) Maybe a question for Gunnar:  Looks like we have some nice  
Horde_Test "factories" that create dummy objects for testing for  
things like Horde_Db and Horde_Cache.  I used this in the new Imap  
Client DB tests, for example:

https://github.com/horde/horde/blob/master/framework/Imap_Client/test/Horde/Imap/Client/Cache/DbTest.php#L30

Wondering if this is the correct intended usage.

5) Ran into the test paradigm yesterday where I wanted to test  
multiple backends with the same data/tests.  For now, I created one  
test as the "master" (e.g. Horde_Imap_Client_Test_CacheTest), and then  
overwrote only the parts needed to setup the backend in another test  
(Horde_Imap_Client_Test_DbTest).

Obviously, the better solution would be to create a "master" test that  
all active tests directly extend.  The problem with this approach is  
that the "master" test must extend PHPUnit_Framework_TestCase itself  
and, as such, it will attempt to be run as a unit test by the phpunit  
test runner.

You hackishly could work around this by having the base setUp() method  
call markTestSkipped -- and have the extended class overwrite this --  
but this is not a proper solution since it will cause tests to appear  
as being skipped which is not the case.

Any ideas on how to do this properly?  I'm sure there is a way to tell  
phpunit to "filter" the name of files not to run, but this also seems  
hackish.

michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the dev mailing list