David Lundgren

Web Developer & Systems Administrator

Zend Framework 1.11 + PHPUnit 3.6 unit testing

At work we are up to date with PHPUnit  at 3.6, yet officially ZF1 will only support PHPUnit 3.4. Looking through the code there is some support for PHPUnit 3.5, but I actually make use of the additional assertions that PHPUnit 3.6 provides. Initially I had intended on just extending the Zend_Test PHPUnit classes but I quickly ran into the problem where the ZF classes didn’t implement methods in the interfaces when they were brought into the PHP interpreter. I then thought about copying over the Zend_Test classes and renaming them, this would have created a maintenance issue since we don’t want to maintain our own fork of the Zend_Test classes.

My final solution was simply to create my own DatabaseTestCase. This is what I came up with:
Continue reading

gallery 2.2.1 with gnome 2.16.2

This is a re-post from my MySpace blog.

UPDATE 1: While I haven’t tested it this bug appears to be fixed as of 2007-06-11.

UPDATE 2: SourceForge uses better urls now. Not sure when this was changed.

I thought I would download the new Gallery 2.2.1 and use webDav. They need better setup instructions. Basically do the following and you will get webDav working:

  1. Activate the webDav module in the Site Admin;
  2. Acitvate the URL rewriting plugin.

It should be working, if not there are other issues, these solved mine.

The other problem was Gnome 2.16.2 PUTs an empty file on the server first, and then replaces it with the new image. This caused problems with Gallery2 not creating a thumbnail. Apparently this also happens with OS X’s webDavFS as well, http://sourceforge.net/tracker/index.php?func=detail&aid=1681406&group_id=7130&atid=107130. (SourceForge should make that MUCH more user friendly, or at least search engine friendly). While I submitted it as a comment to the tracker, I’m sure someone will be like “you idiot” I don’t care about them, this should make people happy to use the native webDav that their window manager uses, in my case Gnome.

The diff below solved my problem, despite the fact I have little clue how to make a meaningful diff for others to use. Except now I have a “File” instead of a “photo”, I could care less about the semantics because I have the thumbnails.

— gallery2.orig/modules/webdav/ItemAddWebDav.inc Sun Apr 8 10:34:41 2007
+++ gallery2/modules/webdav/ItemAddWebDav.inc Sun Apr 8 10:37:04 2007
@@ -109,6 +109,9 @@


+ // double check the mimeType of the file that was uploaded
+ list ($nothing, $mimeType) = GalleryMimeTypeHelper_simple::getMimeType($tmpFile);
+ list ($ret, $mimeExtensions) = GalleryCoreApi::convertMimeToExtensions($mimeType);
if ($mimeType == ‘application/octet-stream’
|| $mimeType == ‘application/unknown’
@@ -187,6 +190,9 @@
return array($ret, null, null);
+ // double check the mimeType of the file that was uploaded
+ list ($nothing, $mimeType) = GalleryMimeTypeHelper_simple::getMimeType($filePath);


« Previous Page