• MethodProphecy::shouldBeCalledOnce() was added to Prophecy in release 1.7.6
  • Drupal core's composer.json specifies "phpspec/prophecy": "^1.7",

Yet when I use said method, my tests go green locally but fail on testbot: https://www.drupal.org/pift-ci-job/1181351
The error being: "Call to undefined method Prophecy\Prophecy\MethodProphecy::shouldBeCalledOnce()"

Now I could work around this using shouldBeCalledTimes(), but I should be able to use the most recent Prophecy methods, no?

Useful links:

Comments

kristiaanvandeneynde created an issue. See original summary.

kristiaanvandeneynde’s picture

Project: Drupal.org Testbots » DrupalCI: Test Runner
Component: malfunctioning testbot » Codebase Build

Sorry, wrong issue queue.

Mixologic’s picture

Category: Bug report » Support request
Status: Active » Postponed (maintainer needs more info)

DrupalCI relies on core's composer.lock file which are the versions that core has been tested on. In this case drupal core ships with prophecy 1.7.0: https://cgit.drupalcode.org/drupal/tree/composer.lock#n3516

If your tests depend upon a newer version of prophecy, then the composer.json of the group module should express that in its require-dev section, and DrupalCI will update that dependency.

https://cgit.drupalcode.org/group/tree/composer.json

You can add that require-dev as part of the patch in this case and it should be picked up by the testbots.

    "require-dev": {
        "phpspec/prophecy": "^1.7.6",
    },

Let me know if this addresses your issue.

kristiaanvandeneynde’s picture

Status: Postponed (maintainer needs more info) » Fixed

Cool, thanks! Was looking for a composer.lock file in the core folder but couldn't find one. Didn't think to look in the root folder as the prophecy dependency isn't specified there, but in the core folder.

I'll use the old prophecy method for now as I'd rather not bloat my own composer.json file with dependencies that might someday collide with what core has.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.