[Bug 10298] New: t::lib::Mocks tries to deal with syspref but doesn not manage to
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Bug ID: 10298 Summary: t::lib::Mocks tries to deal with syspref but doesn not manage to Classification: Unclassified Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Test Suite Assignee: gmcharlt@gmail.com Reporter: jonathan.druart@biblibre.com -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|gmcharlt@gmail.com |jonathan.druart@biblibre.co | |m -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 --- Comment #1 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 18301 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=18301&action=edit Bug 10298: Mock C4::Context->preference t::lib::Mocks::Context tried to deal with preferences but did not manage to. This patch removes this module and add 2 routines in t::lib::Mocks in order to mock C4::context->preference and C4::Context->config. To test: ===START t/test.pl=== use Modern::Perl; use t::lib::Mocks; use C4::Context; say "initial value for version: " . C4::Context->preference('Version'); say "initial value for language: " . C4::Context->preference('language'); t::lib::Mocks::mock_preference('Version', "new version for testing"); say "version is mocked with: " . C4::Context->preference('Version'); say "language is not yet mocked: " . C4::Context->preference('language'); t::lib::Mocks::mock_preference('language', 'new langage for testing'); t::lib::Mocks::mock_preference('Version', 'another version for testing'); say "version is mocked with another value: " . C4::Context->preference('Version'); say "language is finally mocked: " . C4::Context->preference('language'); ===END=== Try to execute this file and check that the output is consistent. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 --- Comment #2 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 18302 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=18302&action=edit Bug 10298: Adapt existing code set_solr and set_zebra is not really useful. It is preferable to use mock_preference directly. To test: 1/ Launch Solr 2/ prove -r t/searchengine/ It should produce: % prove -r t/searchengine/ t/searchengine/000_conn/conn.t ........... ok t/searchengine/001_search/search_base.t .. ok t/searchengine/002_index/index_base.t .... IndexRecord called with biblio 2 Indexing biblio 2 t/searchengine/002_index/index_base.t .... ok t/searchengine/003_query/buildquery.t .... ok t/searchengine/004_config/load_config.t .. ok All tests successful. Files=5, Tests=21, 4 wallclock secs ( 0.03 usr 0.01 sys + 2.74 cusr 0.20 csys = 2.98 CPU) Result: PASS -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 --- Comment #3 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 18376 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=18376&action=edit Bug 10298: Followup: Adapt existing code This unit tests file does not need the t::lib::Mocks::Context module. To test: prove t/db_dependent/Circulation_issuingrules.t -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |10337 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |8304 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #18301|0 |1 is obsolete| | --- Comment #4 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 18504 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=18504&action=edit Bug 10298: Mock C4::Context->preference t::lib::Mocks::Context tried to deal with preferences but did not manage to. This patch removes this module and add 2 routines in t::lib::Mocks in order to mock C4::context->preference and C4::Context->config. To test: ===START t/test.pl=== use Modern::Perl; use t::lib::Mocks; use C4::Context; say "initial value for version: " . C4::Context->preference('Version'); say "initial value for language: " . C4::Context->preference('language'); t::lib::Mocks::mock_preference('Version', "new version for testing"); say "version is mocked with: " . C4::Context->preference('Version'); say "language is not yet mocked: " . C4::Context->preference('language'); t::lib::Mocks::mock_preference('language', 'new langage for testing'); t::lib::Mocks::mock_preference('Version', 'another version for testing'); say "version is mocked with another value: " . C4::Context->preference('Version'); say "language is finally mocked: " . C4::Context->preference('language'); ===END=== Try to execute this file and check that the output is consistent. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |julian.maurice@biblibre.com --- Comment #5 from Julian Maurice <julian.maurice@biblibre.com> --- $ prove -r t/searchengine t/searchengine/000_conn/conn.t ........... ok t/searchengine/001_search/search_base.t .. ok t/searchengine/002_index/index_base.t .... IndexRecord called with biblio 2 at /home/koha/src/Koha/SearchEngine/Solr/Index.pm line 35. t/searchengine/002_index/index_base.t .... ok t/searchengine/003_query/buildquery.t .... ok t/searchengine/004_config/load_config.t .. ok All tests successful. $ prove t/db_dependent/Circulation_issuingrules.t t/db_dependent/Circulation_issuingrules.t .. ok All tests successful. $ perl <<EOF use Modern::Perl; use t::lib::Mocks; use C4::Context; say "initial value for version: " . C4::Context->preference('Version'); say "initial value for language: " . C4::Context->preference('language'); t::lib::Mocks::mock_preference('Version', "new version for testing"); say "version is mocked with: " . C4::Context->preference('Version'); say "language is not yet mocked: " . C4::Context->preference('language'); t::lib::Mocks::mock_preference('language', 'new langage for testing'); t::lib::Mocks::mock_preference('Version', 'another version for testing'); say "version is mocked with another value: " . C4::Context->preference('Version'); say "language is finally mocked: " . C4::Context->preference('language'); EOF initial value for version: 3.1300007 initial value for language: en,fr-FR version is mocked with: new version for testing language is not yet mocked: en,fr-FR version is mocked with another value: another version for testing language is finally mocked: new langage for testing I know these are BibLibre patches but mock_config and mock_preference will be more and more needed in the future to write unit tests and this does not affect Koha behaviour, so I think a QA review will be good enough for those patches to pass. Signed off. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #18504|0 |1 is obsolete| | --- Comment #6 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 19009 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=19009&action=edit [SIGNED-OFF] Bug 10298: Mock C4::Context->preference -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #18302|0 |1 is obsolete| | --- Comment #7 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 19010 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=19010&action=edit [SIGNED-OFF] Bug 10298: Adapt existing code -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #18376|0 |1 is obsolete| | --- Comment #8 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 19011 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=19011&action=edit [SIGNED-OFF] Bug 10298: Followup: Adapt existing code -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Needs Signoff CC| |katrin.fischer@bsz-bw.de --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I am a bit torn here. While I don't doubt Julian's sign-off, we have set up the rules to be apply to all. For this reason only, I would like to see another sign-off here. Please don't take it personally, as it's not meant to be. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #19009|0 |1 is obsolete| | --- Comment #10 from Chris Cormack <chris@bigballofwax.co.nz> --- Created attachment 20206 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=20206&action=edit Bug 10298: Mock C4::Context->preference t::lib::Mocks::Context tried to deal with preferences but did not manage to. This patch removes this module and add 2 routines in t::lib::Mocks in order to mock C4::context->preference and C4::Context->config. To test: ===START t/test.pl=== use Modern::Perl; use t::lib::Mocks; use C4::Context; say "initial value for version: " . C4::Context->preference('Version'); say "initial value for language: " . C4::Context->preference('language'); t::lib::Mocks::mock_preference('Version', "new version for testing"); say "version is mocked with: " . C4::Context->preference('Version'); say "language is not yet mocked: " . C4::Context->preference('language'); t::lib::Mocks::mock_preference('language', 'new langage for testing'); t::lib::Mocks::mock_preference('Version', 'another version for testing'); say "version is mocked with another value: " . C4::Context->preference('Version'); say "language is finally mocked: " . C4::Context->preference('language'); ===END=== Try to execute this file and check that the output is consistent. Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #19010|0 |1 is obsolete| | --- Comment #11 from Chris Cormack <chris@bigballofwax.co.nz> --- Created attachment 20207 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=20207&action=edit Bug 10298: Adapt existing code set_solr and set_zebra is not really useful. It is preferable to use mock_preference directly. To test: 1/ Launch Solr 2/ prove -r t/searchengine/ It should produce: % prove -r t/searchengine/ t/searchengine/000_conn/conn.t ........... ok t/searchengine/001_search/search_base.t .. ok t/searchengine/002_index/index_base.t .... IndexRecord called with biblio 2 Indexing biblio 2 t/searchengine/002_index/index_base.t .... ok t/searchengine/003_query/buildquery.t .... ok t/searchengine/004_config/load_config.t .. ok All tests successful. Files=5, Tests=21, 4 wallclock secs ( 0.03 usr 0.01 sys + 2.74 cusr 0.20 csys = 2.98 CPU) Result: PASS Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Had to get Solr going again to test this, man .. they could make that easier -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #19011|0 |1 is obsolete| | Attachment #20206|0 |1 is obsolete| | Attachment #20207|0 |1 is obsolete| | --- Comment #12 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 20232 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=20232&action=edit Bug 10298: Followup: Adapt existing code This unit tests file does not need the t::lib::Mocks::Context module. To test: prove t/db_dependent/Circulation_issuingrules.t Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Passes koha-qa.pl, test checks out. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 --- Comment #13 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 20233 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=20233&action=edit Bug 10298: Mock C4::Context->preference t::lib::Mocks::Context tried to deal with preferences but did not manage to. This patch removes this module and add 2 routines in t::lib::Mocks in order to mock C4::context->preference and C4::Context->config. To test: ===START t/test.pl=== use Modern::Perl; use t::lib::Mocks; use C4::Context; say "initial value for version: " . C4::Context->preference('Version'); say "initial value for language: " . C4::Context->preference('language'); t::lib::Mocks::mock_preference('Version', "new version for testing"); say "version is mocked with: " . C4::Context->preference('Version'); say "language is not yet mocked: " . C4::Context->preference('language'); t::lib::Mocks::mock_preference('language', 'new langage for testing'); t::lib::Mocks::mock_preference('Version', 'another version for testing'); say "version is mocked with another value: " . C4::Context->preference('Version'); say "language is finally mocked: " . C4::Context->preference('language'); ===END=== Try to execute this file and check that the output is consistent. Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 --- Comment #14 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 20234 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=20234&action=edit Bug 10298: Adapt existing code set_solr and set_zebra is not really useful. It is preferable to use mock_preference directly. To test: 1/ Launch Solr 2/ prove -r t/searchengine/ It should produce: % prove -r t/searchengine/ t/searchengine/000_conn/conn.t ........... ok t/searchengine/001_search/search_base.t .. ok t/searchengine/002_index/index_base.t .... IndexRecord called with biblio 2 Indexing biblio 2 t/searchengine/002_index/index_base.t .... ok t/searchengine/003_query/buildquery.t .... ok t/searchengine/004_config/load_config.t .. ok All tests successful. Files=5, Tests=21, 4 wallclock secs ( 0.03 usr 0.01 sys + 2.74 cusr 0.20 csys = 2.98 CPU) Result: PASS Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Had to get Solr going again to test this, man .. they could make that easier Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Galen Charlton <gmcharlt@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |gmcharlt@gmail.com --- Comment #15 from Galen Charlton <gmcharlt@gmail.com> --- Pushed to master. Thanks, Jonathan! -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |10843 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable CC| |tomascohen@gmail.com --- Comment #16 from Tomás Cohen Arazi <tomascohen@gmail.com> --- This patch has been pushed to 3.12.x, will be in 3.12.8. Thanks Jonathan! -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Stable |RESOLVED CC| |chris@bigballofwax.co.nz Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org