Magento2: magento/framework does not require all of its dependencies

Created on 2 May 2016  路  3Comments  路  Source: magento/magento2

We are developing our Magento 2 extensions and running continuous integration against them. In the interest of failing fast, we're running our extension unit tests without having a full Magento 2 installation up and running. In order to achieve this we get specific (as I think we should) about our actual requirements on the Magento 2 codebase in our composer.json, resulting in a file looking like:

...

  "require": {
    "magento/framework": "100.0.*",
    "magento/module-backend": "100.0.*",
    "magento/module-store": "100.0.*"
  },
  "require-dev": {
    "phpunit/phpunit": "4.1.0"
  },

...

When attempting to use classes available in magento/framework we get "class not found" fatal errors due to Zend\Http not be explicitly listed as a requirement of the package.

Steps to reproduce

  1. Include "magento/framework": "100.0.*" as a requirement in your own project's composer.json
  2. Run composer install to install dependencies
  3. Write a unit test that uses Magento\Framework\TestFramework\Unit\Helper\ObjectManager to mock a Magento\Framework\App\Request\Http.

    Expected result

  4. Test passes.

    Actual result

phpunit --verbose
PHPUnit 4.1.0 by Sebastian Bergmann.

Configuration read from phpunit.xml

........PHP Fatal error:  Class 'Zend\Http\PhpEnvironment\Request' not found in /Users/nrj/Desktop/builder/vendor/magento/framework/HTTP/PhpEnvironment/Request.php on line 16

Fatal error: Class 'Zend\Http\PhpEnvironment\Request' not found in /Users/nrj/Desktop/builder/vendor/magento/framework/HTTP/PhpEnvironment/Request.php on line 16
Fixed in 2.2.x Format is not valid Ready for Work bug report

Most helpful comment

All 3 comments

Related internal ticket MAGETWO-31454

Was this page helpful?
0 / 5 - 0 ratings