Skip to content

Commit f21ca64

Browse files
authored
[9.x] Improve test for filled in Helpers (#43894)
* [9.x] Improve test for filled in Helpers * [9.x] Improve test for filled in Helpers
1 parent 5bba757 commit f21ca64

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/Support/SupportHelpersTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use ArrayAccess;
66
use ArrayIterator;
7+
use Countable;
78
use Illuminate\Contracts\Support\Htmlable;
89
use Illuminate\Support\Env;
910
use Illuminate\Support\Optional;
@@ -39,6 +40,21 @@ public function testClassBasename()
3940
$this->assertSame('Baz', class_basename('Baz'));
4041
}
4142

43+
public function testFilled()
44+
{
45+
$this->assertFalse(filled(null));
46+
$this->assertFalse(filled(''));
47+
$this->assertFalse(filled(' '));
48+
$this->assertTrue(filled(10));
49+
$this->assertTrue(filled(true));
50+
$this->assertTrue(filled(false));
51+
$this->assertTrue(filled(0));
52+
$this->assertTrue(filled(0.0));
53+
54+
$object = new SupportTestCountable();
55+
$this->assertFalse(filled($object));
56+
}
57+
4258
public function testValue()
4359
{
4460
$this->assertSame('foo', value('foo'));
@@ -903,3 +919,11 @@ public function getIterator(): Traversable
903919
return new ArrayIterator($this->items);
904920
}
905921
}
922+
923+
class SupportTestCountable implements Countable
924+
{
925+
public function count(): int
926+
{
927+
return 0;
928+
}
929+
}

0 commit comments

Comments
 (0)