PHPUnit functional tests cannot be run when only installed through composer
Steps to reproduce:
- clone base distribution
- adjust composer.json to include
phpunit/phpunit: 3.7.*as dev-dependency
composer install --dev --prefer-source
- Then, run unit tests:
bin/phpunit -c Build/buildessentials/PhpUnit/UnitTests.xml
-> unit tests report one error. Not sure if this is related, though.
- Then, run functional tests with empty Data/Temporary/Testing cache:
bin/phpunit -c Build/buildessentials/PhpUnit/FunctionalTests.xml
- The following error occurs:
± % bin/phpunit -c Build/buildessentials/PhpUnit/FunctionalTests.xml !10497 Uncaught Exception in Flow Execution of subprocess failed with exitcode "255" and output: Warning: require_once(PHPUnit/Autoload.php): failed to open stream: No such file or directory in /Volumes/data/htdocs/FLOW3Base/Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Core/Bootstrap.php on line 92 Fatal error: require_once(): Failed opening required 'PHPUnit/Autoload.php' (include_path='.') in /Volumes/data/htdocs/FLOW3Base/Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Core/Bootstrap.php on line 92 thrown in file Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Core/Booting/Scripts.php in line 529 Reference code: 201210180921175c4a48 #0 TYPO3\Flow\Error\DebugExceptionHandler::echoExceptionCli() /Volumes/data/htdocs/FLOW3Base/Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Error/AbstractExceptionHandler.php:72 #1 TYPO3\Flow\Error\AbstractExceptionHandler::handleException()
Include_path should be only set to ".", not including any global PEAR include path!
For reference, the unit test failure is as follows:
1) TYPO3\Flow\Tests\Unit\Persistence\Generic\DataMapperTest::mapToObjectReconstitutesExpectedObjectAndRegistersItWithIdentitymapToObjects Expectation failed for method name is equal to <string:registerObject> when invoked 1 time(s) Parameter 0 for invocation TYPO3\Flow\Persistence\Generic\Session::registerObject(Entity69505463a5dd66f8694281e0fb1a575e Object (...), '1234') does not match expected value. Failed asserting that two objects are equal. --- Expected +++ Actual @@ @@ Entity69505463a5dd66f8694281e0fb1a575e Object ( - '__phpunit_id' => 'Entity69505463a5dd66f8694281e...575e#0' + '__phpunit_id' => null ) /Volumes/data/htdocs/FLOW3Base/Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Persistence/Generic/DataMapper.php:107 /Volumes/data/htdocs/FLOW3Base/Packages/Framework/TYPO3.Flow/Tests/Unit/Persistence/Generic/DataMapperTest.php:84 /Volumes/data/htdocs/FLOW3Base/Packages/Framework/TYPO3.Flow/Tests/BaseTestCase.php:50
Updated by Christian Jul Jensen almost 9 years ago
I cannot reproduce the issue with the functionaltests.
However, I did get very weird behaviour from running globally installed phpunit with also a composer version if they are different versions, because our tests use the composer autoloader and so loads some local classes even when using the global instance.
The issue with the unittests are a unrelated, it is a problem with PHPUnit 3.7 (maybe just 3.7.8), I'll create another issue for that.
Updated by Karsten Dambekalns almost 9 years ago
- Category set to - Testing -
- Status changed from Needs Feedback to Resolved
- Assignee changed from Christian Jul Jensen to Karsten Dambekalns
- % Done changed from 0 to 100
See 0e1ac1c88c9a25f24333780e259dc4fc98b9bffa and a4955450e2a23d943176c21a6ce11b4c2fa6b48a for the fix.