http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12167
--- Comment #26 from M. Tompsett <[email protected]> --- Created attachment 31139 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=31139&action=edit Bug 12167: Invalid results check for opac_news test C4/NewsChannels.pm has a function GetNewsToDisplay at the end of the file. It returns an array reference (i.e. one result). t/db_dependent/NewsChannels.t has a test which expects two values. This is likely a cut and paste error on my part. Notice get_opac_news returns an array of two things. TEST PLAN --------- 1) prove -v t/db_dependent/NewsChannels.t -- magically the wrong condition still passes. 2) apply this first patch only. 3) prove -v t/db_dependent/NewsChannels.t -- notice the second result value is UNDEFINED. -- notice the first result is an array reference. -- and the last test passes, because unless somehow the array reference was less than 2, it will pass. Signed-off-by: Bernardo Gonzalez Kriegel <[email protected]> Bug 12167: Bad expected results and condition check for GetNewsToDisplay This corrected the results expected to a single array reference. It then determines that it is defined and an array reference. And lastly, correct the logic that was supposed to check for valid results. TEST PLAN --------- 1) Apply patch 1 and 2. 2) prove -v t/db_dependent/NewsChannels.t -- all tests should pass -- note the test changes to verify correctly what should be tested for. Signed-off-by: Bernardo Gonzalez Kriegel <[email protected]> Bug 12167: Clean up GetNewsToDisplay This bug started out as a result of busting while in transitions of MySQL were happening in Ubuntu. However, I figured this fix should remove backtick MySQLisms as per http://wiki.koha-community.org/wiki/Coding_Guidelines#SQL6:_Backticks And clean up GetNewsToDisplay a bit. TEST PLAN --------- 1) News should function fine before applying any patches. 2) Apply all patches. 3) prove -v t/db_dependent/NewsChannels.t -- expecting all happy results. -- note the removal of backticks and the assumed typecasting of a timestamp to date. -- specified opac_news.timestamp to make sure that it would more likely parse as a fieldname and not as a keyword. Signed-off-by: Bernardo Gonzalez Kriegel <[email protected]> All patches applied, test pass, cleaner code, no regressions found, no koha-qa errors Bug 12167 - Made SQL even more ANSI SQL. The comparison against '00-00-0000' is not possible under PostgreSQL. By providing a database upgrade which replaces all '0000-00-00' dates with NULL, this portion of the SQL query can be removed. Additionally, MySQL can handle CURRENT_DATE(), but PostgreSQL barfs horribly. By removing the ()'s, it functions in both. The NewsChannels.t specifically added an explanationdate IS NULL case to catch what was not tested before. TEST PLAN --------- 1) Apply patch. 2) ./installer/data/mysql/updatedatabase.pl 3) prove -v t/db_dependent/NewsChannels.t -- This will confirm that the modified GetNewsToDisplay function has not broken. -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
