-warning_like { $output_for_invalid_date = output_pref( { str => 'invalid_date' } ) }
- { carped => qr[^Invalid date 'invalid_date' passed to output_pref] },
- 'output_pref should carp if an invalid date is passed for the str parameter';
-is( $output_for_invalid_date, undef, 'output_pref should return undef if an invalid date is passed' );
-warning_is { output_pref( { 'str' => $testdate_iso, dt => $dt, dateformat => 'iso', dateonly => 1 } ) }
- { carped => 'output_pref should not be called with both dt and str parameters' },
- 'output_pref should carp if str and dt parameters are passed together';
+try {
+ $output_for_invalid_date = output_pref({ str => 'invalid_date' });
+ ok( 0, 'Invalid date string passed to output_pref' );
+} catch {
+ is( ref($_), 'Koha::Exceptions::WrongParameter',
+ 'Invalid date string passed to output_pref' );
+};
+is( $output_for_invalid_date, undef, 'No return value from output_pref' );
+try {
+ output_pref({ 'str' => $testdate_iso, dt => $dt, dateformat => 'iso', dateonly => 1 });
+ ok( 0, 'output_pref should carp if str and dt parameters are passed together' );
+} catch {
+ is( ref($_), 'Koha::Exceptions::WrongParameter', 'output_pref should throw an exception if str and dt parameters are passed together' );
+};
+
+# End of tests