From 567fb47573043ba865fd39c8a6a3d6ec00cb6200 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Thu, 22 Apr 2021 23:41:06 +0100 Subject: [PATCH] Adds tests to "whenNotEmpty" --- tests/Support/SupportStringableTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/Support/SupportStringableTest.php b/tests/Support/SupportStringableTest.php index 70916a0458b9..6ab7d65c5b55 100644 --- a/tests/Support/SupportStringableTest.php +++ b/tests/Support/SupportStringableTest.php @@ -109,6 +109,23 @@ public function testWhenEmpty() })); } + public function testWhenNotEmpty() + { + tap($this->stringable(), function ($stringable) { + $this->assertSame($stringable, $stringable->whenNotEmpty(function ($stringable) { + return $stringable.'.'; + })); + }); + + $this->assertSame('', (string) $this->stringable()->whenNotEmpty(function ($stringable) { + return $stringable.'.'; + })); + + $this->assertSame('Not empty.', (string) $this->stringable('Not empty')->whenNotEmpty(function ($stringable) { + return $stringable.'.'; + })); + } + public function testWhenFalse() { $this->assertSame('when', (string) $this->stringable('when')->when(false, function ($stringable, $value) {