mirror of
https://github.com/php/pftt2.git
synced 2026-03-24 09:12:17 +01:00
Upgrade bundled PHPUnit #61
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @cmb69 on GitHub (Nov 15, 2019).
The files in cache/util/PEAR/pear/PHPUnit are currently PHPUnit 3.6.11, DBUnit 1.2.0 and phpunit-mock-objects; so all pretty old versions, and the latter two projects are even abandoned, whereby the MockObjects have been bundled with PHPUnit in the meantime.
However, the bundled PHPUnit has been patched:
Also cache/util/PEAR/phpunit(.bat) have been patched as well.
So we have to figure out the details of upgrading and possibly unbundling:
@lavturo commented on GitHub (Nov 20, 2019):
To answer a few of these questions:
For the patches, it is hard to say if they are needed as of now since app testing is currently not working. We could keep these as reference if we were to update PHPUnit.
DBUnit is only a part of the PEAR directory. It is part of some .php files. Otherwise, it is not referenced in pftt itself. However, the PEAR directory is referenced once. This one reference is for PFTT to find the
autoload.phpfor PHPUnit (located at pftt2/cache/util/PEAR/pear/PHPUnit). Otherwise, it will give an error about not being able to find said file.I believe, we would only have to update the
test.phpfile that is generated by PFTT, if we wanted to move or update PHPUnit. However, I am unsure of howtest.phpused PHPUnit. So I would have to look through that file before commenting on what else needs to be updated or adapted.If we want to be able to do app testing for PHP 5.6 and 7.0, then we would only be able to upgrade to PHPUnit 5.
@cmb69 commented on GitHub (Dec 4, 2019):
@lavturo, it's actually that test.php that worries me most. It seems that this is a variant of an instantiated TestCaseMethod.tpl.dist, and as such may be highly dependent on the PHPUnit version (i.e. would likely have to be adapted for every upgrade). It might be worthwhile to have a look at the officially supported customizations (see respective PHPUnit 5 docs); perhaps these already offer what we need?
@lavturo commented on GitHub (Dec 5, 2019):
From what I have found,
test.phpis generated from PhpUnitTemplate.goovy. The first part of it seems similar to the file you linked.Any change to that file gives the same error: "Class 'WP_UnitTestCase' not found". This error occurs due to the bootstrap file. This makes me wonder if the current wordpress-tests I am using has its own problems or if it is something else all together.
The officially supported customizations seem to be helpful. We wouldn't need to change any of the actual tests themselves though, do we?
@cmb69 commented on GitHub (Dec 5, 2019):
I ran the wordpress-tests a few weeks ago standalone (i.e. without PFTT), and besides some test failures, that worked fine. I guess that PFTT only was run with some old version of these tests (most likely even before they have been merged into wordpress-develop). Also, the hard-coded paths in PHPUnitTemplate.groovy look fishy; there's certainly no need to include symfony for running WP tests. Possibly, these have been adjusted manually for each app test scenario, and only this "snapshot" has been committed? (see also a few lines below; there are several include paths for different app scenarios; WordPress doesn't seem to be one of them, though)
The PHPUnit customizations should indeed only affect the test runner, so no modifications to the actual tests should be necessary (and we certainly want to avoid anyway).
@lavturo commented on GitHub (Dec 5, 2019):
There is a call made in AbstractPhpUnitTestCaseRunner.java that gets the info that is stored in wordpress.groovy.
As for the include path, it is updated and passed from PhpUnitDist.java. It grabs every directory in the specified source test pack directory (which is defined from wordpress.groovy).
I believe the hard-coded paths were left there so that they know what directories are needed if they were to try and run a test for one of those specific app scenarios. However, they might be outdated if the test source packs for those app scenarios have been updated with different directories.
@cmb69 commented on GitHub (Jan 17, 2020):
Since
bf0a98eaaeupdated to PHPUnit 5, this ticket can be closed.