Bugzilla – Attachment 50178 Details for
Bug 15451
Move the CSV related code to Koha::CsvProfile[s]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15451: Add the 2 new modules Koha::CsvProfile[s]
Bug-15451-Add-the-2-new-modules-KohaCsvProfiles.patch (text/plain), 5.31 KB, created by
Jonathan Druart
on 2016-04-13 08:37:12 UTC
(
hide
)
Description:
Bug 15451: Add the 2 new modules Koha::CsvProfile[s]
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-04-13 08:37:12 UTC
Size:
5.31 KB
patch
obsolete
>From 189c9b0be140ae4bb04965d7f27fbe8edd4c5c51 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 31 Dec 2015 10:22:47 +0000 >Subject: [PATCH] Bug 15451: Add the 2 new modules Koha::CsvProfile[s] > >There are based on Koha::Objets. Tests provided. >--- > Koha/CsvProfile.pm | 44 ++++++++++++++++++++++++++++++ > Koha/CsvProfiles.pm | 50 ++++++++++++++++++++++++++++++++++ > t/db_dependent/Koha/CsvProfiles.t | 57 +++++++++++++++++++++++++++++++++++++++ > 3 files changed, 151 insertions(+) > create mode 100644 Koha/CsvProfile.pm > create mode 100644 Koha/CsvProfiles.pm > create mode 100644 t/db_dependent/Koha/CsvProfiles.t > >diff --git a/Koha/CsvProfile.pm b/Koha/CsvProfile.pm >new file mode 100644 >index 0000000..737aa32 >--- /dev/null >+++ b/Koha/CsvProfile.pm >@@ -0,0 +1,44 @@ >+package Koha::CsvProfile; >+ >+# 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, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use Carp; >+ >+use Koha::Database; >+ >+use base qw(Koha::Object); >+ >+=head1 NAME >+ >+Koha::CsvProfile - Koha Csv Profile Object class >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+=head3 _type >+ >+=cut >+ >+sub _type { >+ return 'ExportFormat'; >+} >+ >+1; >diff --git a/Koha/CsvProfiles.pm b/Koha/CsvProfiles.pm >new file mode 100644 >index 0000000..f55be00 >--- /dev/null >+++ b/Koha/CsvProfiles.pm >@@ -0,0 +1,50 @@ >+package Koha::CsvProfiles; >+ >+# 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, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use Carp; >+ >+use Koha::Database; >+ >+use Koha::CsvProfile; >+ >+use base qw(Koha::Objects); >+ >+=head1 NAME >+ >+Koha::CsvProfiles - Koha Csv Profile Object set class >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+=head3 _type >+ >+=cut >+ >+sub _type { >+ return 'ExportFormat'; >+} >+ >+sub object_class { >+ return 'Koha::CsvProfile'; >+} >+ >+1; >diff --git a/t/db_dependent/Koha/CsvProfiles.t b/t/db_dependent/Koha/CsvProfiles.t >new file mode 100644 >index 0000000..70c2201 >--- /dev/null >+++ b/t/db_dependent/Koha/CsvProfiles.t >@@ -0,0 +1,57 @@ >+#!/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 => 4; >+ >+use Koha::CsvProfile; >+use Koha::CsvProfiles; >+use Koha::Database; >+ >+use t::lib::TestBuilder; >+ >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+my $builder = t::lib::TestBuilder->new; >+my $nb_of_csv_profiles = Koha::CsvProfiles->search->count; >+my $new_csv_profile_1 = Koha::CsvProfile->new({ >+ profile => 'my_csv_profile_name_for_test_1', >+ description => 'my_csv_profile_description_for_test_1', >+ type => 'sql' >+})->store; >+my $new_csv_profile_2 = Koha::CsvProfile->new({ >+ profile => 'my_csv_profile_name_for_test_2', >+ description => 'my_csv_profile_description_for_test_2', >+ type => 'marc', >+})->store; >+ >+like( $new_csv_profile_1->export_format_id, qr|^\d+$|, 'Adding a new csv_profile should have set the export_format_id'); >+is( Koha::CsvProfiles->search->count, $nb_of_csv_profiles + 2, 'The 2 csv profiles should have been added' ); >+ >+my $retrieved_csv_profile_1 = Koha::CsvProfiles->find( $new_csv_profile_1->export_format_id ); >+is( $retrieved_csv_profile_1->profile, $new_csv_profile_1->profile, 'Find a csv_profile by id should return the correct csv_profile' ); >+ >+$retrieved_csv_profile_1->delete; >+is( Koha::CsvProfiles->search->count, $nb_of_csv_profiles + 1, 'Delete should have deleted the csv_profile' ); >+ >+$schema->storage->txn_rollback; >+ >+1; >-- >2.7.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 15451
:
46108
|
46109
|
46110
|
46111
|
46112
|
46113
|
46114
|
46306
|
50178
|
50179
|
50180
|
50181
|
50182
|
50183
|
50184
|
50185
|
50860
|
50861
|
50862
|
50863
|
50864
|
50865
|
50866
|
50867
|
50868
|
50985
|
53623
|
53624
|
53625
|
53626
|
53627
|
53628
|
53629
|
53630
|
53631
|
53641