Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

The getCurrentMessages method's logic #25

Open
panychek opened this issue Nov 9, 2019 · 1 comment
Open

The getCurrentMessages method's logic #25

panychek opened this issue Nov 9, 2019 · 1 comment

Comments

@panychek
Copy link

panychek commented Nov 9, 2019

Hi.

I understand the difference between the getMessages and getCurrentMessages methods and how they work, but I don't get why these "current" messages could be accessed on the second request even if we haven't really added anything during it.
Is this the expected behaviour? If so, what makes them "current" then?

Here's a test:

public function testCurrentMessages()
{
    $helper = new FlashMessenger();

    $this->assertFalse($helper->hasCurrentMessages()); // OK

    $helper->addMessage('foo');

    $this->assertTrue($helper->hasCurrentMessages()); // OK
    $this->assertFalse($helper->hasMessages()); // OK

    unset($helper);

    $helper2 = new FlashMessenger();

    $this->assertFalse($helper2->hasCurrentMessages()); // Failure
    $this->assertTrue($helper2->hasMessages()); // OK
}
@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-mvc-plugin-flashmessenger; a new issue has been opened at laminas/laminas-mvc-plugin-flashmessenger#1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants