Problem/Motivation

Symfony\Contracts\EventDispatcher\EventDispatcher::dispatch() has an object return type hint from Symfony 5.

To prepare for this, we can return an object when mocking it with prophecy.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

catch created an issue. See original summary.

catch’s picture

Status: Active » Needs review
StatusFileSize
new1.5 KB

There may be more, but here's a start.

catch’s picture

StatusFileSize
new1.4 KB

Patch was stacked on the parent issue, this should be standalone.

catch’s picture

StatusFileSize
new2.17 KB

Not sure whether this will work, but trying to add the return type hint to the current version of the class, to see whether we can flush more out. If not, we should be able to do it via the Symfony 5 update in the parent issue.

The last submitted patch, 3: 3162008.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 4: test-only.patch, failed testing. View results

catch’s picture

Status: Needs work » Needs review
StatusFileSize
new2.21 KB
new1.45 KB

OK didn't find any other instances, but did find a missing use statement in the actual patch.

hardik_patel_12’s picture

StatusFileSize
new2.5 KB
new909 bytes

Changes needs to be done also in,

core/modules/layout_builder/tests/src/Kernel/LayoutBuilderElementTest.php 

-     $event_dispatcher = $this->prophesize(EventDispatcherInterface::class);
+    $event_dispatcher->dispatch(Argument::any(), Argument::any())->willReturn(new Event());
longwave’s picture

The event dispatcher isn't actually called in LayoutBuilderElementTest, it is only mocked to satisfy the constructor, so I am not sure #8 is required.

catch’s picture

hmm there's a test failure in SectionComponentTest (which I think we should update for here), but not LayoutBuilderElementTest.

https://dispatcher.drupalci.org/job/drupal_patches/55318/testReport/Layo...

catch’s picture

StatusFileSize
new1.45 KB

Re-uploading #7.

mikelutz’s picture

Status: Needs review » Needs work

We do need to update sectioncomponenttest here.

mikelutz’s picture

Status: Needs work » Needs review
StatusFileSize
new2.46 KB
new1.01 KB
longwave’s picture

Status: Needs review » Reviewed & tested by the community

Looks OK to me, this fixes the fails uncovered in #4.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 75acede and pushed to 9.1.x. Thanks!

  • alexpott committed 75acede on 9.1.x
    Issue #3162008 by catch, mikelutz, Hardik_Patel_12, longwave: Prepare...

Status: Fixed » Closed (fixed)

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