Bugzilla – Attachment 45696 Details for
Bug 15084
Move the currency related code to Koha::Acquisition::Currenc[y|ies]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15084: Add tests for Koha::Acquisition::Currenc[y|ies]
Bug-15084-Add-tests-for-KohaAcquisitionCurrencyies.patch (text/plain), 2.93 KB, created by
Jonathan Druart
on 2015-12-15 10:27:43 UTC
(
hide
)
Description:
Bug 15084: Add tests for Koha::Acquisition::Currenc[y|ies]
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-12-15 10:27:43 UTC
Size:
2.93 KB
patch
obsolete
>From 15c5653bd9d798ae827c7a6911737876798d35c3 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 29 Oct 2015 14:54:40 +0000 >Subject: [PATCH] Bug 15084: Add tests for Koha::Acquisition::Currenc[y|ies] > >--- > t/db_dependent/Koha/Acquisition/Currencies.t | 58 ++++++++++++++++++++++++++++ > 1 file changed, 58 insertions(+) > create mode 100644 t/db_dependent/Koha/Acquisition/Currencies.t > >diff --git a/t/db_dependent/Koha/Acquisition/Currencies.t b/t/db_dependent/Koha/Acquisition/Currencies.t >new file mode 100644 >index 0000000..2abf992 >--- /dev/null >+++ b/t/db_dependent/Koha/Acquisition/Currencies.t >@@ -0,0 +1,58 @@ >+#!/usr/bin/perl >+ >+# Copyright 2015 Koha Development team >+# >+# This file is part of Koha >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use Test::More tests => 6; >+use Koha::Acquisition::Currency; >+use Koha::Acquisition::Currencies; >+use t::lib::TestBuilder; >+ >+my $builder = t::lib::TestBuilder->new; >+my $nb_of_currencies = Koha::Acquisition::Currencies->search->count; >+my $new_currency_1 = Koha::Acquisition::Currency->new({ >+ currency => 'my_cur_1', >+ symbol => 'symb1', >+ isocode => 'isoc1', >+ rate => 1, >+ active => 1, >+})->store; >+ >+my $retrieved_currency_1 = Koha::Acquisition::Currencies->find( $new_currency_1->currency ); >+is( $retrieved_currency_1->active, 1, 'Active should have been set to 1' ); >+ >+my $new_currency_2 = Koha::Acquisition::Currency->new({ >+ currency => 'my_cur_2', >+ symbol => 'symb2', >+ isocode => 'isoc2', >+ rate => 2, >+ active => 1, >+})->store; >+ >+is( Koha::Acquisition::Currencies->search->count, $nb_of_currencies + 2, 'The 2 currencies should have been added' ); >+my $retrieved_currency_2 = Koha::Acquisition::Currencies->find( $new_currency_2->currency ); >+is( $retrieved_currency_2->active, 1, 'Active should have been set to 1' ); >+ >+my $active_currency = Koha::Acquisition::Currencies->get_active; >+is ( $active_currency->currency, $retrieved_currency_2->currency, 'The active currency should be the last one marked as active' ); >+ >+my $nb_of_active_currencies = Koha::Acquisition::Currencies->search({active => 1})->count; >+is ( $nb_of_active_currencies, 1, 'Only 1 currency should be marked as active' ); >+ >+$retrieved_currency_1->delete; >+is( Koha::Acquisition::Currencies->search->count, $nb_of_currencies + 1, 'Delete should have deleted the currency' ); >-- >2.1.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15084
:
44162
|
44163
|
44164
|
44165
|
44166
|
44167
|
44168
|
45690
|
45691
|
45692
|
45693
|
45694
|
45695
|
45696
|
45759
|
45761
|
45807
|
45808
|
45809
|
45810
|
45811
|
45812
|
45813
|
45814
|
47213
|
47214
|
47215
|
47216
|
47217
|
47218
|
47219
|
47220
|
47221
|
48594
|
48595
|
48596
|
48597
|
48598
|
48599
|
48600
|
48601
|
48602
|
48603
|
48703
|
48747
|
48772
|
48783
|
48858