This is the list of changes for the PHPUnit 3.4 release series.
- Invalid data provider specifications are now handled gracefully.
- Fixed TRAC-993: Incorrect test on
$reflector->getFileName(). - Fixed TRAC-994: Cannot use multibyte characters in the provider method name.
- Made
PHPUnit_Framework_Assert::readAttribute()compatible with PHP 5.1.6. - Made
PHPUnit_Extensions_Database_Operation_RowBasedcompatible with PHP 5.1.6.
- Removed usage of
SplFileInfo::getRealPath()which is not available in PHP 5.1.6.
- Made dependency on YAML component optional.
- Fixed TRAC-979:
@codeCoverageIgnoreStartis being ignored. - Fixed TRAC-986: Memory leaks with mock objects.
- Reduced memory footprint of code coverage report generation.
assertContains()andassertNotContains()no longer use===for non-objects.- Implemented TRAC-968: Support
scalarinassertType(). - Fixed TRAC-779:
PHPUnit_Util_Getopt::parseLongOption()causes problems with custom error handlers. - Fixed TRAC-892: Oracle's
TRUNCATErequires additionalTABLEstatement. - Fixed TRAC-942: Process Isolation should define constants before including files.
- Fixed TRAC-943:
xdebug.show_exception_trace=Onbreaks PHPUnit. - Fixed TRAC-944: Closures might trick the metrics analyzer.
- Fixed TRAC-945: File not found error (and other weird stuff) comes up if shell sends
\ninargv. - Fixed TRAC-949: Invalid XML generated on binary diffs.
- Fixed TRAC-969: Destructors cannot be mocked.
- Fixed TRAC-977:
getMockForAbstractClass()mocks all methods on an abstract class without abstract methods. - The YAML component from the Symfony Components is no longer bundled but required as a dependency.
- The TextUI test runner now prints the peak of memory allocated by PHP (when
memory_get_peak_usage()is available). - Fixed TRAC-954:
PHPUnit_Util_ErrorHandler::handleError()pushes error to stack even if not wanted to reported. - Fixed a bug where files were ignored if the directory path contains
/../.
- Implemented TRAC-941: Add fallback for
array_fill_keys(). - Fixed TRAC-920:
PHPUnit_Extensions_Database_DB_MetaData_Ocithrows an undefined variable. - Fixed TRAC-923:
SeleniumTestCasesometimes leaves browser windows open. - Fixed TRAC-924: Selenium driver misses
useXpathLibrary. - Fixed TRAC-932: Process isolation incompatible with Zend Framework.
- Fixed TRAC-933: Objects in global state need
__set_state(). - Fixed TRAC-938: Isolated test running sets include_path too late.
- Fixed
tearDownAfterClass()getting called more than once. - Updated bundled YUI to version 2.8.0r4.
- Fixed TRAC-889:
--skeleton-classdoes not work with@dependsannotation. - Fixed TRAC-902:
PHPUnit_Util_File::getClassesInFile()does not handle nested namespaces correctly. - Fixed TRAC-905: Files with no methods or classes show incorrect code coverage with
--coverage-clover. - Fixed TRAC-909: Stubbing a web service with
getMockFromWsdl()throws a fatal error. - Fixed TRAC-918: Truncate operation throws an error.
- The backup and restore operations for static attributes has been disabled by default.
- Fixed TRAC-874: Typo in a
PHPUnit_Framework_TestCaseexception. - Fixed TRAC-875:
@runInSeparateProcessand@runTestsInSeparateProcessesdo not work with data providers. - Fixed TRAC-876:
@preserveGlobalStatedoes not work with data providers. - Fixed TRAC-877: Fatal error in
PHPUnit_Util_TestDox_ResultPrinter. - Fixed TRAC-879: Execution of PHPUnit throws
ReflectionException. - Fixed TRAC-884:
PHPUnit_Util_Filefails on classes containing strings with curly syntax. - Fixed TRAC-887:
PHPUnit_Util_Fileparses classes with PHP 4 style constructors incorrectly. - Fixed TRAC-890: PHPUnit skips every test with
@dependson Windows. - Fixed TRAC-893:
--groupand--exclude-groupseem to be not working. - Fixed TRAC-895:
@coversnot working, says class does not exist.
- Improvements and Fixes for
PHPUnit_Framework_TestCase- Added the
@depends [class::]methodannotation to express that a test depends on another test. If[class::]method()has not passed before the annotated test, the annotated test will be skipped. - Implemented TRAC-144: Added the
@runTestsInSeparateProcessesand@runInSeparateProcessannotations to selectively run tests in separate PHP processes. - Implemented TRAC-814: Added the
setUpBeforeClass()andtearDownAfterClass()template methods. - Added the
@errorHandlerannotation to control PHPUnit's error handler. - Added the
@outputBufferingannotation to control PHP's output buffering. - Improvements and Fixes for the Mock Objects System
- Implemented TRAC-638: Support mocking SOAP webservices based on WSDL specification.
- Implemented TRAC-694: Added
getMockForAbstractClass()that returns a mock object for the specified abstract class with all abstract methods of the class mocked and concrete methods not mocked. - Implemented TRAC-756: Handle exceptions in
setUp()andtearDown(). - Fixed TRAC-545: Cannot create mock object when not calling a contructor and a class is implementing an interface.
- Fixed TRAC-630: Mock generator fails to generate mock for a class with
__clone()method marked asfinal. - Fixed TRAC-755: Case sensitivity issue with invocation mocker and return values.
- Fixed TRAC-813: Mock Objects and
with()do not work together. - Fixed TRAC-822: Mocking namespaced class results in autoloading the wrong class.
- Added a blacklist for global variables that should be excluded from the backup/restore operation.
- Implemented backup/restore for static attributes in user-defined classes (requires PHP 5.3). This is enabled by default for consistency with the backup/restore for global variables.
- Added support for global configuration of backup/restore operations for global variables and static attributes in user-defined classes, both via TextUI switches and XML configuration file directives.
- Add support for
@backupGlobalsand@backupStaticAttributesannotations to control the backup/restore operations for global variables and static attributes in user-defined classes, both on the test class level and the test method level. - Fixed TRAC-686:
assertTag()only works for lowercase tags. - Fixed TRAC-817:
assert*Contains*()does not handleIteratorAggregateimplementors. - The backwards compatiblity layer for
PHPUnit_Framework_TestCase::sharedAssertions()has been removed. Please migrate toPHPUnit_Framework_TestCase::assertPostConditions().
- Added the
- Improvements and Fixes for
PHPUnit_Extensions_SeleniumTestCase- Implemented TRAC-605: Make directory for Selenium code coverage files configurable.
- Implemented TRAC-631 and #769: Support more Selenium commands.
- Please note that the following commands had to be renamed:
assertAlertPresent()has been renamed toassertAlert()assertNoAlertPresent()has been renamed toassertNotAlert()assertNoConfirmationPresent()has been renamed toassertConfirmationNotPresent()assertLocationEquals() has been renamed toassertLocation()`assertLocationNotEquals()has been renamed toassertNotLocation()assertNoPromptPresent()has been renamed toassertPromptNotPresent()assertNothingSelected()has been renamed toassertNotSomethingSelected()assertTitleEquals()has been renamed toassertTitle()assertTitleNotEquals()has been renamed toassertNotTitle()
- Please note that the following commands had to be renamed:
- Implemented TRAC-637: Enable PHPUnit to recognize
exact:,glob:, andregex:matching within the use of Seleniumassert*()andverify*()commands. - Implemented TRAC-655: Allow
phpunit_coverage.phpto be symlinked. - Implemented TRAC-658: Selenium driver times out during
fopen(). - Implemented TRAC-682: Automatically add URL to error messages in Selenium test cases.
- A screenshot can now optionally be captured when a test fails.
- Code Coverage statistics on the function, method, and class level now work correctly for Selenium tests.
- Fixed TRAC-698:
PHPUnit_Extensions_SeleniumTestCase::assertElementContainsText()checks value and not text. - Fixed TRAC-706: Selenium error message is ambiguous.
- Fixed TRAC-746:
assertTextPresent()is not 100% compatible with Selenium IDE. - Fixed TRAC-749: Selenium timeout used as HTTP connection timeout.
PHPUnit_Extensions_SeleniumTestCase::setTimeout()now expects its argument in seconds instead of milliseconds.PHPUnit_Extensions_SeleniumTestCase::setHttpTimeout()was added to control the timeout for the HTTP connection to the Selenium RC server.
- Fixed TRAC-832: Class
PHPUnit_Extensions_SeleniumTestCasecould not be found.
- Improvements and Fixes for PHPUnit_Extensions_DatabaseTestCase
- Added the
dbunitcommand-line utility to import/export/convert data sets. - Implemented TRAC-526: More flexible data set filtering.
- Implemented TRAC-548: Add schema support for flat XML format.
- Implemented TRAC-604: Add YAML DataSet support for DbUnit.
- Implemented TRAC-664: Column names are not escaped correctly.
- Added the
- Improvements, Fixes, and Changes for the TextUI Test Runner
- Implemented TRAC-144: Added the
--process-isolationswitch and theprocessIsolation="true"XML configuration file setting to run each test in a separate PHP process. - Added YAML diagnostics block to TAP output.
TestListeners can now be configured via the XML configuration file.- Implemented TRAC-9: Prepend PHP's
include_pathwith given path(s). - Implemented TRAC-598: Make
TestSuiteLoaderconfigurable via XML configuration file. - Implemented TRAC-672: Added
--stderrswitch to optionally print toSTDERRinstead ofSTDOUT. - Implemented TRAC-730: Let
PHPUnit_TextUI_TestRunneracceptPHPUnit_Util_Configurationobjects. - Implemented TRAC-766: Allow namespaced test suite loader class name to path conversion.
- Implemented TRAC-794: Ignore test file names that are prefixed with
.. - Deprecated switches
- The
--ansiswitch has been deprecated, please use--colorsinstead. - The
--coverage-xmlswitch has been deprecated, please use--coverage-cloverinstead. - The
--log-graphvizswitch has been deprecated. - The
--log-metricsand--log-pmdswitches have been deprecated. - The
--log-xmlswitch has been deprecated, please use--log-junitinstead. - The
--repeatswitch has been deprecated. - The
--reportswitch has been deprecated, please use--coverage-htmlinstead. - The
--skeletonswitch has been deprecated, please use--skeleton-testinstead. - The syntax check functionality has been disabled by default.
- The test database functionality has been deprecated.
- The
- Fixed TRAC-796: PHPUnit tries to run abstract testcases.
- Fixed TRAC-824: Faulty output on console when using
--testdox.
- Implemented TRAC-144: Added the
- Improvements and Fixes for the Code Coverage reporting
- The
@coversannotation is now supported on thesetUp(),assertPreConditions(),assertPostConditions(), andtearDown()template methods ofPHPUnit_Framework_TestCase. - Code Coverage statistics on the function, method, and class level are now calculated in way that makes more sense.
- A method is marked as covered when all of its executable lines are executed by at least one test.
- A class is marked as covered when all of its methods are fully covered.
- Code Coverage statistics on the function, method, and class level now work correctly for Selenium tests.
- Implemented TRAC-705: Added method name information to Clover XML code coverage logfile.
- Fixed TRAC-582: PHPUnit reports more covered statements than statements in class.
- Fixed TRAC-615: Tests are not written to test database when using whitelist.
- The
- Added
PHPUnit_Framework_Assert::assertStringStartsWith()andPHPUnit_Framework_Assert::assertStringEndsWith()as well asPHPUnit_Framework_Assert::stringStartsWith()andPHPUnit_Framework_Assert::stringEndsWith(). - Added
PHPUnit_Extensions_TicketListener_Tracfor automatically closing and reopening Trac tickets based on test results. - Implemented an annotation,
@testdox, to specify the output for a test when using--testdox. - Implemented TRAC-597: Add prefix configuration for test files.
- Implemented TRAC-616: Test Database does not contain full filenames.
- Implemented TRAC-642: Test Database Nested Set representation is way to slow.
- Implemented TRAC-673: Allow constants in PHP section of XML configuration file.
PHPUnit_Util_Configurationis now a singleton.- The
PHPUnit_Util_Class::getClassesInFile()andPHPUnit_Util_Class::getFunctionsInFile()methods have been renamed toPHPUnit_Util_File::getClassesInFile()andPHPUnit_Util_File::getFunctionsInFile(), respectively. - The signature of
PHPUnit_Util_File::getClassesInFile(),PHPUnit_Util_File::getFunctionsInFile(), andPHPUnit_Util_Class::getPackageInformation()has changed. These methods also no longer use the Reflection API. - The
PHPUnit_Util_Class::getFunctionSignature()andPHPUnit_Util_Class::getMethodSignature()methods have been dropped. - Renamed
PHPUnit_Framework_Assert::getStaticAttribute()andPHPUnit_Framework_Assert::getObjectAttribute()toPHPUnit_Util_Class::getStaticAttribute()andPHPUnit_Util_Class::getObjectAttribute(), respectively. - Fixed TRAC-764: Argument Type Mismatch in
BaseTestRunner. - PHPUnit 3.4 should still work with PHP 5.1.4 (or later) but PHP 5.3.0 (or later) is highly recommended.