diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/IndexOfTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/IndexOfTest.php index dcc3e1c48..1403ab698 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/IndexOfTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/IndexOfTest.php @@ -42,6 +42,18 @@ public function test_index_of() : void ); } + public function test_needle_null_index_of_returns_false() : void + { + self::assertFalse( + ref('str')->indexOf(ref('needle'))->eval( + row( + str_entry('str', 'x'), + str_entry('needle', null) + ) + ) + ); + } + public function test_returns_method_returns_string_int() : void { $indexOf = new IndexOf('Abba', 'b', offset: 3); @@ -51,4 +63,15 @@ public function test_returns_method_returns_string_int() : void self::assertTrue($returnType->isEqual(type_int())); } + + public function test_string_null_index_of_returns_false() : void + { + self::assertFalse( + ref('str')->indexOf('x')->eval( + row( + str_entry('str', null), + ) + ) + ); + } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/IsUtf8Test.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/IsUtf8Test.php index 66d2889b1..dca635d67 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/IsUtf8Test.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/IsUtf8Test.php @@ -12,6 +12,17 @@ final class IsUtf8Test extends FlowTestCase { + public function test_is_utf8_returns_null() : void + { + self::assertNull( + ref('str')->isUtf8()->eval( + row( + str_entry('str', null), + ) + ) + ); + } + public function test_is_utf_8() : void { self::assertTrue( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringAfterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringAfterTest.php index f556769fc..569f76125 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringAfterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringAfterTest.php @@ -6,7 +6,7 @@ use function Flow\ETL\DSL\row; use function Flow\ETL\DSL\{ref, str_entry, type_string}; -use Flow\ETL\Function\StringTitle; +use Flow\ETL\Function\{StringAfter}; use Flow\ETL\PHP\Type\Type; use Flow\ETL\Tests\FlowTestCase; @@ -14,8 +14,8 @@ final class StringAfterTest extends FlowTestCase { public function test_returns_method_returns_string_type() : void { - $stringTitleFunction = new StringTitle('str'); - $returnType = $stringTitleFunction->returns(); + $stringAfterFunction = new StringAfter('test', 'e'); + $returnType = $stringAfterFunction->returns(); self::assertInstanceOf(Type::class, $returnType); @@ -57,4 +57,15 @@ public function test_string_after_including_needle() : void ) ); } + + public function test_string_after_returns_null() : void + { + self::assertNull( + ref('str')->stringAfter('x')->eval( + row( + str_entry('str', null), + ) + ) + ); + } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringFoldTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringFoldTest.php index 5721d611a..70577fbe0 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringFoldTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringFoldTest.php @@ -5,11 +5,23 @@ namespace Flow\ETL\Tests\Unit\Function; use function Flow\ETL\DSL\row; -use function Flow\ETL\DSL\{ref, str_entry}; +use function Flow\ETL\DSL\{ref, str_entry, type_string}; +use Flow\ETL\Function\StringFold; +use Flow\ETL\PHP\Type\Type; use Flow\ETL\Tests\FlowTestCase; final class StringFoldTest extends FlowTestCase { + public function test_returns_method_returns_string_type() : void + { + $stringFoldedFunction = new StringFold('str'); + $returnType = $stringFoldedFunction->returns(); + + self::assertInstanceOf(Type::class, $returnType); + + self::assertTrue($returnType->isEqual(type_string())); + } + public function test_string_folded() : void { self::assertSame( @@ -19,4 +31,15 @@ public function test_string_folded() : void ) ); } + + public function test_string_folded_returns_null() : void + { + self::assertNull( + ref('str')->stringFold()->eval( + row( + str_entry('str', null), + ) + ) + ); + } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringStyleTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringStyleTest.php index 5448c5e3e..e48405f21 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringStyleTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringStyleTest.php @@ -56,6 +56,17 @@ public function test_string_style_lower() : void ); } + public function test_string_style_returns_null() : void + { + self::assertNull( + ref('str')->stringStyle(StringStyles::LOWER)->eval( + row( + str_entry('str', null), + ) + ) + ); + } + public function test_string_style_snake() : void { self::assertSame( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringTitleTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringTitleTest.php index 766bc4102..92a6f68e5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringTitleTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/StringTitleTest.php @@ -41,4 +41,15 @@ public function test_string_title_allwords() : void ) ); } + + public function test_string_title_returns_null() : void + { + self::assertNull( + ref('str')->stringTitle()->eval( + row( + str_entry('str', null), + ) + ) + ); + } }