@@ 108-118 (lines=11) @@ | ||
105 | /** |
|
106 | * Test the concat function |
|
107 | */ |
|
108 | public function testConcat() |
|
109 | { |
|
110 | $expected = 'test1 test2 test4'; |
|
111 | $test = MySQLite::mysql_concat("test1", " ", "test2", " ", "test4"); |
|
112 | $this->assertEquals($expected, $test); |
|
113 | ||
114 | $pdo = new PDO("sqlite::memory:", null, null, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); |
|
115 | MySQLite::createFunctions($pdo); |
|
116 | $result = $pdo->query('SELECT CONCAT("test1"," ","test2"," " ,"test4")')->fetch(PDO::FETCH_COLUMN); |
|
117 | $this->assertEquals($expected, $result); |
|
118 | } |
|
119 | ||
120 | /** |
|
121 | * Test the concat_ws function |
|
@@ 123-133 (lines=11) @@ | ||
120 | /** |
|
121 | * Test the concat_ws function |
|
122 | */ |
|
123 | public function testConcatWS() |
|
124 | { |
|
125 | $expected = 'test1|test2|test4'; |
|
126 | $test = MySQLite::mysql_concat_ws("|", "test1", "test2", "test4"); |
|
127 | $this->assertEquals($expected, $test); |
|
128 | ||
129 | $pdo = new PDO("sqlite::memory:", null, null, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); |
|
130 | MySQLite::createFunctions($pdo); |
|
131 | $result = $pdo->query('SELECT CONCAT_WS("|","test1","test2","test4")')->fetch(PDO::FETCH_COLUMN); |
|
132 | $this->assertEquals($expected, $result); |
|
133 | } |
|
134 | ||
135 | /** |
|
136 | * Test the rand function |