Tag Archives: zf

Zend Framework & PHPUnit: getting it to work

When trying to have unit-tests work with Zend_Framework using PHPUnit, I ran into the following error message: PHP Fatal error:  Uncaught exception ‘PHPUnit_Framework_Exception’ with message ‘Neither “Library Test Suite.php” nor “Library Test Suite.php” could be opened.’ in /usr/share/php/PHPUnit/Util/Skeleton/Test.php:100 To solve this issue, you need to: encapsulate default phpunit.xml content into a <testsuites> node (so that hierarchy becomes: <phpunit …><testsuites><testsuite>…</testsuite><testsuite>…</testsuite></testsuites>…</phpnunit> change <testsuite name=”Library Test Suite”> into <testsuite name=”LibraryTestSuite”> at the root of the ‘tests’ folder, create the file LibrarTestSuite.php with following content: <?php require_once ‘PHPUnit/Framework/TestSuite.php’; class LibraryTestSuite extends PHPUnit_Framework_TestSuite { public static function suite() { $suite = new PHPUnit_Framework_TestSuite(‘LibraryTestSuite’); $suite->addTestSuite(‘LibraryTestSuite’); return […]

Zend_Translate: further separate content from code + avoid doublon in source language

There something I am not comfortable with Zend_Translate_Adapter behavior, it’s the fact that source string is used as key for translation array. To me it looks like mixing css and html within the same file, I prefer having css in dedicated files and html in dedicated files too. Here my approach is the same. Since content is translated in multiple languages (using translation tools => therefore stored in dedicated files), I don’t want to have it anymore within my php file. I find current implementation too risky. Let’s take a simple example: I have a single sentence, both in French […]