• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

saygoweb / anorm / 25294204668
97%

Build:
DEFAULT BRANCH: master
Ran 03 May 2026 11:43PM UTC
Jobs 1
Files 34
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

03 May 2026 11:42PM UTC coverage: 84.619% (+0.06%) from 84.558%
25294204668

push

github

web-flow
feat(lifecycle): allow listeners to call write() without re-invocation (#49)

* feat(lifecycle): allow listeners to call write() without re-invoking listener

A ChangeListener may now call DataMapper::write() — typically to persist a
follow-up record on a different table in response to a change. Nested writes
commit their SQL and refresh their own $_lastSnapshot, but do not re-invoke
the listener. Anorm assumes a single in-flight listener and suppresses
recursive notifications for any depth.

Previously, any write() call inside onWrite() raised
ReentrantWriteException, blocking the common "react to change by writing
elsewhere" pattern. The exception class is removed (3.1.x is unreleased,
so no BC obligation).

Implementation:

- DataMapper::write() drops the top-of-method re-entrancy throw.
- New $shouldNotify gate (= $hasListener && !$insideListener) controls
  the onWrite() dispatch, so nested writes still snapshot but skip the
  listener.
- The ReentrantWriteException catch arm is removed; only Throwable →
  error_log remains.

Tests in ChangeListenerTest replace the two re-entrancy assertions with
NestedWriteCommits (asserts both rows persist + nested snapshot is fresh)
and NestedWrite_DoesNotReinvokeListener (asserts callCount == 1).

* test(lifecycle): cover insideListener reset and diff null/array branches

Restores and extends the DataMapper test coverage that contracted when the
re-entrancy throw and its catch arm were removed. Coverage on src/DataMapper.php
goes from 183/189 (96.83%) to 185/189 (97.88%), exceeding the prior commit's
188/194 (96.91%).

New tests:

- testWrite_ListenerThrows_SubsequentWriteStillFiresListener: two consecutive
  writes through a listener that throws Throwable. Asserts callCount == 2,
  proving the finally block resets $insideListener even when the listener
  faults. Previously the throwing-listener test only did a single write, so
  this regression guard didn't exist.

- testWrite_AfterNestedWrite_OuterContinues... (continued)

6 of 6 new or added lines in 1 file covered. (100.0%)

1689 of 1996 relevant lines covered (84.62%)

17.36 hits per line

Jobs
ID Job ID Ran Files Coverage
1 25294204668.1 03 May 2026 11:42PM UTC 34
84.62
GitHub Action Run
Source Files on build 25294204668
  • Tree
  • List 34
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 13f7268f on github
  • Prev Build on master (#25251759671)
  • Next Build on master (#25304498901)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc