Skip to content

Commit

Permalink
Improve tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Lieberman <[email protected]>
  • Loading branch information
timdev committed Apr 15, 2021
1 parent 8f561c4 commit 22aafb1
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/FlashMessagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public function testCreationAggregatesThrowsExceptionIfInvalidNumberOfHops()
public function testFlashNowAcceptsZeroHops()
{
$flash = FlashMessages::createFromSession($this->session);
$flash->flashNow('test', 'value', 0);
$flash->flashNow('test', 'value');

$this->assertSame('value', $flash->getFlash('test'));
}
Expand All @@ -416,6 +416,20 @@ public function testFlashNowWithZeroHopsShouldNotSetValueToSession()
->method('set');

$flash = FlashMessages::createFromSession($this->session);
$flash->flashNow('test', 'value', 0);
$flash->flashNow('test', 'value');
}

public function testFlashNowWithNonzeroHopsShouldSetValueToSession()
{
$this->session
->expects($this->once())
->method('set')
->with(
FlashMessagesInterface::FLASH_NEXT,
['test' => ['value' => 'value', 'hops' => 1]]
);

$flash = FlashMessages::createFromSession($this->session);
$flash->flashNow('test', 'value', 1);
}
}

0 comments on commit 22aafb1

Please sign in to comment.