Skip to content

The getCurrentMessages method's logic #1

@weierophinney

Description

@weierophinney

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
}

Originally posted by @panychek at zendframework/zend-mvc-plugin-flashmessenger#25

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions