@@ -190,34 +190,8 @@ public function __construct($type) {
190
190
}
191
191
}
192
192
193
- trait Mock_Searchable {
194
- /**
195
- * Return items matching $match in column $column.
196
- *
197
- * @param mixed $match
198
- * @param string $column
199
- * @param bool $returnFirst
200
- * @return array|null
201
- */
202
- public static function getBy ($ match , $ column = 'id ' , $ returnFirst = false ) {
203
- $ results = [];
204
- foreach (static ::getDataset () as $ item ) {
205
- if (isset ($ item [$ column ]) && $ item [$ column ] === $ match ) {
206
- if ($ returnFirst ) {
207
- return $ item ;
208
- }
209
- $ results [] = $ item ;
210
- }
211
- }
212
- return $ returnFirst ? null : $ results ;
213
- }
214
-
215
- // Each class must implement this
216
- abstract protected static function getDataset ();
217
- }
218
-
219
193
class Mock_Searchable_Entity {
220
- use Mock_Searchable ;
194
+ use Searchable ;
221
195
222
196
private static $ testData = [
223
197
[
'id ' =>
1 ,
'name ' =>
'John Doe ' ,
'email ' =>
'[email protected] ' ,
'status ' =>
'active ' ,
'age ' =>
30 ],
@@ -256,7 +230,7 @@ public static function setTestData(array $data) {
256
230
}
257
231
258
232
class Mock_Empty_Searchable_Entity {
259
- use Mock_Searchable ;
233
+ use Searchable ;
260
234
261
235
protected static function getDataset () {
262
236
return [];
@@ -316,6 +290,7 @@ function error_resp($data) {
316
290
return $ pre ." BAD Error in IMAP command received by server. \r\n" ;
317
291
}
318
292
}
293
+ if (!class_exists ('Hm_Functions ' )) {
319
294
class Hm_Functions {
320
295
public static $ resource = false ;
321
296
public static $ rand_bytes = 'good ' ;
@@ -398,6 +373,7 @@ public static function stream_socket_enable_crypto($socket, $type) {
398
373
return true ;
399
374
}
400
375
}
376
+ }
401
377
function setup_db ($ config ) {
402
378
require_once __DIR__ .'/bootstrap.php ' ;
403
379
$ config ->set ('db_connection_type ' , env ('DB_CONNECTION_TYPE ' , 'host ' ));
0 commit comments