File tree Expand file tree Collapse file tree 6 files changed +93
-3
lines changed
src/core/etl/tests/Flow/ETL/Tests/Unit/Function Expand file tree Collapse file tree 6 files changed +93
-3
lines changed Original file line number Diff line number Diff line change @@ -51,4 +51,27 @@ public function test_returns_method_returns_string_int() : void
51
51
52
52
self ::assertTrue ($ returnType ->isEqual (type_int ()));
53
53
}
54
+
55
+ public function test_string_null_index_of_returns_false () : void
56
+ {
57
+ self ::assertFalse (
58
+ ref ('str ' )->indexOf ('x ' )->eval (
59
+ row (
60
+ str_entry ('str ' , null ),
61
+ )
62
+ )
63
+ );
64
+ }
65
+
66
+ public function test_needle_null_index_of_returns_false () : void
67
+ {
68
+ self ::assertFalse (
69
+ ref ('str ' )->indexOf (ref ('needle ' ))->eval (
70
+ row (
71
+ str_entry ('str ' , 'x ' ),
72
+ str_entry ('needle ' , null )
73
+ )
74
+ )
75
+ );
76
+ }
54
77
}
Original file line number Diff line number Diff line change @@ -36,4 +36,15 @@ public function test_returns_method_returns_string_boolean() : void
36
36
37
37
self ::assertTrue ($ returnType ->isEqual (type_boolean ()));
38
38
}
39
+
40
+ public function test_is_utf8_returns_null () : void
41
+ {
42
+ self ::assertNull (
43
+ ref ('str ' )->isUtf8 ()->eval (
44
+ row (
45
+ str_entry ('str ' , null ),
46
+ )
47
+ )
48
+ );
49
+ }
39
50
}
Original file line number Diff line number Diff line change 4
4
5
5
namespace Flow \ETL \Tests \Unit \Function ;
6
6
7
+ use Flow \ETL \Function \StringAfter ;
7
8
use function Flow \ETL \DSL \row ;
8
9
use function Flow \ETL \DSL \{ref , str_entry , type_string };
9
10
use Flow \ETL \Function \StringTitle ;
@@ -14,8 +15,8 @@ final class StringAfterTest extends FlowTestCase
14
15
{
15
16
public function test_returns_method_returns_string_type () : void
16
17
{
17
- $ stringTitleFunction = new StringTitle ( ' str ' );
18
- $ returnType = $ stringTitleFunction ->returns ();
18
+ $ stringAfterFunction = new StringAfter ( ' test ' , ' e ' );
19
+ $ returnType = $ stringAfterFunction ->returns ();
19
20
20
21
self ::assertInstanceOf (Type::class, $ returnType );
21
22
@@ -57,4 +58,15 @@ public function test_string_after_including_needle() : void
57
58
)
58
59
);
59
60
}
61
+
62
+ public function test_string_after_returns_null () : void
63
+ {
64
+ self ::assertFalse (
65
+ ref ('str ' )->stringAfter ('x ' )->eval (
66
+ row (
67
+ str_entry ('str ' , null ),
68
+ )
69
+ )
70
+ );
71
+ }
60
72
}
Original file line number Diff line number Diff line change 4
4
5
5
namespace Flow \ETL \Tests \Unit \Function ;
6
6
7
+ use Flow \ETL \Function \StringFold ;
8
+ use Flow \ETL \PHP \Type \Type ;
7
9
use function Flow \ETL \DSL \row ;
8
- use function Flow \ETL \DSL \{ref , str_entry };
10
+ use function Flow \ETL \DSL \{ref , str_entry , type_string };
9
11
use Flow \ETL \Tests \FlowTestCase ;
10
12
11
13
final class StringFoldTest extends FlowTestCase
12
14
{
15
+ public function test_returns_method_returns_string_type () : void
16
+ {
17
+ $ stringFoldedFunction = new StringFold ('str ' );
18
+ $ returnType = $ stringFoldedFunction ->returns ();
19
+
20
+ self ::assertInstanceOf (Type::class, $ returnType );
21
+
22
+ self ::assertTrue ($ returnType ->isEqual (type_string ()));
23
+ }
13
24
public function test_string_folded () : void
14
25
{
15
26
self ::assertSame (
@@ -19,4 +30,15 @@ public function test_string_folded() : void
19
30
)
20
31
);
21
32
}
33
+
34
+ public function test_string_folded_returns_null () : void
35
+ {
36
+ self ::assertNull (
37
+ ref ('str ' )->stringFold ()->eval (
38
+ row (
39
+ str_entry ('str ' , null ),
40
+ )
41
+ )
42
+ );
43
+ }
22
44
}
Original file line number Diff line number Diff line change @@ -85,4 +85,15 @@ public function test_string_style_upper() : void
85
85
)
86
86
);
87
87
}
88
+
89
+ public function test_string_style_returns_null () : void
90
+ {
91
+ self ::assertNull (
92
+ ref ('str ' )->stringStyle (StringStyles::LOWER )->eval (
93
+ row (
94
+ str_entry ('str ' , null ),
95
+ )
96
+ )
97
+ );
98
+ }
88
99
}
Original file line number Diff line number Diff line change @@ -41,4 +41,15 @@ public function test_string_title_allwords() : void
41
41
)
42
42
);
43
43
}
44
+
45
+ public function test_string_title_returns_null () : void
46
+ {
47
+ self ::assertNull (
48
+ ref ('str ' )->stringTitle ()->eval (
49
+ row (
50
+ str_entry ('str ' , null ),
51
+ )
52
+ )
53
+ );
54
+ }
44
55
}
You can’t perform that action at this time.
0 commit comments