Skip to content

test: add testListenersOrder - #172

Merged
provokateurin merged 1 commit into
sabre-io:masterfrom
phil-davis:test-162
Jul 14, 2026
Merged

test: add testListenersOrder#172
provokateurin merged 1 commit into
sabre-io:masterfrom
phil-davis:test-162

Conversation

@phil-davis

@phil-davis phil-davis commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

This tests the change in #162 that makes sure not to sort listeners that are of equal priority, but to preserve the order in which they were created.

I ran these unit tests against the old code, and as expected, one of the test cases fails. The old code used to, somewhat accidentally, sort the events with the same priority into alphabetical order. We don't want or expect that to happen any more.

$ composer phpunit
PHPUnit 11.5.56 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.32
Configuration: /home/phil/git/sabre-io/event/tests/phpunit.xml

................................................................. 65 / 88 ( 73%)
......F................                                           88 / 88 (100%)

Time: 00:01.496, Memory: 10.00 MB

There was 1 failure:

1) Sabre\Event\WildcardEmitterTest::testListenersOrder with data set #1 ('bMethod', 'aMethod')
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     0 => Array (
         0 => Sabre\Event\WildcardEmitterTest Object ()
-        1 => 'bMethod'
+        1 => 'aMethod'
     )
     1 => Array (
         0 => Sabre\Event\WildcardEmitterTest Object ()
-        1 => 'aMethod'
+        1 => 'bMethod'
     )
 )

/home/phil/git/sabre-io/event/tests/Event/WildcardEmitterTest.php:67

FAILURES!
Tests: 88, Assertions: 144, Failures: 1.
Script phpunit --configuration tests/phpunit.xml handling the phpunit event returned with error code 1

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.17%. Comparing base (03ea383) to head (d985ad0).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #172   +/-   ##
=========================================
  Coverage     99.17%   99.17%           
  Complexity      111      111           
=========================================
  Files             7        7           
  Lines           364      364           
=========================================
  Hits            361      361           
  Misses            3        3           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This tests the change in sabre-io#162 that makes sure not to sort listeners
that are of equal priority, but to preserve the order in which they
were created.

Signed-off-by: Phillip Davis <phil@jankaritech.com>
@provokateurin
provokateurin merged commit e320d28 into sabre-io:master Jul 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants