Skip to content

[test] run FlashMessenger helper tests - #244

Open
falkenhawk wants to merge 2 commits into
masterfrom
fix-flashmessenger-tests
Open

falkenhawk wants to merge 2 commits into
masterfrom
fix-flashmessenger-tests

Conversation

@falkenhawk

@falkenhawk falkenhawk commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

All 7 tests in FlashMessengerTest were skipped.

1) The whole class was skipped

setUp() skipped every test when headers were already sent, which is always the case when phpunit runs from the command line.
The tests do not need to send headers: tests/bootstrap.php runs Zend_Session in unit test mode, where Zend_Session::start() sends nothing.
The check is removed, together with the check for the session save path.

2) Three tests were always skipped

These three already called markTestSkipped() in ZF1. They failed because of the tests, not because of the helper:

  • testLoadFlashMessenger dispatched without a URL, so the router sent it to IndexController, where the view renderer found no view script. It now dispatches /helper-flash-messenger with the view renderer disabled, like FrontTest does.
  • testClearMessages and testDirectProxiesToAddMessage checked hasMessages() and count() right after addMessage(). But these report the messages of the previous request, while addMessage() stores a message for the next one. The test controller expects exactly that: count() === 0 and hasMessages() === false after addMessage(). testClearMessages now simulates the next request, like testSimulateCrossRequestMessagePassing does, and testDirectProxiesToAddMessage checks the current messages.

tearDown() now resets the static state of the helper, so messages do not leak between tests.
The helper itself works as the tests expect, so it is unchanged.

Ported from a private repository, based on work by @marcing.

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.

1 participant