Zend/PHP Conference 2006

Sebastian Bergmann » 26 August 2006 » in Presentations » 0 Comments



I will present a session titled "Testing PHP Applications with PHPUnit 3" at this year's Zend/PHP Conference. The conference will be held in San Jose, CA, the heart of Silicon Valley, from October 30 to November 2, 2006.

I am planning this presentation to be different from the ones I did in the past on the topic of PHPUnit. I want to use "real world" examples from the test suites of both the eZ components and the Zend Framework.
Defined tags for this entry: , ,

Visualizing Text Differences in PHPUnit 3

Sebastian Bergmann » 23 August 2006 » in PHPUnit » 4 Comments

A long-standing feature request for PHPUnit has been the generation of a real diff between strings that span multiple lines.

Ideally this would be done by implementing the diff algorithm in PHP. But since Derick needed a working solution quickly, the two of us came up with a "hack": we just use GNU diff and invoke the diff command via shell_exec(). Let us look at an example:
<?php
class TextComparisonTest extends PHPUnit_Framework_TestCase {
    public function testTextComparison() {
        $expected = "<html>
  <head>
    <title>Foo</title>
  </head>
  <body>
    Foo
  </body>
</html>
";
 
        $actual = "<html>
  <head>
    <title>Foo</title>
  </head>
  <body>
    Bar
  </body>
</html>
";
 
        $this->assertEquals($expected, $actual);
    }
}
?>
The above test will give the following result:
PHPUnit 3.0.0 by Sebastian Bergmann.

F

Time: 00:00
There was 1 failure:
1) testTextComparison(TextComparisonTest)
failed asserting that <text> is equal to <text>
--- Expected
+++ Actual
@@ -3,6 +3,6 @@
     <title>Foo</title>
   </head>
   <body>
-    Foo
+    Bar
   </body>
 </html>

/home/sb/TextComparisonTest.php:24

FAILURES!
Tests: 1, Failures: 1.
I would appreciate it if someone would provide with me a PHP implementation of the diff algorithm that I can use for this. I know that there is a package called Text_Diff in PEAR, but that is more than I need.
Defined tags for this entry:

Introduction to PHPUnit on A/R/T

Sebastian Bergmann » 22 August 2006 » in Articles » 0 Comments

A/R/T, the php|architect Article Repository, has published an article of mine titled Introduction to PHPUnit today.

This article is the first in a series of PHPUnit articles for A/R/T. These articles will provide more tutorial-like material in addition to the PHPUnit Pocket Guide, which is the official manual for PHPUnit and is more of a reference in nature.
Defined tags for this entry:

PHPUnit Article on IBM DeveloperWorks

Sebastian Bergmann » 17 August 2006 » in Articles » 0 Comments

IBM DeveloperWorks has an article titled "Check your PHP code at every level with unit tests" that suggests unit tests for PHP code at the module, database, and user-interface levels and proposes PHPUnit as the tool for this job.

It is nice to see that IBM not only uses my software, but also advocates it.
Defined tags for this entry: ,

Japanese Documentation for PHPUnit

Sebastian Bergmann » 07 August 2006 » in PHPUnit » 0 Comments

Masahiro Takagi has contributed a translation of the PHPUnit Pocket Guide, which is the official documentation for PHPUnit.

Thank you, Masahiro!
Defined tags for this entry: , ,