Skip to content

Commit 58a6d2d

Browse files
authored
Adds tests to "whenNotEmpty" (#37091)
1 parent 8765ffe commit 58a6d2d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/Support/SupportStringableTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,23 @@ public function testWhenEmpty()
109109
}));
110110
}
111111

112+
public function testWhenNotEmpty()
113+
{
114+
tap($this->stringable(), function ($stringable) {
115+
$this->assertSame($stringable, $stringable->whenNotEmpty(function ($stringable) {
116+
return $stringable.'.';
117+
}));
118+
});
119+
120+
$this->assertSame('', (string) $this->stringable()->whenNotEmpty(function ($stringable) {
121+
return $stringable.'.';
122+
}));
123+
124+
$this->assertSame('Not empty.', (string) $this->stringable('Not empty')->whenNotEmpty(function ($stringable) {
125+
return $stringable.'.';
126+
}));
127+
}
128+
112129
public function testWhenFalse()
113130
{
114131
$this->assertSame('when', (string) $this->stringable('when')->when(false, function ($stringable, $value) {

0 commit comments

Comments
 (0)