Giter Club home page Giter Club logo

phpunit's Introduction

PHPUnit

Latest Stable Version CI Status Type Coverage codecov

PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks.

Installation

We distribute a PHP Archive (PHAR) that has all required (as well as some optional) dependencies of PHPUnit bundled in a single file:

$ wget https://phar.phpunit.de/phpunit-X.Y.phar

$ php phpunit-X.Y.phar --version

Please replace X.Y with the version of PHPUnit you are interested in.

Alternatively, you may use Composer to download and install PHPUnit as well as its dependencies. Please refer to the documentation for details on how to install PHPUnit.

Contribute

Please refer to CONTRIBUTING.md for information on how to contribute to PHPUnit and its related projects.

List of Contributors

Thanks to everyone who has contributed to PHPUnit! You can find a detailed list of contributors on every PHPUnit related package on GitHub. This list shows only the major components:

A very special thanks to everyone who has contributed to the documentation.

phpunit's People

Contributors

edorian avatar epdenouden avatar ghostwriter avatar giorgiosironi avatar jrfnl avatar kabel avatar keradus avatar kubawerlos avatar localheinz avatar lstrojny avatar marac19901990 avatar marcioalmada avatar mbeccati avatar mhujer avatar michelhartmann avatar mlively avatar mvorisek avatar ocramius avatar oliverklee avatar ptomulik avatar realflowcontrol avatar remicollet avatar sebastianbergmann avatar slamdunk avatar staabm avatar sun avatar theseer avatar tobys avatar vbashkirtsev avatar whatthejeff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phpunit's Issues

Autoloader wants to load 'string.php' for assertType('string' since 3.5

Hi

Since the update to phpunit 3.5 I receive the following error for the code:

$this->assertType('string', 'Hello world');

Failed opening required 'string.php'

The reason is probably my autoloader. I first hat this problem with the Zend_Framework Autoloader, and then tried my own autoloader:

function test_autoload($class) {
$file = str_replace('_', '/', $class) . '.php';
require_once $file;
}

spl_autoload_register('test_autoload');

The reason that the exception is thrown is because my autoloader is called by the function class_exists in PHPUnit_Framework_Assert. Should I use assertType only for classs and not string, int etc.? Or how should I modify my autoloader? Is this an expected behaviour?

PHPUnit_Util_XML::cssSelect() does not populate $isHtml correctly

Due to this, assertion of XML is impossible using PHPUnit_Framework_Assert::assertSelect*().

Here is a patch:

diff --git a/PHPUnit/Util/XML.php b/PHPUnit/Util/XML.php
index 3e73b76..d369fba 100644
--- a/PHPUnit/Util/XML.php
+++ b/PHPUnit/Util/XML.php
@@ -522,12 +522,13 @@ class PHPUnit_Util_XML
      * @since  Method available since Release 3.3.0
      * @author Mike Naberezny <[email protected]>
      * @author Derek DeVries <[email protected]>
+     * @author Tobias Schlitt <[email protected]>
      */
     public static function cssSelect($selector, $content, $actual, $isHtml = TRUE)
     {
         $matcher = self::convertSelectToTag($selector, $content);
         $dom     = self::load($actual, $isHtml);
-        $tags    = self::findNodes($dom, $matcher);
+        $tags    = self::findNodes($dom, $matcher, $isHtml);

         return $tags;
     }

Invalid @covers annotations should produce a test error (E) instead of aborting phpunit

If any @Covers annotation specifies an invalid class, method, function, etc. the tests stop due to an uncaught RuntimeException. While this relates to code coverage, the fix belongs in PHPUnit itself.

To turn this into a test error, replace this line in PHPUnit_Framework_TestResult::run():

$this->codeCoverage->append($data, $test, $filterGroups);

with this block:

try {
    $this->codeCoverage->append($data, $test, $filterGroups);
} catch (Exception $cce) {
    // @todo Create specific CC exception?
    $error = TRUE;
    if (!isset($e)) {
        $e = $cce;
    }
}

Add policy support for Test Dependency based Fixture Reuse

Currently, when two tests B and C depend on the same test A, the same result from A will be passed to both B and C. In the future it should also be possible to rerun A to provide the result for B and C as well as performing a clone or deep-copy operation on the result that is returned from A.

Maximum Execution Time problems in the DBUnit component

I've suddenly started running into maximum execution time errors when running my tests in bulk (i.e. on an entire directory, rather than test by test). The errors always occur somewhere in DataSet/FlatXmlDataSet.php or DataSet/AbstractTable.php, e.g. "
Fatal error: Maximum execution time of 10 seconds exceeded in /usr/local/share/pear/PEAR/PHPUnit/Extensions/Database/DataSet/FlatXmlDataSet.php on line 90".

I have tried setting max_execution_time and max_input_time to 0 in my php.ini, and have also tried setting them using the -d parameter to phpunit (e.g. phpunit -d max_input_time=0), but it does not have any affect.

When running the tests one by one, the problem does not occur.

The maximum execution time that it claims is always 10 seconds.

Version information

  • php5-cli 5.2.6.dfsg.1-1+lenny9
  • php5-xdebug 2.0.3-1
  • phpunit 3.4.14

Process isolation breaks for global objects that implement the Serializable interface

Specifying the --process-isolation flag will raise errors for global objects that implement the Serializable interface. Consider the following test:

<?php
class AClass implements Serializable {
    public function serialize() { return serialize('abc'); }
    public function unserialize($data) {}
}

$GLOBALS['A'] = new AClass;

class ATest extends PHPUnit_Framework_TestCase
{
    public function testTrue()
    {
        $this->assertTrue(true);
    }
}

Running this test with the --process-isolation flag will raise the following error:

$ phpunit --process-isolation ATest.php 
PHPUnit 3.5.0RC2 by Sebastian Bergmann.

E

Time: 0 seconds, Memory: 5.25Mb

There was 1 error:

1) ATest::testTrue
RuntimeException: PHP Warning:  Class __PHP_Incomplete_Class has no unserializer in - on line 79
PHP Stack trace:
PHP   1. {main}() -:0
PHP   2. unserialize() -:79


FAILURES!
Tests: 1, Assertions: 0, Errors: 1.

This happens because http://github.com/sebastianbergmann/phpunit/blob/master/PHPUnit/Framework/Process/TestCaseMethod.tpl.dist processes globals before it processes included files. For objects that implement the Serializable interface this will not work as the class declaration is needed before the object can be unserialized.

Circular dependency of PHPUnit, DbUnit, PHPUnit_MockObject, and PHPUnit_Selenium

PHPUnit requires DbUnit, PHPUnit_MockObject, and PHPUnit_Selenium in its package.xml. The latter three require PHPUnit in their package.xml. While this may work for PEAR based packaging I'm pretty certain that won't work out for downstream distributions. Is this an oversight? I guess downstream could also bundle the four packages together instead of splitting them but then I don't know why one would split these upstream.

Make explicit in documentation that by default test files must end with Test.php to be picked up by the testrunner

I was stumped for about an hour trying to figure out why I was getting a cryptic error message when I put two test files in a folder and tried to run phpunit against the folder. See my stackoverflow question here:

http://stackoverflow.com/questions/4047199/how-can-i-get-phpunit-to-run-tests-from-all-files-in-a-folder

I scoured the documentation but found nothing about this, and just tried it based on hunch (after observing all files were named somethingTest.php.

Perhaps there is a way to make it clear that at least by default, filenames should end with Test.php for them to get picked up by the test runner?

Categorization of Tests as Small, Medium, or Large

Implemented

  • Add new annotations @small, @medium and @large as aliases for @group small, @group medium and @group large
  • By default, a test is "small"
  • A test must not @depend a test that is larger than itself
  • In strict mode, a "small" test will fail if it takes longer than 1 second (configurable) to run
  • In strict mode, a "medium" test will fail if it takes longer than 10 seconds (configurable) to run
  • In strict mode, a "large" test will fail if it takes longer than 60 seconds (configurable) to run

Not Implemented

  • In strict mode, a "small" test must not execute any code that does not belong to the component-under-test, ie. the component-under-test needs to be completely isolated from its dependencies. If it does, the test will be marked as incomplete and it will not yield code coverage.
  • In strict mode, a "small" test must use the @covers annotation to declare the component-under-test.
  • In strict mode, a "small" test must not perform I/O operations. If it does, the test will be marked as incomplete and it will not yield code coverage.
  • In strict mode, a "medium" test may execute code other than that of the component-under-test.
  • In strict mode, a "medium" test must not perform I/O operations. If it does, the test will be marked as incomplete and it will not yield code coverage.
  • In strict mode, only a "large" test may perform I/O operations.
  • The test categorization can be used to weigh the code coverage based on the authoritativeness of the test: a "small" test yields more valuable code coverage than a large test.

Segmentation fault

I'm running 3.4.15 (from pear). I have a test that segfaults. My colleague tested this on Mac and it works there. This is the test.

$search = $this->getMockFromWsdl(
'http://www.mondialrelay.fr/webservice/Web_Services.asmx?WSDL',
'WSI2_RecherchePointRelais'
);

I made it dump core, you can find the backtrace below. Please, let me know if you need anything else.

GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /usr/bin/php...(no debugging symbols found)...done.

warning: core file may not match specified executable file.
[New Thread 10918]

warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/libcrypt.so.1...Reading symbols from /usr/lib/debug/lib/libcrypt-2.11.1.so...done.
done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libz.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libz.so.1
Reading symbols from /usr/lib/libedit.so.2...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libedit.so.2
Reading symbols from /lib/libncurses.so.5...(no debugging symbols found)...done.
Loaded symbols for /lib/libncurses.so.5
Reading symbols from /lib/libssl.so.0.9.8...(no debugging symbols found)...done.
Loaded symbols for /lib/libssl.so.0.9.8
Reading symbols from /usr/lib/libdb-4.8.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libdb-4.8.so
Reading symbols from /lib/libbz2.so.1.0...(no debugging symbols found)...done.
Loaded symbols for /lib/libbz2.so.1.0
Reading symbols from /lib/libpcre.so.3...(no debugging symbols found)...done.
Loaded symbols for /lib/libpcre.so.3
Reading symbols from /lib/librt.so.1...Reading symbols from /usr/lib/debug/lib/librt-2.11.1.so...done.
done.
Loaded symbols for /lib/librt.so.1
Reading symbols from /lib/libm.so.6...Reading symbols from /usr/lib/debug/lib/libm-2.11.1.so...done.
done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libdl.so.2...Reading symbols from /usr/lib/debug/lib/libdl-2.11.1.so...done.
done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libnsl.so.1...Reading symbols from /usr/lib/debug/lib/libnsl-2.11.1.so...done.
done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /usr/lib/libgssapi_krb5.so.2...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libgssapi_krb5.so.2
Reading symbols from /usr/lib/libkrb5.so.3...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libkrb5.so.3
Reading symbols from /usr/lib/libk5crypto.so.3...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libk5crypto.so.3
Reading symbols from /lib/libcom_err.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/libcom_err.so.2
Reading symbols from /usr/lib/libxml2.so.2...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libxml2.so.2
Reading symbols from /lib/libc.so.6...Reading symbols from /usr/lib/debug/lib/libc-2.11.1.so...done.
done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/libcrypto.so.0.9.8...(no debugging symbols found)...done.
Loaded symbols for /lib/libcrypto.so.0.9.8
Reading symbols from /lib/libresolv.so.2...Reading symbols from /usr/lib/debug/lib/libresolv-2.11.1.so...done.
done.
Loaded symbols for /lib/libresolv.so.2
Reading symbols from /lib/libbsd.so.0...(no debugging symbols found)...done.
Loaded symbols for /lib/libbsd.so.0
Reading symbols from /lib/libpthread.so.0...Reading symbols from /usr/lib/debug/lib/libpthread-2.11.1.so...done.
done.
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug/lib/ld-2.11.1.so...done.
done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /usr/lib/libkrb5support.so.0...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libkrb5support.so.0
Reading symbols from /lib/libkeyutils.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libkeyutils.so.1
Reading symbols from /usr/lib/php5/20090626/xdebug.so...done.
Loaded symbols for /usr/lib/php5/20090626/xdebug.so
Reading symbols from /usr/lib/php5/20090626/apc.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/php5/20090626/apc.so
Reading symbols from /usr/lib/php5/20090626/curl.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/php5/20090626/curl.so
Reading symbols from /usr/lib/libcurl.so.4...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libcurl.so.4
Reading symbols from /usr/lib/libidn.so.11...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libidn.so.11
Reading symbols from /usr/lib/liblber-2.4.so.2...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/liblber-2.4.so.2
Reading symbols from /usr/lib/libldap_r-2.4.so.2...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libldap_r-2.4.so.2
Reading symbols from /usr/lib/libsasl2.so.2...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libsasl2.so.2
Reading symbols from /usr/lib/libgnutls.so.26...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libgnutls.so.26
Reading symbols from /usr/lib/libtasn1.so.3...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libtasn1.so.3
Reading symbols from /lib/libgcrypt.so.11...(no debugging symbols found)...done.
Loaded symbols for /lib/libgcrypt.so.11
Reading symbols from /lib/libgpg-error.so.0...(no debugging symbols found)...done.
Loaded symbols for /lib/libgpg-error.so.0
Reading symbols from /usr/lib/php5/20090626/gd.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/php5/20090626/gd.so
Reading symbols from /usr/lib/libgd.so.2...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libgd.so.2
Reading symbols from /usr/lib/libt1.so.5...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libt1.so.5
Reading symbols from /usr/lib/libfreetype.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libfreetype.so.6
Reading symbols from /usr/lib/libX11.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libX11.so.6
Reading symbols from /usr/lib/libXpm.so.4...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libXpm.so.4
Reading symbols from /lib/libpng12.so.0...(no debugging symbols found)...done.
Loaded symbols for /lib/libpng12.so.0
Reading symbols from /usr/lib/libjpeg.so.62...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libjpeg.so.62
Reading symbols from /usr/lib/libfontconfig.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libfontconfig.so.1
Reading symbols from /usr/lib/libxcb.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libxcb.so.1
Reading symbols from /lib/libexpat.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libexpat.so.1
Reading symbols from /usr/lib/libXau.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libXau.so.6
Reading symbols from /usr/lib/libXdmcp.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libXdmcp.so.6
Reading symbols from /usr/lib/php5/20090626/memcache.so...done.
Loaded symbols for /usr/lib/php5/20090626/memcache.so
Reading symbols from /usr/lib/php5/20090626/memcached.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/php5/20090626/memcached.so
Reading symbols from /usr/lib/libmemcached.so.2...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libmemcached.so.2
Reading symbols from /usr/lib/php5/20090626/mysql.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/php5/20090626/mysql.so
Reading symbols from /usr/lib/libmysqlclient_r.so.16...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libmysqlclient_r.so.16
Reading symbols from /usr/lib/php5/20090626/mysqli.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/php5/20090626/mysqli.so
Reading symbols from /usr/lib/php5/20090626/pdo.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/php5/20090626/pdo.so
Reading symbols from /usr/lib/php5/20090626/pdo_mysql.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/php5/20090626/pdo_mysql.so
Reading symbols from /usr/lib/php5/20090626/pdo_sqlite.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/php5/20090626/pdo_sqlite.so
Reading symbols from /usr/lib/libsqlite3.so.0...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libsqlite3.so.0
Reading symbols from /usr/lib/php5/20090626/redis.so...done.
Loaded symbols for /usr/lib/php5/20090626/redis.so
Reading symbols from /usr/lib/php5/20090626/sqlite.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/php5/20090626/sqlite.so
Reading symbols from /usr/lib/libsqlite.so.0...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libsqlite.so.0
Reading symbols from /usr/lib/php5/20090626/sqlite3.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/php5/20090626/sqlite3.so
Reading symbols from /usr/lib/php5/20090626/thrift_protocol.so...done.
Loaded symbols for /usr/lib/php5/20090626/thrift_protocol.so
Reading symbols from /usr/lib/libstdc++.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libstdc++.so.6
Reading symbols from /lib/libgcc_s.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /usr/lib/php5/20090626/xsl.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/php5/20090626/xsl.so
Reading symbols from /usr/lib/libexslt.so.0...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libexslt.so.0
Reading symbols from /usr/lib/libxslt.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libxslt.so.1
Reading symbols from /lib/libnss_files.so.2...Reading symbols from /usr/lib/debug/lib/libnss_files-2.11.1.so...done.
done.
Loaded symbols for /lib/libnss_files.so.2
Reading symbols from /lib/libnss_compat.so.2...Reading symbols from /usr/lib/debug/lib/libnss_compat-2.11.1.so...done.
done.
Loaded symbols for /lib/libnss_compat.so.2
Reading symbols from /lib/libnss_nis.so.2...Reading symbols from /usr/lib/debug/lib/libnss_nis-2.11.1.so...done.
done.
Loaded symbols for /lib/libnss_nis.so.2
Core was generated by `/usr/bin/php /usr/bin/phpunit library/PC/PickupPoint/FactoryTest.php'.
Program terminated with signal 11, Segmentation fault.
#0 __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:31

31 ../sysdeps/x86_64/multiarch/../strlen.S: No such file or directory.
in ../sysdeps/x86_64/multiarch/../strlen.S
(gdb) bt
#0 __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:31
#1 0x00000000005f9e59 in php_addcslashes ()
#2 0x00007fac1991dacb in xdebug_var_export (struc=0x7fffda7cbfe8, str=0x7fffda7cbff0, level=1, debug_zval=0, options=0x373b5b0)

at /build/buildd/xdebug-2.0.5/build-php5/xdebug_var.c:283

#3 0x00007fac1991df8e in xdebug_get_zval_value (val=0x34960f8, debug_zval=0, options=0x373b5b0) at /build/buildd/xdebug-2.0.5/build-php5/xdebug_var.c:365
#4 0x00007fac1990327e in add_stack_frame (zdata=0x7fac1d507358, op_array=0x2be4228, type=2) at /build/buildd/xdebug-2.0.5/build-php5/xdebug.c:1081
#5 0x00007fac19904984 in xdebug_execute (op_array=0x2be4228) at /build/buildd/xdebug-2.0.5/build-php5/xdebug.c:1512
#6 0x00000000006d165c in ?? ()
#7 0x00000000006bd400 in execute ()
#8 0x00007fac19904b9e in xdebug_execute (op_array=0x34656a0) at /build/buildd/xdebug-2.0.5/build-php5/xdebug.c:1562
#9 0x00000000006e5c26 in ?? ()
#10 0x00000000006bd400 in execute ()
#11 0x00007fac19904b9e in xdebug_execute (op_array=0x345d368) at /build/buildd/xdebug-2.0.5/build-php5/xdebug.c:1562
#12 0x000000000068b324 in zend_call_function ()
#13 0x0000000000540c24 in ?? ()
#14 0x00007fac19904f2a in xdebug_execute_internal (current_execute_data=0x7fac1d506678, return_value_used=1) at /build/buildd/xdebug-2.0.5/build-php5/xdebug.c:1631
#15 0x00000000006e5f36 in ?? ()
#16 0x00000000006bd400 in execute ()
#17 0x00007fac19904b9e in xdebug_execute (op_array=0x3463a50) at /build/buildd/xdebug-2.0.5/build-php5/xdebug.c:1562
#18 0x00000000006e5c26 in ?? ()
#19 0x00000000006bd400 in execute ()
#20 0x00007fac19904b9e in xdebug_execute (op_array=0x34638b8) at /build/buildd/xdebug-2.0.5/build-php5/xdebug.c:1562
#21 0x00000000006e5c26 in ?? ()
#22 0x00000000006bd400 in execute ()
#23 0x00007fac19904b9e in xdebug_execute (op_array=0x2d97620) at /build/buildd/xdebug-2.0.5/build-php5/xdebug.c:1562
#24 0x00000000006e5c26 in ?? ()
#25 0x00000000006bd400 in execute ()
#26 0x00007fac19904b9e in xdebug_execute (op_array=0x34635f0) at /build/buildd/xdebug-2.0.5/build-php5/xdebug.c:1562
#27 0x00000000006e5c26 in ?? ()
#28 0x00000000006bd400 in execute ()
#29 0x00007fac19904b9e in xdebug_execute (op_array=0x2fb83e8) at /build/buildd/xdebug-2.0.5/build-php5/xdebug.c:1562
#30 0x00000000006e5c26 in ?? ()
#31 0x00000000006bd400 in execute ()
#32 0x00007fac19904b9e in xdebug_execute (op_array=0x2fac790) at /build/buildd/xdebug-2.0.5/build-php5/xdebug.c:1562
#33 0x00000000006e5c26 in ?? ()
#34 0x00000000006bd400 in execute ()
#35 0x00007fac19904b9e in xdebug_execute (op_array=0x2c363a8) at /build/buildd/xdebug-2.0.5/build-php5/xdebug.c:1562
#36 0x00000000006e5c26 in ?? ()
#37 0x00000000006bd400 in execute ()
#38 0x00007fac19904b9e in xdebug_execute (op_array=0x2c21c80) at /build/buildd/xdebug-2.0.5/build-php5/xdebug.c:1562
#39 0x00000000006e5c26 in ?? ()
#40 0x00000000006bd400 in execute ()
#41 0x00007fac19904b9e in xdebug_execute (op_array=0x2c112e0) at /build/buildd/xdebug-2.0.5/build-php5/xdebug.c:1562
#42 0x00000000006e5c26 in ?? ()
#43 0x00000000006bd400 in execute ()
#44 0x00007fac19904b9e in xdebug_execute (op_array=0x2be1438) at /build/buildd/xdebug-2.0.5/build-php5/xdebug.c:1562
#45 0x000000000069512d in zend_execute_scripts ()

---Type to continue, or q to quit---
#46 0x0000000000640d98 in php_execute_script ()
#47 0x0000000000726236 in ?? ()
#48 0x00007fac1a92cc4d in __libc_start_main (main=, argc=, ubp_av=, init=,

fini=<value optimized out>, rtld_fini=<value optimized out>, stack_end=0x7fffda7d0888) at libc-start.c:226

#49 0x000000000042c639 in _start ()

(gdb)

Add support for conditional inclusion of test files based on PHP version

The example below will only add the /path/to/*Test.php files and /path/to/MyTest.php file if the PHP version is at least 5.3.0.

<testsuite name="My Test Suite">
  <directory phpVersion="5.3.0" phpVersionOperator=">=">/path/to/*Test.php files</directory>
  <file phpVersion="5.3.0" phpVersionOperator=">=">/path/to/MyTest.php</file>
</testsuite>

The phpVersionOperator attribute is optional and defaults to >=.

The comparison will be implemented as

version_compare(PHP_VERSION, <phpVersion>, <phpVersionOperator>)

Make the "XML Configuration File" win against command line options

Some IDEs have some command line switches hardcoded to support phpunit (e.g. netbeans). The only way to configure phpunit behavior is to provide a "XML Configuration File" - one big issue is that command line switches wins against xml options.

E.g.: netbeans runs phpunit by using the command line switch "--log-junit". At the moment there is no way in netbeans to add the "--verbose" switch. In the xml configuration file there is no separate xml element to make phpunit to be verbose. The only way is to use this:
<logging> <log type="junit" target="/tmp/logfile.xml" logIncompleteSkipped="true"/> </logging>
But this xml element is igored by phpunit when "--log-junit" command line switch is given.

Solution:
a) add an independent xml element (verbose) to supplement the "--log-junit" command line switch
b) add a "force" attribute to each xml element to determ if a xml option should override a command line switch (to invert default override behavior)

To me solution a would be better, because i don´t know at what path netbeans expects the result xml. Maybe you implement both to make phpunit more flexible.

Yes indeed a change to the code of netbeans can solve this issue, too. But we all know how long to wait to have a feature request implemented in closed souce software... And i think this is not an issue specific to netbeans, there are probably other programs out there calling phpunit by hardcoded command line switches.

PHPUnit_Framework_MockObject_Generator missing?

I've just installed 3.5.0RC2 using pear, on a Snow Leopard box using macports, and went on to test symfony2 using it. It'm getting a fatal error as I do:

DB:~/Sites/symfony $ phpunit
PHPUnit 3.5.0RC2 by Sebastian Bergmann.

............................................................   60 / 1446
............................................................  120 / 1446
............................................................  180 / 1446
............................................................  240 / 1446
............................................................  300 / 1446
............................................................  360 / 1446
............................................................  420 / 1446
............................................................  480 / 1446
..............PHP Fatal error:  Class 'PHPUnit_Framework_MockObject_Generator' not found in /opt/local/PEAR/PHPUnit/Framework/TestCase.php on line 1049

Fatal error: Class 'PHPUnit_Framework_MockObject_Generator' not found in /opt/local/PEAR/PHPUnit/Framework/TestCase.php on line 1049

Checking the files in /opt/local/PEAR/PHPUnit reveals no class for declaration for the above -- even though it seems to gets used three times in the PHPUnit source code.

Database setup seems to be timing-dependent

I have a test case that uses a database TestCase extension, and it appears that the code is somehow timing-dependent. If I run queries in an ordinary test method, it sometimes sees the inserted data and sometimes an empty database. If I add a usleep(1000) to the beginning of my method, it seems to work OK. The DB is MySQL, and this seems to be limited to MyISAM tables (changing the table type to InnoDB appeared to resolve it).

I'm using PHPUnit v3.4.5, is this something that might have been fixed by a later version?

first command parameter not recognized

phpunit --log-junit build/logs/phpunit.xml --coverage-clover build/logs/clover.xml --coverage-html build/coverage --configuration tests/phpunit.xml tests/

this results in Writing code coverage data to XML file, this may take a moment.Command '--log-junit' is not valid, try ' help'

version 3.5.0

pear install doesn't seem to work correct phpunit 3.5

I'm not sure if this is the right place, but:

After upgrading to 3.5 I couldn't find the new compmonts even though PEAR said they were installed like:
phpunit/PHPUnit_Selenium is already installed and is the same as the released version 1.0.0

I had to uninstall phpunit and all components seperatly. Then the phpunit installation would work properly. I had this phenomenon on by local MAC Enviroment php 5.3.1 and on a debian server running php 5.3.3.

test success output formatting

I sure would love to have the output formatted like below. Is this a possibility in the future?
Or, could I be pointed to where that is done so that I could modify the code?

..... .....
..... .....
..... .....
..... .....
..... .....

..... .....
etcetera

Bogus bootstrap file raises cryptic error

For example:

phpunit bootstrap="not_existent_bootstrap.php">

.

gives out this error:

PHP Warning: include_once(/home/giorgio): failed to open stream: Nessun file o directory in /usr/share/php/PHPUnit/Util/Fileloader.php on line 103

Warning: include_once(/home/giorgio): failed to open stream: Nessun file o directory in /usr/share/php/PHPUnit/Util/Fileloader.php on line 103
PHP Warning: include_once(): Failed opening '' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/php/PHPUnit/Util/Fileloader.php on line 103

Warning: include_once(): Failed opening '' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/php/PHPUnit/Util/Fileloader.php on line 103

which does not even contain the offending filename "not_existent_bootstrap.php". Sorry for the mangled code but this issue tracker does not let me post XML.

Result XML inconsistent on '@dataProvider returns empty array' or 'is not existing'

If a data provider function returns an emty array the results XML contains some XML elements about the skipped test (the test method that uses this data provider).

When defining a test method and using a @dataProvider annotation, but pointing to a non existing data provider function this should be create the same XML about the skipped test.

Because of the missing XML about the skipped test (second example above) i can not notice the skipped test in my IDE (netbeans).

Trac Ticket Listener

I noticed that the Trac ticket listener is no longer present. Is that a temporary situation, or is it no longer maintained or usable?

Graham 'itrebal'

Unable to run phpunit in eclipse

Hi

I use Galileo Eclipse with PHPUnit 3.4.9. The PHPUnit Source Folder Pattern is set to the default "/%p/tests/%d"

When I try to run phpunit I get the following in the eclipse console:

/usr/bin/php -c /tmp/zend_debug/session2774194926505594077.tmp -d asp_tags=off /home/srikanth/.eclipse/org.eclipse.platform_3.5.0_155965261/plugins/org.phpsrc.eclipse.pti.tools.phpunit_0.4.0.R20100628000000/php/tools/phpunit.php --log-junit "/tmp/pti_phpunit/phpunit.xml" FluentDOMTest "/home/srikanth/code/FluentDOM/tests/FluentDOMTest.php"
PHPUnit 3.4.9 by Sebastian Bergmann.

Cannot open file "./"/home/srikanth/code/FluentDOM/tests/FluentDOMTest.php"".

Somehow "./" is added before the actual directory! Could you please help me on how to fix this?

Thanks
Srikanth

--repeat option does not work in 3.5.0

I've upgraded PHPUnit to 3.5.0 and found this:

phpunit works normal until "--repeat" option is used. With "--repeat 2" I got:

PHP Fatal error: Class 'PHPUnit_Extensions_RepeatedTest' not found in
/usr/share/pear/PHPUnit/TextUI/TestRunner.php on line 166

without it - it works.

And, btw, requiring 'PHPUnit/Extensions/TestDecorator.php' from within test didn't fix the problem.

PHPUnit_Util_Type::isType() in combination with autloader raises error

Affected version 3.5.

If assertType() assertion is used with autoloader, autoloader tries to load asserted type as php file. For example with Zend Framework autoloader enabled, calling assertType('array', array()) results in error include_once(array.php): failed to open stream: No such file or directory.

This could be fixed by setting parameter $autoload=false to functions class_exists() and interface_exists() in PHPUnit_Util_Type::isType().

$this->setExpectedException(): stacktrace is missing when no exception was not raised

I expect to have the test methods name and test methods line number in stack trace, when a expected exception was not raised on the test method where i used the setExpectedException() method. Would be great if we can have the line number of the setExpectedException() call also in the stack trace.

The missing stack trace (and missing line numbers) makes my IDE (netbeans) unable to navigate to the failing test method by clicking on the failing test in the "Test Results" windows.

Unexpected @depends behaviour

When I have a tree of depending tests:

  • testBasic
    • testBar($a) (depending on testBasic)
    • testLorem($a) (depending on testBasic)
      • testFoo($a) (depending on testLorem)
    • testIpsum($a) (depending on testBasic)

They are executed linearily and still the same object is passed as argument, so for example at testIpsum, I got the object with changes from testLorem). Which I consider as unexpected and not wanted behaviour.

I think that the order of executed tests should be tree-like, everytime with a new object:

running testBasic: testBasic
running testBar: testBasic - testBar
running testLorem: testBasic - testLorem
running testFoo: testBasic - testLorem - testFoo
running testIpsum - testBasic - testIpsum

@depends for PHPUnit_Extensions_SeleniumTestCase

I searched for a long time but could not find any solution. I tried to use the @Depends parameter with SeleniumTestCase but it did not work.
Is it because this is not implemented in SeleniumTestCase or is there some special trick to get it work?
If it's not implemented, consider this issues as a feature-request :-)

Running with --process-isolation breaks semantics of setUpBeforeClass()

With --process-isolation setUpBeforeClass() is not run before tests, but instead for each test.

<?php
require 'PHPUnit/Framework/TestCase.php';

class FooTest extends PHPUnit_Framework_TestCase
{
    static function setUpBeforeClass()
    {
        echo "setUpBeforeClass, pid=" . getmypid() . "\n";
    }

    function testA()
    {
        echo "testA, pid=" . getmypid() . "\n";
        $this->assertTrue(TRUE);
    }

    function testB()
    {
        echo "testB, pid=" . getmypid() . "\n";
        $this->assertTrue(TRUE);
    }
}

Expected output:

PHPUnit 3.5.0RC1 by Sebastian Bergmann.

setUpBeforeClass, pid=23871
testA, pid=23872
.testB, pid=23873
.

Time: 0 seconds, Memory: 3.50Mb

OK (2 tests, 2 assertions)

Actual output:

PHPUnit 3.5.0RC1 by Sebastian Bergmann.

setUpBeforeClass, pid=23882
setUpBeforeClass, pid=23883
testA, pid=23883
.setUpBeforeClass, pid=23884
testB, pid=23884
.

Time: 1 second, Memory: 3.50Mb

OK (2 tests, 2 assertions)

process isolation does not work on Windows 7 x64?

Trying out PHPUnit 3.5 got me confused for two days. First, I tried to add new tests for some new models I created in Symfony2 PR3's sandbox, which failed with a weird error:

RuntimeException: PHP Parse error: parse error in C:\(...)\symony2_pr3\- on line 131 (notice the \- at the end of the path)

Thinking it was related to Symfony, I left it there. Today, I wanted to introduce PHPUnit into another (non-Symfony) project. Eventually, I ran into the same error:

RuntimeException: PHP Parse error: parse error in C:\(...)\MyProject\- on line 141 (again, notice the \- at the end of the path)

After some trial-and-error, I removed processIsolation="true" from phpunit.xml, and all worked!

I tried debugging the error, but even using xdebug's profiler I wasn't able to locate the origin of the error.

Allow TestCase to assess if STDERR buffer is a real error when running in process isolation

Hello,

I have been using PHPUnit and to be honest I really like it. I just had a question:

When running a test in process isolation:

===== SYSTEM UNDER TEST.php =====

<?php
class MyHello {
    public function sayHello() {
        system('echo hey >&2');
        return 'I feel good';
    }
}
?>

==== TEST RUNNER FILE.php ======

<?php
require_once 'PHPUnit/Framework.php';

/**
 * @runTestsInSeparateProcesses
 */
class MyHelloTest extends PHPUnit_Framework_TestCase {

    public function testSayHello() {
        require_once 'test.php';
        $myHello = new MyHello();
        $out = $myHello->sayHello();
        $this->assertTrue($out === 'I feel good');
    }
}
?>

====== OUTPUT =====

localhost 21:34:29 ~ $ phpunit runtest.php 
PHPUnit 3.4.12 by Sebastian Bergmann.

E

Time: 0 seconds, Memory: 4.50Mb

There was 1 error:

1) MyHelloTest::testSayHello
RuntimeException: hey


FAILURES!
Tests: 1, Assertions: 0, Errors: 1.

If there is anything written to the STDERR, the test is considered to be a failure. Is there any way to intersect line 179 in

excerpt from http://github.com/sebastianbergmann/phpunit/blob/3.5/PHPUnit/Util/PHP.php

173 * @param string $stdout
174 * @param string $stderr
175 * @since Method available since Release 3.5.0
176 */
177 protected static function processChildResult(PHPUnit_Framework_Test $test, PHPUnit_Framework_TestResult $result, $stdout, $stderr)
178    {
179        if (!empty($stderr)) {
180            $time = 0;
181            $result->addError(
182              $test,
183              new RuntimeException(trim($stderr)), $time
184            );
185        } else {

I couldn't find a way to do this in an object oriented way. Could you allow a hook on line 605 of TestCase.php

excerpt from http://github.com/sebastianbergmann/phpunit/blob/3.5/PHPUnit/Framework/TestCase.php

603       $this->prepareTemplate($template);
604
605            PHPUnit_Util_PHP::runJob($template->render(), $this, $result);
606        } else {
607            $result->run($this);

I don't want to copy paste the entire run() method in TestCase.php in my class that extends PHPUnit_Framework_TestCase and modify line 605

excerpt from
http://github.com/sebastianbergmann/phpunit/blob/3.5/PHPUnit/Framework/TestCase.php

488 public function run(PHPUnit_Framework_TestResult $result = NULL)

just to be able to judge if a test is actually a success and the output in STDERR buffer is just extra noise. I couldn't find a way as I said, because

a) PHPUnit_Util_PHP::runJob() is called within run()
b) after it's called, I have no way to intersect stderr returned by the result from test in separate process

Any help is really appreciated. Thank you.

Code paths that create a PHPUnit_Framework_Warning end up serializing/unserializing globals unconditionally

When PHPUnit is given a file with no test methods, with private test methods, with no public constructor, etc., it creates a PHPUnit_Framework_Warning object and "runs" it. Since this object has $backupGlobals === NULL, "running" it results in all the globals being serialized and then unserialized. In our environment there are globals that cannot be serialized, so this behavior breaks things and causes subsequent tests in the same suite to fail. So there needs to be a way to turn this behavior off. My suggestion is to have this behavior always be off by adding

    protected $backupGlobals = FALSE;

to the PHPUnit_Framework_Warning class.

expectedExceptionMessage Annotation does not work as expected

I put into some commented test cases.

Result is
..E..

Time: 1 second, Memory: 5.00Mb

There was 1 error:

  1. ExpectedExceptionTest::testExpectedMessage
    BlubException: Haha
    ...
    FAILURES!
    Tests: 5, Assertions: 4, Errors: 1.
<?php
class BlubException extends Exception
{
}

class ExpectedExceptionTest extends PHPUnit_Framework_TestCase
{
    /**
     * This works fine
     * 
     * @expectedException BlubException
     */
    public function testExpectedException()
    {
        throw new BlubException();
    }

    /**
     * This works fine
     */
    public function testExpectedMessageOldSchool()
    {
        try {
            throw new BlubException("Haha");
            $this->fail('Exception expected, but none thrown');
        } catch (BlubException $e) {
            $this->assertEquals('Haha', $e->getMessage());
        }
    }

    /**
     * This fails, because the exception is not caught, probably it should pass
     * 
     * @expectedExceptionMessage Haha
     */
    public function testExpectedMessage()
    {
        throw new BlubException("Haha");
    }

    /**
     * This should fail, because the message is wrong, but it passes
     * @expectedException BlubException
     * @expectedExceptionMessage Haha
     */
    public function testExpectedMessageWrongMessage()
    {
        throw new BlubException("Blublub");
    }

    /**
     * This old school version should fail, according to several examples, but passes
     * e.g. see PHP QA Book german version page 30
     */
    public function testOldSchoolForGenericExceptionFailsButIsStillInSomeExamples()
    {
        try {
            // do something that does not throw an exception, but was expected to
            $this->fail('Exception expected, but none thrown');
        } catch (Exception $e) {
            // We end up here, because fail() throws an exception, nowadays.
            $this->assertEquals('PHPUnit_Framework_AssertionFailedError', get_class($e));
        }
    }
}

Mocking class Imagick of pecl/imagick 3.0.0 fails with PHPUnit 3.4.2 and 3.5 beta1

When mocking class Imagick of the pecl/imagick extension 3.0.0, mocking fails with the following error message:

Fatal error: Call to a member function verify() on a non-object in /usr/share/php/PHPUnit/Framework/MockObject/Generator.php(172) : eval()'d code on line 4358

The testcase is quite easy:

class test extends PHPUnit_Framework_TestCase
{
public function test()
{
$mock = $this->getMock('Imagick');
}
}

The server is running Ubunt 10.04 with PHP 5.3.2 from the Ubuntu repository, Imagick installed via pecl and PHPUnit installed from PEAR.

phpunit.bat on 3.5.0RC1 doesn't work

When running phpunit.bat on a freshly installed 3.5.0RC1 I get an error like "Files not expected" (sorry if it's not the real error, my OS is not english). A bit of debugging showed that the path environment variable PHPBIN was had double "double quotes". I'm not a .bat expert but here's one that works for me:

if "%PHPBIN%" == "" set PHPBIN=C:\Program Files (x86)\PHP\php.exe
if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
GOTO RUN
:USE_PEAR_PATH
set PHPBIN=%PHP_PEAR_PHP_BIN%
:RUN
"%PHPBIN%" "C:\Program Files (x86)\php\phpunit" %*

getMockForAbstractClass fails when abstract class contains no abstract methods

Version : PHPUnit 3.5
Platform : PHP 5.3.2-1ubuntu4.5 with Suhosin-Patch (cli) (built: Sep 17 2010 13:41:55)

I appreciate that an abstract class with no abstract methods may seem a little odd, we have such classes that we want to test through PHPUnit. This unit tests demonstrates what I mean.

<?php
abstract class HasAbstractMethod {
    function foo() {}
    abstract function bar();
}
abstract class HasNoAbstractMethods {
    function foo() {}
}

class BugReport_getMockForAbstractClass_NoAbstractMethods extends PHPUnit_Framework_TestCase {
    public function testCanUseGetMockForAbstractClassWhenClassHasAbstractMethods() {
        $c = $this->getMockForAbstractClass('HasAbstractMethod');
    }

    public function testCanUseGetMockForAbstractClassWhenClassHasNoAbstractMethods() {
        $c = $this->getMockForAbstractClass('HasNoAbstractMethods');
        // this test fails:
        //Argument 2 passed to PHPUnit_Framework_MockObject_Generator::generateMock() must be an array, null given, called in /usr/share/php/PHPUnit/Framework/MockObject/Generator.php on line 283
    }
}

Would be a fairly straightforward mix - just to pass in a blank array rather than null in Generator.php:

230c230
<                 $methods = array();

---
>                 $methods = NULL;

Html Coverage report too optimistic

Greetings,
This happens in PHPUnit 3.5.0, on PHP 5.2.13, with XDebug 2.1.0:
In some classes (most of them, in fact) of my project, lines that are not covered do not appear hilighted (neither gray, green nor orange). And now most of the concerned class are marked as beeing 100% covered when they shouldn't.
Regards

Failure message ignored in assertSelectCount

Example:

$this->assertSelectCount(
'textarea[name=somename]', 1, $html,
'The generated textarea name is missing or incorrect!'
);

If the selector doesn't match anything, the output message is just "Failed asserting that integer:0 matches expected integer:1."

The parameter $message is lost when calling assertEquals from assertSelectEquals.

When backupStaticAttributes is enable, static data from a first test case leaks to the subsequent tests cases

Basically, when using autoloading, the framework cannot have access to a certain class until it's autoloaded. Then, if the first test case stored something in the static scope, it will be available to all the subsequent tests cases and, if someone access the static scope, it can breaks a test with an unexpected behavior. It's an edge case.

I created some example files to show this: http://github.com/eriksencosta/phpunit-bsa-edge-case

Just run AllTests and see that the assertEquals calls fails. Then, uncommenting the 14th line from OneTest will cause the tests passes (or just checkouts the "pass" branch).

One solution I thought was to replace the registered autoloaders with rewrited copies that would call GlobalState::backupStaticAttributes() when the class was first loaded (something like what MockObject do when create the mock with a class skeleton).

For this, backupStaticAttributes could be refactored and a specific method would backup the static attributes of a newly loaded class. All the subsequent calls would behave as expected because as the class name would be returned in the get_declared_classes() call of GlobalState::backupStaticAttributes().

Maybe with the backupStaticAttributes = FALSE recommendation, this could be an unnecessary effort. But while the option exists, some people will eventually have problems with this, maybe thinking is misusing the option.

junit xml log for phpt tests does not appear to work

PHPUnit 3.4.10

The generated junit log does not appear to be understood by cruisecontrol:
http://test.pear.php.net:8080/cruisecontrol/buildresults/HTML_Table?tab=buildResults

Relevant line:


Steps to reproduce:
clockwerx@sg1:~/cruisecontrol/projects/HTML_Table$ ant
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-sun-1.6.0.20/lib/tools.jar
Buildfile: build.xml

checkout:
[exec] At revision 302332.

(snip)
phpunit:
[exec] PHPUnit 3.4.10 by Sebastian Bergmann.
[exec]
[exec] ...............................
[exec]
[exec] Time: 6 seconds, Memory: 10.50Mb
[exec]
[exec] OK (31 tests, 0 assertions)

build:

BUILD SUCCESSFUL
Total time: 14 seconds

which generates

Compared to other packages:

Refactor how tests are run

  • Move test execution logic out of TestResult
    • Use TestResult just as a Collecting Parameter to collect test results
  • Before the test execution starts
    • Use a TestSuiteIterator to get all tests that are to be run from the top-level TestSuite
      • Use FilterIterator implementations to filter tests based on --filter, --group, and --exclude-group, for instance
      • This allows the number of tests that are to be run to be calculated correctly before the tests are actually run
    • Sort the tests according to @depends annotations
  • Delay creation of TestCase objects and clean them up immediately after a test has been run
    • Allows for more elegant implementation of test execution in isolated PHP processes
    • Allows for running the tests in random order
    • Reduces memory footprint

Mock expectations shouldn't be allowed on not existent methods

I can't open a ticket on phpunit.de so I have to do it here, not know if this is the right place.

In PHPUnit 3.4.15, this test case:

getMock('DummyInterfaceWithoutMethods');
                $mock->expects($this->any())
                        ->method('doesNotExist')
                        ->will($this->returnValue('foo'));
        }
}
interface DummyInterfaceWithoutMethods {}

does not fail. If an error were raise, it will be simple to find mystakes and typos in method names.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.