|
Lines 98-104
subtest "get_daily_quote_for_interface" => sub {
Link Here
|
| 98 |
timestamp => DateTime::Format::MySQL->format_datetime(dt_from_string), |
98 |
timestamp => DateTime::Format::MySQL->format_datetime(dt_from_string), |
| 99 |
}; |
99 |
}; |
| 100 |
|
100 |
|
| 101 |
t::lib::Mocks::mock_preference('QuoteOfTheDay', ''); |
101 |
t::lib::Mocks::mock_preference('QuoteOfTheDay', 0); |
| 102 |
|
102 |
|
| 103 |
##Set interface and get nothing because syspref is not set. |
103 |
##Set interface and get nothing because syspref is not set. |
| 104 |
C4::Context->interface('opac'); |
104 |
C4::Context->interface('opac'); |
|
Lines 106-117
subtest "get_daily_quote_for_interface" => sub {
Link Here
|
| 106 |
ok(not($quote), "'QuoteOfTheDay'-syspref not set so nothing returned"); |
106 |
ok(not($quote), "'QuoteOfTheDay'-syspref not set so nothing returned"); |
| 107 |
|
107 |
|
| 108 |
##Set 'QuoteOfTheDay'-syspref to not include current interface 'opac' |
108 |
##Set 'QuoteOfTheDay'-syspref to not include current interface 'opac' |
| 109 |
t::lib::Mocks::mock_preference('QuoteOfTheDay', 'intra commandline sip2 api yo-mama'); |
109 |
t::lib::Mocks::mock_preference('QuoteOfTheDay', 'intranet'); |
| 110 |
$quote = Koha::Quote->get_daily_quote_for_interface(id => $quote_1->id); |
110 |
$quote = Koha::Quote->get_daily_quote_for_interface(id => $quote_1->id); |
| 111 |
ok(not($quote), "'QuoteOfTheDay'-syspref doesn't include 'opac'"); |
111 |
ok(not($quote), "'QuoteOfTheDay'-syspref doesn't include 'opac'"); |
| 112 |
|
112 |
|
| 113 |
##Set 'QuoteOfTheDay'-syspref to include current interface 'opac' |
113 |
##Set 'QuoteOfTheDay'-syspref to include current interface 'opac' |
| 114 |
t::lib::Mocks::mock_preference('QuoteOfTheDay', 'intraopaccommandline'); |
114 |
t::lib::Mocks::mock_preference('QuoteOfTheDay', 'opac,intranet'); |
| 115 |
$quote = Koha::Quote->get_daily_quote_for_interface(id => $quote_1->id); |
115 |
$quote = Koha::Quote->get_daily_quote_for_interface(id => $quote_1->id); |
| 116 |
is_deeply($quote, $expected_quote, "Got the expected quote"); |
116 |
is_deeply($quote, $expected_quote, "Got the expected quote"); |
| 117 |
|
117 |
|
| 118 |
- |
|
|