Skip to content

magento/framework does not require all of its dependencies #4378

@punkstar

Description

@punkstar

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

  1. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed in 2.2.xThe issue has been fixed in 2.2 release lineIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentbug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions