t/XSLT.t should mock the DB
Created attachment 33633 [details] [review] Bug 13276: t/XSLT.t shouldn't depend on the DB To reproduce: - Stop your MySQL server: $ sudo service mysql stop - Run $ prove t/XSLT.t => FAIL: some tests fail because of mysql stopped To test (MySQL still stopped) - Apply the patch - Run $ prove t/XSLT.t => SUCCESS: tests pass because the ycan be loaded regardless of the absence of the DB server - Sign off :-D Regards
*Before* applying the patch: $ sudo koha-shell -c "prove t/XSLT.t" kohadev t/XSLT.t .. ok All tests successful. Files=1, Tests=8, 2 wallclock secs ( 0.02 usr 0.01 sys + 0.48 cusr 0.45 csys = 0.96 CPU) Result: PASS As far as I can tell, the patch adds mocking of C4::Context but never uses that for anything? Perhaps I am missing something but I'm setting this to Failed QA.
Before patch I get # Failed test 'use C4::XSLT;' # at t/XSLT.t line 14. # Tried to use 'C4::XSLT'. # Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at C4/Context.pm line 785. After the patch it works
Created attachment 33639 [details] [review] Bug 13276: t/XSLT.t shouldn't depend on the DB To reproduce: - Stop your MySQL server: $ sudo service mysql stop - Run $ prove t/XSLT.t => FAIL: some tests fail because of mysql stopped To test (MySQL still stopped) - Apply the patch - Run $ prove t/XSLT.t => SUCCESS: tests pass because the ycan be loaded regardless of the absence of the DB server - Sign off :-D Regards Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Created attachment 33640 [details] [review] [PASSED QA] Bug 13276: t/XSLT.t shouldn't depend on the DB To reproduce: - Stop your MySQL server: $ sudo service mysql stop - Run $ prove t/XSLT.t => FAIL: some tests fail because of mysql stopped To test (MySQL still stopped) - Apply the patch - Run $ prove t/XSLT.t => SUCCESS: tests pass because the ycan be loaded regardless of the absence of the DB server - Sign off :-D Regards Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Tests pass without db connection for me now.
Created attachment 33646 [details] [review] Bug 13276: use t::lib::Mocks::mock_dbh To use this patch, patch from bug 13274 should be applied too.
The last patch reintroduces the use_ok into the BEGIN block and use the mock subroutine introduced by the patch on bug 13274 comment 4. Feel free not to use/push it.
Patches pushed to master. Thanks Jonathan!