Now that Derick has released the first release candidate of Xdebug 2 it is time for me to release a first beta version of PHPUnit 3.0.
A list of features is available as well as a list of changes. You can install PHPUnit using the PEAR Installer as shown below:
A list of features is available as well as a list of changes. You can install PHPUnit using the PEAR Installer as shown below:
pear channel-discover pear.phpunit.de pear install phpunit/PHPUnit-beta
Note that previous installations of the
PHPUnit and PHPUnit2 packages from the pear.php.net channel have to be uninstalled.The PHPUnit Pocket Guide, which is the official documentation for PHPUnit, shows how to write tests and how to run tests to get you started.
Example reports generated by the new Code Coverage Report Generator are available for the eZ components as well as the Zend Framework.
Happy testing!
Today I committed the initial work for integrating Selenium RC with PHPUnit.
Selenium RC "is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser.".
In this case it is PHPUnit that drives the execution of the web application UI tests, using PEAR's new Selenium package to communicate with the Selenium RC Server.
Continue reading "Integrating PHPUnit with Selenium"
Selenium RC "is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser.".
In this case it is PHPUnit that drives the execution of the web application UI tests, using PEAR's new Selenium package to communicate with the Selenium RC Server.
Continue reading "Integrating PHPUnit with Selenium"

This week I attended the php|works conference in Toronto, Canada.
I arrived here together with Derick on Monday evening. After one hour of bus ride from Skien to Torp, two hours of plane ride from Torp to Amsterdam, eight hours (five planned and three not planned) layover in Amsterdam, and seven hours of plane ride to Toronto, I went immediately to bed.

Tuesday started off with a selection of half-day tutorials. In the morning I attended the first half of Paul Reinheimer's PHP 5 Certification Crash Course during which I hacked a bit on PHPUnit (sorry, Paul).
After a great lunch, I attended Wez's tutorial on Extending PHP.

In the evening a group of us went out for dinner to The Pickle Barrel in the Yorkdale Mall. As you can see above, I enjoyed a decadent, but nevertheless delicious, dessert.

The main conference started on Wednesday with Rasmus Lerdorf's keynote on Getting Rich with PHP 5.
After the keynote, I gave my presentation on Testing PHP Applications with PHPUnit 3.

Thursday started with a keynote by Microsofts "Opinionated Misfit Geek" (it really says so on his Business Card) Joe Stagner. I found this keynote rather interesting because it demonstrated how PHP can leverage components from the Windows Platform. It is noteworthy that Microsoft is interested in improving PHP on the Windows Platform (in the form of getting Wez Furlong to fix the COM extension and to reimplement the .Net extension).
In the afternoon I presented The State of AOP for PHP.
This must have been the most difficult talk I ever did at a PHP conference. At EWAS I talked about the same topic in front of an audience that "knows everything about AOP" but knew nothing about PHP. This time I expected it to be the other way around and prepared my presentation accordingly. If nothing else, I think the presentation was thought provoking and from the comments I got afterwards well received. The bottom line of the talk is this: if you want to use aspect-oriented programming with PHP today, then you should use PHPAspect. If you are looking for a more dynamic approach such as GAP: Generic Aspects for PHP, you will have to wait a while.
Before the evening's social event, we went out for dinner to a Milestone's Restaurant where I enjoyed a New York Striploin steak with a great sauce made from green peppercorn and sundried tomato.

During the conference I took the exam for the new Zend PHP 5 Certification. I can now call myself a Zend Certified Engineer (ZCE).
+ Added support for Mock Objects, inspired by jMock, initially developed by Jan Borsodi and contributed by eZ systems AS.
+ Added new Code Coverage / Test report generator (invoked through the new --report option of the command-line test runner), loosely based on the layout of LCOV.
+ Added PHPUnit2_Extensions_OutputTestCase which uses PHP's output buffering to test output.
+ Added PHPUnit2_Framework_SkippedTest interface and PHPUnit2_Framework_SkippedTestError as its default implementation to mark a test as being skipped.
+ Added PHPUnit2_Framework_Assert::assertFileExists(), PHPUnit2_Framework_Assert::assertFileNotExists(), PHPUnit2_Framework_Assert::assertArrayHasKey(), PHPUnit2_Framework_Assert::assertArrayNotHasKey(), PHPUnit2_Framework_Assert::assertHasProperty(), and PHPUnit2_Framework_Assert::assertHasNotProperty().
+ Added PHPUnit2_Framework_Assert::assertThat() which evaluates arbitrary constraints, based upon the new PHPUnit2_Framework_Constraint infrastructure.
+ Added PHPUnit2_Framework_Assert::markTestIncomplete() and PHPUnit2_Framework_Assert::markTestSkipped() to mark a test as being incomplete or skipped, respectively.
+ Added PHPUnit2_Framework_Assert::getNonPublicProperty() method to read non-public properties from objects.
+ Added PHPUnit2_Framework_TestCase::iniSet() as a wrapper for the ini_set() function that automatically resets the modified php.ini setting to its original value after the test is run.
+ Added a TestListener that talks via a socket connection to Eclipse, developed by Steven Balthazor.
+ Added a TestListener that generates a map of the executed tests in GraphViz markup.
+ Added a TestListener that generates a logfile of the test execution using the Test Anything Protocol (TAP).
+ Added and implementation of RecursiveIterator, PHPUnit2_Framework_TestSuiteIterator, that can iterate PHPUnit2_Framework_TestSuite objects.
+ Added the "--repeat " command-line option to the TextUI test runner to run the test(s) repeatedly.
* PHPUnit2_Framework_Assert::assertContains() and PHPUnit2_Framework_Assert::assertNotContains() can now work on strings.
* PHPUnit2_Framework_ComparisonFailure has been refactored into PHPUnit2_Framework_ComparisonFailure, PHPUnit2_Framework_ComparisonFailure_Array, PHPUnit2_Framework_ComparisonFailure_Object, PHPUnit2_Framework_ComparisonFailure_Scalar, PHPUnit2_Framework_ComparisonFailure_String, and PHPUnit2_Framework_ComparisonFailure_Type to improve discrepancy visualization, initially developed by Jan Borsodi and contributed by eZ systems AS.
* Changed PHPUnit2_TextUI_ResultPrinter::printHeader() to sanely format the time elapsed as MM:SS.
* PHPUnit2_Runner_IncludePathTestCollector can now utilize a FilterIterator.
* PHPUnit2_Framework_TestResult no longer registers an error handler if the code under test already registered one.
* The PHPUnit2_Framework_Test interface now extends and its implementors as well as the PHPUnit2_Framework_TestResult class now implement the Standard PHP Library (SPL)'s Countable interface.
* PHPUnit2 now uses the Standard PHP Library (SPL)'s specialized exceptions InvalidArgumentException and RuntimeException instead of the generic Exception exception class.
* Implemented RFE #5546: Make filtering and/or filtering on the current file optional.
* Implemented RFE #5860: Missing parse errors after lint.
* Fixed bug #5053: Problems with global variables.
* Fixed bug #5933: PHPUnit2_Framework_TestSuite::addTestFile() and non-working directories.
* Fixed bug #6613: AllTests.php have relative include paths that don't work.
* Fixed bug #7106: phpunit --skeleton does not seem to handle PEARified names.
* Fixed bug #7107: Platform-specific skeleton line endings.
* Fixed bug #7373: Unexpected "syntax error" in safe mode.
* Fixed bug #7770: TextUI/TestRunner::doSkeleton $skeleton not always an object.
- Removed --coverage-data, --coverage-html, and --coverage-text options from the command-line test runner.
- Removed PHPUnit2_Framework_Assert::setLooselyTyped().
- Removed dependency on the Benchmark_Timer, Console_Getopt, and PEAR_Config PEAR classes.
! PHP 5.1.4 (or greater) is now required.
! The countTestCases() method of the PHPUnit2_Framework_Test interface has been renamed to count().
! The runCount() method of the PHPUnit2_Framework_TestResult class has been renamed to count().
! A new method, addSkippedTest(), has been added to the PHPUnit2_Framework_TestListener interface.
* Fixed bug #7100: Install fails with xdebug.2.0.0rc1-dev.
* Implemented RFE #6669: Unintuitive behavior in ExceptionTestCase.
* Fixed bug #6839: setExpectedException does not appear to work.
* Fixed bug #6272: Undefined index: failures in ResultPrinter.php
* Fixed bug #6282: Invalid PHP syntax validation in Fileloader.php
* Fixed bug #5824: Fatal error on running tests.
! Changed license from PHP License to BSD Style License.
* Fixed a bug in PHPUnit2_Util_TestDox_ResultPrinter::factory().
* Workaround for bugs #3402, #5720.
+ Added PHPUnit2_Framework_Assert::assertNotEquals().
+ Added PHPUnit2_Framework_TestSuite::addTestFile() and PHPUnit2_Framework_TestSuite::addTestFiles () as convenience methods that wrap PHPUnit2_Framework_TestSuite::addTest() and PHPUnit2_Framework_TestSuite::addTestSuite(). Contribution by Stefano F. Rausch .
+ Added BankAccount and Money samples.
* Made the mechanism provided by PHPUnit2_Extensions_TestSetup actually work.
* The PHPUnit2_Runner_StandardTestSuiteLoader now checks the test suite sourcefile for syntax errors before loading it. Before, a syntax error in the test suite sourcefile caused a termination of the TextUI test runner, for instance, without any error information being printed. Please note that sourcefiles included by the test suite sourcefile are not checked. This will be done at a later time utilizing the sandboxed interpreter feature of the Runkit extension.
* PHPUnit2_Framework_TestResult::run() now saves the $GLOBALS array before and restores it after each test execution for better isolation.
* Code Coverage collection has been moved from PHPUnit2_Framework_TestCase to PHPUnit2_Framework_TestResult. This allows for Code Coverage analysis of tests that are written in a class that does not inherit from PHPUnit2_Framework_TestCase.
* Code Coverage information is no longer collected by default (when the Xdebug extension is available) but only when it is requested (by using the --coverage-* parameters with the TextUI TestRunner, for instance). PHPUnit2_Framework_TestResult::collectCodeCoverageInformation(TRUE) has to be called to enable the collection of Code Coverage information.
* PHPUnit2_Framework_Assert::assertSame() and PHPUnit2_Framework_AssertNotSame() now work on non-objects and assert that two variables (do not) have the same type and value.
* PHPUnit2_Framework_Assert::assertType() and PHPUnit2_Framework_AssertNotType() now consider subclasses when used on objects.
* PHPUnit2_Util_Skeleton now generates stubs for the setUp() and tearDown() methods.
* PHPUnit2_Extensions_TestDox_NamePrettifier now removes digits from the end of test method names and PHPUnit2_Extensions_TestDox_ResultPrinter treats test methods like testBalanceCannotBecomeNegative() and testBalanceCannotBecomeNegative2() as one and prints "Balance cannot become negative" only once.
* Renamed Extensions_CodeCoverage_*, Extensions_Log_*, and Extensions_TestDox_* to Util_CodeCoverage_*, Util_Log_*, and Util_TestDox_* as the Extensions_* namespace is intended for extensions of the framework.
* Stacktraces for failed tests now show the failing assertion.
* PHPUnit2_Util_Printer no longer uses fopen/fputs/fclose to write to STDOUT.
* Implemented RFE #4456.
* Moved tests outside of installation directory.
* Fixed a bug in PHPUnit2_Framework_Assert::assertNotSame() where PHPUnit2_Framework_Assert::failNotSame() was called instead of PHPUnit2_Framework_Assert::failSame().
* Fixed a bug in the code generated by PHPUnit2_Util_Skeleton that broke the stand-alone execution of the generated tests.
* Implemented RFE #4215.
* Added missing entry for PHPUnit2_Framework_Error to PHPUnit2_Util_Filter::$filteredFiles.
+ Added PHPUnit2_Framework_Assert::assertNotType() to complement PHPUnit2_Framework_Assert::assertType().
+ Added startTestSuite() and endTestSuite() methods to the PHPUnit2_Framework_TestListener interface.
+ Added PHPUnit2_Extensions_ExceptionTestCase::getExpectedException() and PHPUnit2_Extensions_ExceptionTestCase::setExpectedException().
+ Added an optional command-line parameter to the PHPUnit Command-Line Frontend to specify the sourcefile the test that is to be run can be found in.
+ Added an optional parameter $suiteClassFile to the PHPUnit2_Runner_TestSuiteLoader::load() method to customize the mapping from the name of a class to its sourcefile.
+ Added parameter to set the TestSuiteLoader implementation to be used to the TextUI testrunner.
+ Added a Templating API to the test class skeleton generator to customize the generated source.
* PHP errors (E_ERROR and E_USER_ERROR events) are now counted as errors.
* PHPUnit2_Framework_Assert::assertContains() and PHPUnit2_Framework_Assert::assertNotContains() now accept an object that offers the Iterator interface for the $haystack parameter.
* Changed the format of the XML logfile generated by the PHPUnit2_Extensions_Log_XML implementation of the PHPUnit2_Framework_TestListener interface to match the format of Phing's PHPUnit2 (ie. Apache Ant's JUnit) task.
* PHPUnit2_Extensions_CodeCoverage_Renderer_HTML and PHPUnit2_Extensions_CodeCoverage_Renderer_Text now render summarized representations of the Code Coverage information.
* PHPUnit2_Framework_Assert::assertSame() and PHPUnit2_Framework_Assert::assertNotSame() are now stricter and only work on objects. This was always the documented behaviour.
* PHPUnit2_Framework_Assert::assertTrue() and PHPUnit2_Framework_Assert::assertFalse() are now stricter and only work on booleans. This was always the documented behaviour.
PHPUnit is a family of PEAR packages (PHPUnit2 for PHP 5, PHPUnit for PHP 4) that supports the development of object-oriented PHP applications using the concepts and methods of Agile Software Development, Extreme Programming, Test-Driven Development and Design-by-Contract Development by providing an elegant and robust framework for the creation, execution and analysis of Unit Tests.
SuprTags
archives



