@@ -148,12 +148,13 @@ public function testOnlyDeleted(): void
148148 }
149149
150150 /**
151- * If where condition is set, beyond the value was empty (0,'', NULL, etc.),
152- * Exception should not be thrown because condition was explicity set
151+ * Given an explicit empty value in the WHERE condition
152+ * When executing a soft delete
153+ * Then an exception should not be thrown
153154 *
154155 * @dataProvider emptyPkValues
155156 *
156- * @param mixed $emptyValue
157+ * @param int|string|null $emptyValue
157158 */
158159 public function testDontThrowExceptionWhenSoftDeleteConditionIsSetWithEmptyValue ($ emptyValue ): void
159160 {
@@ -167,30 +168,33 @@ public function testDontThrowExceptionWhenSoftDeleteConditionIsSetWithEmptyValue
167168 /**
168169 * @dataProvider emptyPkValues
169170 *
170- * @param mixed $emptyValue
171+ * @param int|string|null $emptyValue
171172 */
172173 public function testThrowExceptionWhenSoftDeleteParamIsEmptyValue ($ emptyValue ): void
173174 {
174175 $ this ->expectException (DatabaseException::class);
175176 $ this ->expectExceptionMessage ('Deletes are not allowed unless they contain a "where" or "like" clause. ' );
176177
177178 $ this ->seeInDatabase ('user ' , ['name ' => 'Derek Jones ' , 'deleted_at IS NULL ' => null ]);
179+
178180 $ this ->createModel (UserModel::class)->delete ($ emptyValue );
179181 }
180182
181183 /**
182184 * @dataProvider emptyPkValues
183185 *
184- * @param mixed $emptyValue
186+ * @param int|string|null $emptyValue
185187 */
186188 public function testDontDeleteRowsWhenSoftDeleteParamIsEmpty ($ emptyValue ): void
187189 {
188- $ this ->expectException (DatabaseException::class);
189- $ this ->expectExceptionMessage ('Deletes are not allowed unless they contain a "where" or "like" clause. ' );
190-
191190 $ this ->seeInDatabase ('user ' , ['name ' => 'Derek Jones ' , 'deleted_at IS NULL ' => null ]);
192191
193- $ this ->createModel (UserModel::class)->delete ($ emptyValue );
192+ try {
193+ $ this ->createModel (UserModel::class)->delete ($ emptyValue );
194+ } catch (DatabaseException $ e ) {
195+ // Do nothing.
196+ }
197+
194198 $ this ->seeInDatabase ('user ' , ['name ' => 'Derek Jones ' , 'deleted_at IS NULL ' => null ]);
195199 }
196200
0 commit comments