@@ -42,11 +42,23 @@ public function testIfTrueExpression()
42
42
->end ();
43
43
$ this ->assertFinalizedValueIs ('new_value ' , $ test );
44
44
45
+ $ test = $ this ->getTestBuilder ()
46
+ ->ifTrue (fn () => 1 )
47
+ ->then ($ this ->returnClosure ('new_value ' ))
48
+ ->end ();
49
+ $ this ->assertFinalizedValueIs ('new_value ' , $ test );
50
+
45
51
$ test = $ this ->getTestBuilder ()
46
52
->ifTrue (fn () => false )
47
53
->then ($ this ->returnClosure ('new_value ' ))
48
54
->end ();
49
55
$ this ->assertFinalizedValueIs ('value ' , $ test );
56
+
57
+ $ test = $ this ->getTestBuilder ()
58
+ ->ifTrue (fn () => 0 )
59
+ ->then ($ this ->returnClosure ('new_value ' ))
60
+ ->end ();
61
+ $ this ->assertFinalizedValueIs ('value ' , $ test );
50
62
}
51
63
52
64
public function testIfFalseExpression ()
@@ -58,16 +70,28 @@ public function testIfFalseExpression()
58
70
$ this ->assertFinalizedValueIs ('new_value ' , $ test , ['key ' => false ]);
59
71
60
72
$ test = $ this ->getTestBuilder ()
61
- ->ifFalse (fn () => true )
73
+ ->ifFalse (fn ($ v ) => ' value ' === $ v )
62
74
->then ($ this ->returnClosure ('new_value ' ))
63
75
->end ();
64
- $ this ->assertFinalizedValueIs ('new_value ' , $ test );
76
+ $ this ->assertFinalizedValueIs ('value ' , $ test );
65
77
66
78
$ test = $ this ->getTestBuilder ()
67
- ->ifFalse (fn () => false )
79
+ ->ifFalse (fn ($ v ) => 1 )
68
80
->then ($ this ->returnClosure ('new_value ' ))
69
81
->end ();
70
82
$ this ->assertFinalizedValueIs ('value ' , $ test );
83
+
84
+ $ test = $ this ->getTestBuilder ()
85
+ ->ifFalse (fn ($ v ) => 'other_value ' === $ v )
86
+ ->then ($ this ->returnClosure ('new_value ' ))
87
+ ->end ();
88
+ $ this ->assertFinalizedValueIs ('new_value ' , $ test );
89
+
90
+ $ test = $ this ->getTestBuilder ()
91
+ ->ifFalse (fn ($ v ) => 0 )
92
+ ->then ($ this ->returnClosure ('new_value ' ))
93
+ ->end ();
94
+ $ this ->assertFinalizedValueIs ('new_value ' , $ test );
71
95
}
72
96
73
97
public function testIfStringExpression ()
0 commit comments