@@ -1905,6 +1905,114 @@ public function count(): int
19051905
19061906 $ this ->assertSame ('UserGroups ' , Str::pluralPascal ('UserGroup ' , $ countable ));
19071907 }
1908+
1909+ #[DataProvider('nullOrEmptyProvider ' )]
1910+ public function testNullOrEmpty ($ value , $ expected )
1911+ {
1912+ $ this ->assertEquals ($ expected , Str::nullOrEmpty ($ value ));
1913+ }
1914+
1915+ #[DataProvider('notNullOrEmptyProvider ' )]
1916+ public function testNotNullOrEmpty ($ value , $ expected )
1917+ {
1918+ $ this ->assertEquals ($ expected , Str::notNullOrEmpty ($ value ));
1919+ }
1920+
1921+ #[DataProvider('nullOrWhitespaceProvider ' )]
1922+ public function testNullOrWhitespace ($ value , $ expected )
1923+ {
1924+ $ this ->assertEquals ($ expected , Str::nullOrWhitespace ($ value ));
1925+ }
1926+
1927+ #[DataProvider('notNullOrWhitespaceProvider ' )]
1928+ public function testNotNullOrWhitespace ($ value , $ expected )
1929+ {
1930+ $ this ->assertEquals ($ expected , Str::notNullOrWhitespace ($ value ));
1931+ }
1932+
1933+ public static function nullOrEmptyProvider ()
1934+ {
1935+ return [
1936+ 'null value ' => [null , true ],
1937+ 'empty string ' => ['' , true ],
1938+ 'single space ' => [' ' , false ],
1939+ 'multiple spaces ' => [' ' , false ],
1940+ 'tab character ' => ["\t" , false ],
1941+ 'newline character ' => ["\n" , false ],
1942+ 'zero string ' => ['0 ' , false ],
1943+ 'simple text ' => ['hello ' , false ],
1944+ 'text with spaces ' => ['hello world ' , false ],
1945+ 'single character ' => ['a ' , false ],
1946+ 'number string ' => ['123 ' , false ],
1947+ 'special characters ' => ['!@#$ ' , false ],
1948+ ];
1949+ }
1950+
1951+ public static function notNullOrEmptyProvider ()
1952+ {
1953+ return [
1954+ 'null value ' => [null , false ],
1955+ 'empty string ' => ['' , false ],
1956+ 'single space ' => [' ' , true ],
1957+ 'multiple spaces ' => [' ' , true ],
1958+ 'tab character ' => ["\t" , true ],
1959+ 'newline character ' => ["\n" , true ],
1960+ 'zero string ' => ['0 ' , true ],
1961+ 'simple text ' => ['hello ' , true ],
1962+ 'text with spaces ' => ['hello world ' , true ],
1963+ 'single character ' => ['a ' , true ],
1964+ 'number string ' => ['123 ' , true ],
1965+ 'special characters ' => ['!@#$ ' , true ],
1966+ ];
1967+ }
1968+
1969+ public static function nullOrWhitespaceProvider ()
1970+ {
1971+ return [
1972+ 'null value ' => [null , true ],
1973+ 'empty string ' => ['' , true ],
1974+ 'single space ' => [' ' , true ],
1975+ 'multiple spaces ' => [' ' , true ],
1976+ 'tab character ' => ["\t" , true ],
1977+ 'newline character ' => ["\n" , true ],
1978+ 'carriage return ' => ["\r" , true ],
1979+ 'mixed whitespace ' => [" \t\n\r " , true ],
1980+ 'zero string ' => ['0 ' , false ],
1981+ 'simple text ' => ['hello ' , false ],
1982+ 'text with spaces ' => ['hello world ' , false ],
1983+ 'text with leading space ' => [' hello ' , false ],
1984+ 'text with trailing space ' => ['hello ' , false ],
1985+ 'text with surrounding spaces ' => [' hello ' , false ],
1986+ 'single character ' => ['a ' , false ],
1987+ 'number string ' => ['123 ' , false ],
1988+ 'special characters ' => ['!@#$ ' , false ],
1989+ 'whitespace with period ' => [' . ' , false ],
1990+ ];
1991+ }
1992+
1993+ public static function notNullOrWhitespaceProvider ()
1994+ {
1995+ return [
1996+ 'null value ' => [null , false ],
1997+ 'empty string ' => ['' , false ],
1998+ 'single space ' => [' ' , false ],
1999+ 'multiple spaces ' => [' ' , false ],
2000+ 'tab character ' => ["\t" , false ],
2001+ 'newline character ' => ["\n" , false ],
2002+ 'carriage return ' => ["\r" , false ],
2003+ 'mixed whitespace ' => [" \t\n\r " , false ],
2004+ 'zero string ' => ['0 ' , true ],
2005+ 'simple text ' => ['hello ' , true ],
2006+ 'text with spaces ' => ['hello world ' , true ],
2007+ 'text with leading space ' => [' hello ' , true ],
2008+ 'text with trailing space ' => ['hello ' , true ],
2009+ 'text with surrounding spaces ' => [' hello ' , true ],
2010+ 'single character ' => ['a ' , true ],
2011+ 'number string ' => ['123 ' , true ],
2012+ 'special characters ' => ['!@#$ ' , true ],
2013+ 'whitespace with period ' => [' . ' , true ],
2014+ ];
2015+ }
19082016}
19092017
19102018class StringableObjectStub
0 commit comments