File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
tests/TestCase/Database/Type Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -79,4 +79,18 @@ public function newId()
79
79
{
80
80
return Text::uuid ();
81
81
}
82
+
83
+ /**
84
+ * Marshalls request data into a PHP string
85
+ *
86
+ * @param mixed $value The value to convert.
87
+ * @return string|null Converted value.
88
+ */
89
+ public function marshal ($ value )
90
+ {
91
+ if ($ value === null || $ value === '' ) {
92
+ return null ;
93
+ }
94
+ return (string )$ value ;
95
+ }
82
96
}
Original file line number Diff line number Diff line change @@ -91,4 +91,14 @@ public function testNewId()
91
91
$ this ->assertRegExp ('/^[a-f0-9-]+$/ ' , $ one , 'Should quack like a uuid ' );
92
92
$ this ->assertRegExp ('/^[a-f0-9-]+$/ ' , $ two , 'Should quack like a uuid ' );
93
93
}
94
+
95
+ /**
96
+ * Tests that marshalling an empty string results in null
97
+ *
98
+ * @return void
99
+ */
100
+ public function testMarshalEmptyString ()
101
+ {
102
+ $ this ->assertNull ($ this ->type ->marshal ('' ));
103
+ }
94
104
}
You can’t perform that action at this time.
0 commit comments