Skip to content

Commit 8c20201

Browse files
authored
[9.x] Add tests for addIf() method on MessageBag (#41538)
1 parent 1c117ce commit 8c20201

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/Support/SupportMessageBagTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,17 @@ public function testHasIndicatesExistence()
115115
$this->assertFalse($container->has('bar'));
116116
}
117117

118+
public function testAddIf()
119+
{
120+
$container = new MessageBag;
121+
$container->setFormat(':message');
122+
$container->addIf(true, 'foo', 'bar');
123+
$this->assertTrue($container->has('foo'));
124+
125+
$container->addIf(false, 'bar', 'biz');
126+
$this->assertFalse($container->has('bar'));
127+
}
128+
118129
public function testHasWithKeyNull()
119130
{
120131
$container = new MessageBag;

0 commit comments

Comments
 (0)