sebastianbergmann / phpunit
- Source
- Commits
- Network (56)
- Issues (7)
- Graphs
-
Branch:
master
click here to add a description
click here to add a homepage
-
1 comment Created 16 days ago by sebastianbergmannRefactor how tests are runenhancement- Move test execution logic out of
TestResult- Use
TestResultjust as a Collecting Parameter to collect test results
- Use
- Before the test execution starts
- Use a
TestSuiteIteratorto get all tests that are to be run from the top-levelTestSuite- Use
FilterIteratorimplementations 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
- Use
- Sort the tests according to
@dependsannotations
- Use a
- Delay creation of
TestCaseobjects and clean them up immediately after a test has been run - Allows for more elegant implementation of test execution in isolated PHP processes
- Reduces memory footprint
Comments
- Move test execution logic out of
-
0 comments Created 16 days ago by sebastianbergmannAdd policy support for Test Dependency based Fixture ReuseenhancementCurrently, 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
cloneor deep-copy operation on the result that is returned from A.Comments
Please log in to comment. -
Circular dependency of PHPUnit, DbUnit, PHPUnit_MockObject, and PHPUnit_Selenium
0 comments Created 16 days ago by wrobelPHPUnit 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.
Comments
Please log in to comment. -
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).
Comments
daniela-waranie Mon Aug 23 07:42:47 -0700 2010 | linkTo make it clear: i can not notice the skipped test in the "Test Results" window of netbeans. In the command line output (not the XML) i can see the skipped test. Commandline output and xml should be semantic equal.
whatthejeff Mon Aug 23 23:01:26 -0700 2010 | linkThe actual issue is that
PHPUnit_Util_Log_JUnitignoresPHPUnit_Framework_Warningerrors (which is what you get when you specify a@dataProviderthat doesn't exist).whatthejeff Tue Aug 24 22:48:42 -0700 2010 | linkFor what it's worth, I fixed this in a local branch but it didn't solve the problem with netbeans.
Currently the JUnit result printer will not print the same count for test cases and failures or the same errors as the other result printers if any warnings are encountered. Even after fixing the JUnit result printer to match the other result printers, neatbeans still prints misleading results.
It seems that neatbeans is only looking at the individual test cases for failures and not the overall test suite results. This is problematic as some warnings refer to errors that occur outside of a specific test case. It's possible to create a specific class of warning that relates to warnings that are encountered while trying to execute a specific test case and then handle those in a way that netbeans can recognize but that doesn't solve the overall problem. I think this is something that will have to be fixed in neatbeans as well.
daniela-waranie Sun Aug 29 05:50:58 -0700 2010 | linkIf your data provider returns an empty array your xml looks like this:
<?xml version="1.0" encoding="UTF-8"?> <testsuites> <testsuite name="Webapp_Model_PhpUnitTest" file="S:\myproject\test\myproject\application\models\webapp\models\phpunitTest.php" fullPackage="Webapp.Model" tests="1" assertions="1" failures="0" errors="0" time="0.000676"> <testcase name="testSomething" class="Webapp_Model_PhpUnitTest" file="S:\myproject\test\myproject\application\models\webapp\models\phpunitTest.php" line="9" assertions="1" time="0.000676"/> <testsuite name="Webapp_Model_PhpUnitTest::testMyThing" tests="0" assertions="0" failures="0" errors="0" time="0.000000"/> </testsuite> </testsuites>Netbeans shows test suite "Webapp_Model_PhpUnitTest::testMyThing" as skipped. Sorry i can not add a snapshot here.
When data provider method is missing the xml for the test suite is missing, too. Which makes netbeans not to show an entry for the skipped test (Webapp_Model_PhpUnitTest::testMyThing).
The attributes of the xml element (testsuite)) should be "tests="0" assertions="0" failures="0" errors="0" time="0.000000"" for both:
a) emty array
b) missing data provider methodOn command line both should result in "FAILURES! Tests: 2, Assertions: 1, Failures: 1". An empty array makes no sense and is a failure.
daniela-waranie Sun Aug 29 13:02:23 -0700 2010 | linkNetbeans does not consider the command line output. It considers the xml only. Did you add the missing XML element? If your xml element is equal to
<testsuite name="Webapp_Model_PhpUnitTest::testMyThing" tests="0" assertions="0" failures="0" errors="0" time="0.000000"/>then netbeans will recognize it as a skipped test suite.whatthejeff Wed Sep 01 09:25:44 -0700 2010 | linkOkay, I fixed this issue here: http://github.com/whatthejeff/phpunit/tree/topic_13. I made the following changes:
- Data providers that return an empty array now generate a warning that says, 'No tests found in suite.' This is more consistent with how normal test suites behave and will generate a warning in CLI or an empty
<testsuite>element in the JUNIT format. - All other errors that occur while setting up a data provider test suite now generate an empty
<testsuite>element in the JUNIT format.
I still think that the JUNIT result printer could be more consistent. Judging from the netbeans source code, netbeans generates the "skipped" message because it knows that an empty test suite normally triggers a warning but it has no access to the actual warning in the JUNIT results. It seems like it would make more sense (and would be more consistent with the actual JUNIT DTD) if warnings were reported inside of the
<tesetsuite>elements. For example:<testsuite name="ATest" tests="0" assertions="0" failures="1" errors="0" time="0.000000"> <failure type="PHPUnit_Framework_Warning">ATest::testA No tests found in class "ATest". </failure> </testsuite>This would make the JUNIT results printer more consistent with the other result printers and it would allow applications like neatbeans the possibility of handling warnings more gracefully.
daniela-waranie Thu Sep 02 13:29:58 -0700 2010 | linkWould be nice if sebastian will merge this soon.
daniela-waranie Sat Sep 04 04:47:52 -0700 2010 | linkI hope to see this soon in 3.5.0RCx
daniela-waranie Sun Sep 05 13:05:17 -0700 2010 | linkHi whatthejeff,
i can not get the result by using your code. I did a checkout on http://github.com/whatthejeff/phpunit.git and copy the "PHPUnit" folder to the PEAR folder of my XAMPP. But i did not get the
<testsuite>element in the result xml (when i used an invalid @dataProvider method name when using the --log-junit). Issue not fixed?Please log in to comment.whatthejeff Sun Sep 05 13:24:13 -0700 2010 | linkMake sure you checkout the topic_13 branch as this bug is fixed in that branch and not the master branch. Something along the lines of:
git checkout topic_13 - Data providers that return an empty array now generate a warning that says, 'No tests found in suite.' This is more consistent with how normal test suites behave and will generate a warning in CLI or an empty
-
Weird RuntimeException when running test suite with --process-isolation
0 comments Created 7 days ago by caeferI get the following error when using the --process-isolation option.
RuntimeException: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRINGYou can reproduce it using this code: http://github.com/caefer/sfPhpUnitDbBootstrapExperimentPlugin
Follow the README.md instruction for setup and perform the included experiments (<2minutes).Comments
Please log in to comment. -
This is in reference to: http://github.com/sebastianbergmann/phpunit/issues#issue/13
Comments
Please log in to comment. -
Make the "XML Configuration File" win against command line options
0 comments Created about 16 hours ago by daniela-waranieSome 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.
Comments
Please log in to comment.



I'm very excited to see this! We've had to increase our memory limit every so often to deal with test cases sticking around to the end. One thing you might not have considered yet is that by default any exceptions thrown during a test will have a reference to the test case itself in the backtrace.
As I've started working on a new Java project at my job I'm picking up the new JUnit features. One neat feature is the ability to add a TestDecorator to any test case using an annotation. This is how jMock checks its mocks at the end of each method, and a similar docblock annotation could be helpful for PHP tool integrators.