Bug #42114

PHPUnit functional tests cannot be run when only installed through composer

Added by Sebastian Kurfuerst almost 3 years ago. Updated over 2 years ago.

Status:Resolved Start date:2012-10-18
Priority:Must have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:- Testing -
Target version:TYPO3 Flow Base Distribution - 2.0 beta 1
PHP Version: Complexity:
Has patch:No Affected Flow version:Git 1.2 (master)

Description

Steps to reproduce:

  • clone base distribution
  • adjust composer.json to include
    phpunit/phpunit: 3.7.*
    as dev-dependency
  • run
    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

Related issues

related to TYPO3.Flow - Bug #42269: Unittests fail with PHPunit 3.7(.8) Closed 2012-10-22

History

#1 Updated by Sebastian Kurfuerst almost 3 years ago

  • Assigned To set to Christian Jul Jensen
  • Priority changed from Should have to Must have
  • Target version set to 2.0 beta 1

#2 Updated by Christian Jul Jensen almost 3 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.

#3 Updated by Christian Jul Jensen almost 3 years ago

Unittest error #42269

#4 Updated by Christian Jul Jensen almost 3 years ago

  • Status changed from New to Needs Feedback

#5 Updated by Karsten Dambekalns over 2 years ago

  • Category set to - Testing -
  • Status changed from Needs Feedback to Resolved
  • Assigned To changed from Christian Jul Jensen to Karsten Dambekalns
  • % Done changed from 0 to 100

See 0e1ac1c88c9a25f24333780e259dc4fc98b9bffa and a4955450e2a23d943176c21a6ce11b4c2fa6b48a for the fix.

Also available in: Atom PDF