The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Changes for version 2.000 - 2019-07-17

  • BREAKING CHANGE -- This release includes a bug fix to the library. It now tests queries more comprehensively (i.e. all queries).
    • You may find your tests now breaking when previously they didn't. If this happens, you always had inaccurate tests but Test::DBIC::ExpectedQueries didn't flag this up correctly.
    • This is the fault of this library, not your code. Sorry about that!
    • It is however your problem, and now you need to fix your tests.
    • If you need to make your tests pass immediately, pin the version to pre 2.000, e.g. if you have a "cpanfile" in your project:
      • requires "Test::DBIC::ExpectedQueries", "< 2.0";
    • The fix you need to make is that the library will now report queries that were supposed to run n times, but didn't run at all. Let's say you have the check:
      • { book_lender => { select => 1 } }
    • You might see failures for queries that were supposed to run n times, but didn't run at all, e.g.
      • Expected '1' inserts for table 'book_lender', got '0
    • Whether this is a problem or not depends on the situation. Either you're happy that you're not making any redundant queries because the information is cached or prefetched. Or this indicates a problem, because something that you thought happened isn't.
    • In the former case, a useful fix is to either remove the line or to relax the test:
      • { book_lender => { select => "<= 1" } }

Modules

Test that only expected DBIx::Class queries are run

Provides

in lib/Test/DBIC/ExpectedQueries/Query.pm