|
92 | 92 | }); |
93 | 93 |
|
94 | 94 | it('specifies escape character in supported databases', function (string $dbDriver) { |
| 95 | + if ($dbDriver === 'mariadb' && ! in_array('mariadb', DB::supportedDrivers())) { |
| 96 | + $this->markTestSkipped('mariadb driver not supported in the installed version of illuminate/database dependency'); |
| 97 | + } |
| 98 | + |
95 | 99 | $fakeConnection = "test_{$dbDriver}"; |
96 | 100 |
|
97 | 101 | DB::connectUsing($fakeConnection, [ |
|
100 | 104 | ]); |
101 | 105 |
|
102 | 106 | DB::usingConnection($fakeConnection, function () use ($dbDriver) { |
| 107 | + |
103 | 108 | $request = new Request([ |
104 | 109 | 'filter' => ['name' => 'to_find'], |
105 | 110 | ]); |
|
108 | 113 | ->allowedFilters('name', 'id') |
109 | 114 | ->toSql(); |
110 | 115 |
|
111 | | - expect($queryBuilderSql)->when(in_array($dbDriver, ["sqlite","pgsql","sqlsrv"]), fn (Expectation $query) => $query->toContain("ESCAPE '\'")); |
112 | | - expect($queryBuilderSql)->when($dbDriver === 'mysql', fn (Expectation $query) => $query->not->toContain("ESCAPE '\'")); |
| 116 | + expect($queryBuilderSql)->when(in_array($dbDriver, ["sqlite","sqlsrv"]), fn (Expectation $query) => $query->toContain("ESCAPE '\'")); |
| 117 | + expect($queryBuilderSql)->when(in_array($dbDriver, ["mysql","mariadb", "pgsql"]), fn (Expectation $query) => $query->not->toContain("ESCAPE '\'")); |
113 | 118 | }); |
114 | | -})->with(['sqlite', 'mysql', 'pgsql', 'sqlsrv']); |
| 119 | +})->with(['sqlite', 'mysql', 'pgsql', 'sqlsrv', 'mariadb']); |
115 | 120 |
|
116 | 121 | it('can filter results based on the existence of a property in an array', function () { |
117 | 122 | $results = createQueryFromFilterRequest([ |
|
0 commit comments