Skip to content
This repository was archived by the owner on May 27, 2023. It is now read-only.
This repository was archived by the owner on May 27, 2023. It is now read-only.

Duplication of class Spyc #284

@barbazul

Description

@barbazul

We are currently using Composer to deploy Magento with its modules and also some other non-Magento related tools used for our CI cycle.

We are currently using the dev branch of EcomDev_PHPUnit

We recently run into an issue where PHPUnit crashed silently and it took us several hours before we found out that the source of the problem was that Spyc was being autoloaded via composer at the beginning of the PHPUnit process and later again when loading tests that use either a fixture or dataProvider (we are not using expectations, but I assume its the same case).

The problem was that the first line of EcomDev_PHPUnit_Model_Yaml_Loader does a require_once 'Spyc/spyc.php' without considering the possibility of it already beind loaded gloabally.

For our case, simply wrapping the require_once in if (!class_exists('Spyc', false)) fixed the issue.

Looking closely at the 2 versions of Spyc, we noticed the one we have via Composer is version 0.6.2 while the one bundled with EcomDev_PHPUnit is version 0.4.5 so I am not 100% this fix will work in every scenario.

I can provide a PR with this fix unless the Spyc version needs to be fixed to 0.4.5 for some reason.

Comparing both versions, I only noticed differences in comments, internal functions naming, a bunch of dump stuff (not used by this module) and some additional controls when loading files. Nothing struck me as a possible compatibility breaker but I am not that familiar with Spyc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions