Bug 10666: avoid random failures of Daily quotes tests
authorFridolyn SOMERS <fridolyn.somers@biblibre.com>
Wed, 31 Jul 2013 09:39:45 +0000 (11:39 +0200)
committerBernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Fri, 13 Sep 2013 22:16:00 +0000 (19:16 -0300)
commitfb7c0d5a1afe23b2c7e1ebe09f48b522ac6821c5
tree88978de55c99bc7d0f0bbd47999c64d7e7c00725
parent5c32b6e383f02a81e8eed8d5462b0a8119696903
Bug 10666: avoid random failures of Daily quotes tests

In t/db_dependent/Koha.t, the test "Got a quote based on today's
date" is failing :

$prove t/db_dependent/Koha.t :
t/db_dependent/Koha.t .. 1/6
    #   Failed test 'Got a quote based on today's date.'
    #   at t/db_dependent/Koha.t line 126.
    # Compared $data->{"source"}
    #    got : 'Herbert Hoover'
    # expect : 'Abraham Lincoln'
    # Be sure to run this test on a clean install of sample data.
    # Looks like you failed 1 test of 4.

Looks like the wrong quote is returned by GetDailyQuote().
I'm using a databased created with the English sample SQL datas.

I think I found the cause :
The test "Got a random quote." calls GetDailyQuote('random'=>1) which
changes the quote timestamp to now. When then testing GetDailyQuote(),
this quote (which may not be the one created by test) is the most
recent quote.

This patch moves the "Got a random quote." test after "Got a quote
based on today's date" to solve the problem.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit b874f7d63894693c9c3f2a3d93ee119bc3b01486)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
(cherry picked from commit a37558cd6087a1945611161b09e923f79b60d6e1)
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
(cherry picked from commit a37558cd6087a1945611161b09e923f79b60d6e1)
t/db_dependent/Koha.t