From 48ec99e0fc4918428ed0811f72132fbe33ae1a6d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 25 Jun 2019 17:26:13 -0500 Subject: [PATCH] Bug 23152: Fix more pluralisation (and add tests) Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- Koha/Schema/Result/AuthHeader.pm | 2 +- Koha/Schema/Result/AuthorisedValueCategory.pm | 4 +++- Koha/Schema/Result/BiblioMetadata.pm | 3 +++ Koha/Schema/Result/Category.pm | 2 +- Koha/Schema/Result/City.pm | 4 +++- Koha/Schema/Result/OpacNews.pm | 2 +- Koha/Schema/Result/SubscriptionFrequency.pm | 2 +- Koha/Schema/Result/Subscriptionhistory.pm | 2 +- Koha/Schema/Result/TagsIndex.pm | 2 +- t/db_dependent/TestBuilder.t | 10 +++++++++- 10 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Koha/Schema/Result/AuthHeader.pm b/Koha/Schema/Result/AuthHeader.pm index 3b74969d76..d406e27128 100644 --- a/Koha/Schema/Result/AuthHeader.pm +++ b/Koha/Schema/Result/AuthHeader.pm @@ -129,7 +129,7 @@ sub koha_object_class { 'Koha::Authority'; } sub koha_objects_class { - 'Koha::Authoritys'; + 'Koha::Authorities'; } 1; diff --git a/Koha/Schema/Result/AuthorisedValueCategory.pm b/Koha/Schema/Result/AuthorisedValueCategory.pm index 7778ec25dc..fcbb25a832 100644 --- a/Koha/Schema/Result/AuthorisedValueCategory.pm +++ b/Koha/Schema/Result/AuthorisedValueCategory.pm @@ -100,6 +100,8 @@ __PACKAGE__->has_many( # Created by DBIx::Class::Schema::Loader v0.07045 @ 2016-08-30 11:59:31 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6vToj9pUcIv8Jio38rNE4g +sub koha_objects_class { + 'Koha::AuthorisedValueCategories'; +} -# You can replace this text with custom code or comments, and it will be preserved on regeneration 1; diff --git a/Koha/Schema/Result/BiblioMetadata.pm b/Koha/Schema/Result/BiblioMetadata.pm index 69de376066..aa1a7b25ee 100644 --- a/Koha/Schema/Result/BiblioMetadata.pm +++ b/Koha/Schema/Result/BiblioMetadata.pm @@ -136,6 +136,9 @@ __PACKAGE__->belongs_to( # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FJk/YOw8Y/QRmmPPL3G5qQ sub koha_object_class { + 'Koha::Biblio::Metadata'; +} +sub koha_objects_class { 'Koha::Biblio::Metadatas'; } diff --git a/Koha/Schema/Result/Category.pm b/Koha/Schema/Result/Category.pm index e00c54dbc1..cfe788ce6f 100644 --- a/Koha/Schema/Result/Category.pm +++ b/Koha/Schema/Result/Category.pm @@ -273,7 +273,7 @@ sub koha_object_class { 'Koha::Patron::Category'; } sub koha_objects_class { - 'Koha::Patron::Categorys'; + 'Koha::Patron::Categories'; } 1; diff --git a/Koha/Schema/Result/City.pm b/Koha/Schema/Result/City.pm index 9f9ce6bf81..f95b63076d 100644 --- a/Koha/Schema/Result/City.pm +++ b/Koha/Schema/Result/City.pm @@ -85,6 +85,8 @@ __PACKAGE__->set_primary_key("cityid"); # Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zEjfS65sp13yF7dH8/ojZQ +sub koha_objects_class { + 'Koha::Cities'; +} -# You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/Koha/Schema/Result/OpacNews.pm b/Koha/Schema/Result/OpacNews.pm index ef0183a287..c3906da824 100644 --- a/Koha/Schema/Result/OpacNews.pm +++ b/Koha/Schema/Result/OpacNews.pm @@ -175,7 +175,7 @@ sub koha_object_class { 'Koha::NewsItem'; } sub koha_objects_class { - 'Koha::NewsItems'; + 'Koha::News'; } 1; diff --git a/Koha/Schema/Result/SubscriptionFrequency.pm b/Koha/Schema/Result/SubscriptionFrequency.pm index 0c1bf7973f..90a0ba5dd7 100644 --- a/Koha/Schema/Result/SubscriptionFrequency.pm +++ b/Koha/Schema/Result/SubscriptionFrequency.pm @@ -115,7 +115,7 @@ sub koha_object_class { 'Koha::Subscription::Frequency'; } sub koha_objects_class { - 'Koha::Subscription::Frequencys'; + 'Koha::Subscription::Frequencies'; } 1; diff --git a/Koha/Schema/Result/Subscriptionhistory.pm b/Koha/Schema/Result/Subscriptionhistory.pm index a82341ea38..a7d44fca3a 100644 --- a/Koha/Schema/Result/Subscriptionhistory.pm +++ b/Koha/Schema/Result/Subscriptionhistory.pm @@ -108,7 +108,7 @@ sub koha_object_class { 'Koha::Subscription::History'; } sub koha_objects_class { - 'Koha::Subscription::Historys'; + 'Koha::Subscription::Histories'; } 1; diff --git a/Koha/Schema/Result/TagsIndex.pm b/Koha/Schema/Result/TagsIndex.pm index a8b9b7e7f5..acc98067ad 100644 --- a/Koha/Schema/Result/TagsIndex.pm +++ b/Koha/Schema/Result/TagsIndex.pm @@ -107,7 +107,7 @@ sub koha_object_class { 'Koha::Tags::Index'; } sub koha_objects_class { - 'Koha::Tags::Indexs'; + 'Koha::Tags::Indexes'; } 1; diff --git a/t/db_dependent/TestBuilder.t b/t/db_dependent/TestBuilder.t index 30ce677077..1e02e7145c 100644 --- a/t/db_dependent/TestBuilder.t +++ b/t/db_dependent/TestBuilder.t @@ -381,11 +381,19 @@ subtest 'build_object() tests' => sub { $module =~ s|^.*/(Koha.*)\.pm$|$1|; $module =~ s|/|::|g; next if $module eq 'Koha::Objects'; - eval "require $module";; + eval "require $module"; my $object = $builder->build_object( { class => $module } ); is( ref($object), $module->object_class, "Testing $module" ); eval {$object->get_from_storage}; is( $@, '', "Module $module should have koha_object[s]_class method if needed" ); + + # Testing koha_object_class and koha_objects_class + my $object_class = Koha::Object::_get_object_class($object->_result->result_class); + eval "require $object_class"; + is( $@, '', "Module $object_class should be defined"); + my $objects_class = Koha::Objects::_get_objects_class($object->_result->result_class); + eval "require $objects_class"; + is( $@, '', "Module $objects_class should be defined"); } }; -- 2.39.5