Project

General

Profile

Actions

Bug #77964

closed

FunctionalTestCaseBootstrapUtility not present in typo3/cms 7.6.14 composer package

Added by Viktor Livakivskyi about 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Tests
Target version:
-
Start date:
2016-09-15
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Hi,

I've just updated from 7.6.10 to 7.6.11 and run all my unit and functional tests, to ensure, that my code is still ok.
Unit tests are running smoothly, while functional tests report an error:

 Fatal error: Class 'TYPO3\CMS\Core\Tests\FunctionalTestCaseBootstrapUtility' not found in /path/typo3_src/typo3/sysext/core/Classes/Tests/FunctionalTestCase.php on line 203

I still can see this file in git: https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_7-6-11/typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php

But in Composer package version the complete typo3/sysext/core/Tests folder is missing.

Contents of my composer.json (trimmed a bit):

{
  "name": "my/ext",
  ...
  "minimum-stability": "stable",
  "repositories": [
    {
      "type": "composer",
      "url": "https://composer.typo3.org/" 
    }
  ],
  "config": {
    "vendor-dir": "vendor",
    "bin-dir": "bin" 
  },
  "require": {
    "php": "~5.6",
    "typo3/cms": "7.6.*",
    ...
    "helhum/typo3-console": "3.3.*" 
  },
  "require-dev": {
    "phpunit/phpunit": "5.4.*",
    "phpunit/phpcov": "~3.0" 
  },
  "extra": {
    "typo3/cms": {
      "web-dir": "www" 
    },
    "helhum/typo3-console": {
      "install-binary": false
    }
  },
  "autoload": {
    "psr-4": {
      ...
    }
  },
  "autoload-dev": {
    "psr-4": {
      "TYPO3\\CMS\\Core\\Tests\\": "www/typo3/sysext/core/Tests/",
      ...
    }
  }
}

Version 7.6.10 of Composer package doesn't have this issue.

Actions #1

Updated by Wouter Wolters about 8 years ago

  • Status changed from New to Needs Feedback

Use --prefer-source and read about it at #77205

Actions #2

Updated by Viktor Livakivskyi about 8 years ago

Unfortunately it is not possible to --prefer-source for one package only in Composer, so this is not an option, because I don't want all of my other dependencies be downloaded via sources as well.

For me it still seems like a bug, because the class, which exists in package FunctionalTestCase depends on class, which doesn't exist in package FunctionalTestCaseBootstrapUtility, which makes it useless at all.

Also in provided issue #77205 a solution is also not in using --prefer-source, but in restoring missing file in package.

The correct solution, as I can imagine would be either:
1. Make dependencies of base test classes be also available in package
or
2. Provide a separate dev-package, which can be included as dependency in "require-dev" and which provides all the Unit-Functional-testing data (including fixtures, base tests and so on).

Actions #3

Updated by Georg Ringer about 8 years ago

You can just switch one package as well

"config": {
    "preferred-install": {
      "typo3/cms": "source",
      "*": "dist" 
    },
  }
Actions #4

Updated by Mark Watney about 8 years ago

At the moment we automatically deploy (exactly) the tested TYPO3 instance – I guess using `preferred-install` and `source` for `typo3/cms` will work for us – as long as we exclude the `.git` directory from deployment. Unfortunately using `source` will slow down our builds because composer will (a) not be able to load `typo3/cms` from composer's cache and (b) will (by definition) not use a distribution (which "can speed up installs substantially"), right?

Actions #5

Updated by Viktor Livakivskyi about 8 years ago

Georg, thank you for the tip! I was looking in wrong direction at Composer's docs.

Nevertheless, I still find this a bit confusing (class from package relies on class, which doesn't exist in package). But as I understand, form a SO issue there are plans to change this in next minor versions, right?

Actions #6

Updated by Uwe Trotzek almost 8 years ago

With TYPO3 7.6.14 I get the following error when executing functional tests:

PHPUnit_Framework_Exception: PHP Fatal error: Class 'TYPO3\CMS\Core\Tests\FunctionalTestCaseBootstrapUtility' not found

I've added

"config": {
"preferred-install": {
"typo3/cms": "source",
"*": "dist"
}
}

to my root composer.json of the project. The class file itself exists in the TYPO3 core but can obviously not be loaded.

Actions #7

Updated by Uwe Trotzek almost 8 years ago

I've created a simple package to reproduce the issue. You can find it here: https://github.com/utrotzek/functionaltest_test/

When you follow the instructions described in the repo, you will have a fresh TYPO3 with the example package containing one simple functional test.
After you execute the functional tests you will get the following error:

PHPUnit_Framework_Exception: PHP Fatal error: Class 'TYPO3\CMS\Core\Tests\FunctionalTestCaseBootstrapUtility' not found.

The Class FunctionalTestCaseBootstrapUtility is present in the following path 'WWW/typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php' so it seems that it is because of an autoloading issue. I'm no autoloading expert, but as far as I know the autoloading definition in the core package

"autoload-dev": {
"psr-4": {
"TYPO3\\CMS\\Core\\Tests\\": "Tests/"
}
}

does not work since autoload-dev will only work in root composer json.

So in my opinion the FunctionalTestCaseBootstrapUtility should be moved to Classes directory or the "autoloading" definition from "autoload-dev" should be moved to "autoload"

Actions #8

Updated by Uwe Trotzek almost 8 years ago

  • Subject changed from FunctionalTestCaseBootstrapUtility not present in typo3/cms 7.6.11 composer package to FunctionalTestCaseBootstrapUtility not present in typo3/cms 7.6.14 composer package
Actions #9

Updated by Alexander Opitz over 7 years ago

You need to add the "autoload-dev" from core package to your own composer.json, there is no other way to solve this. (Beside creating a package witch include the Test API parts).

So I'd like to close this issue, is it ok for you?

Actions #10

Updated by Viktor Livakivskyi over 7 years ago

Hi, Alexander.

Yes, If copy-paste of autoload-dev solves an issue, then this ticket can be closed.

Actions #11

Updated by Alexander Opitz over 7 years ago

  • Status changed from Needs Feedback to Closed

Yes, that's the way how it goes in the composer world.

It's like -dev dependencies.

Thanks for your feedback.

Actions

Also available in: Atom PDF