Bugzilla – Attachment 123855 Details for
Bug 24387
Rename News tool
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24387: Fix AdditionalContents.t
Bug-24387-Fix-AdditionalContentst.patch (text/plain), 3.59 KB, created by
Jonathan Druart
on 2021-08-16 13:19:28 UTC
(
hide
)
Description:
Bug 24387: Fix AdditionalContents.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-08-16 13:19:28 UTC
Size:
3.59 KB
patch
obsolete
>From e446dc10a30bbdedbae47b3a29f7ce2bdd97383a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 16 Aug 2021 13:59:09 +0200 >Subject: [PATCH] Bug 24387: Fix AdditionalContents.t > >--- > t/db_dependent/Koha/AdditionalContents.t | 48 +++++++++++++++++------- > 1 file changed, 35 insertions(+), 13 deletions(-) > >diff --git a/t/db_dependent/Koha/AdditionalContents.t b/t/db_dependent/Koha/AdditionalContents.t >index 0cbffac37cc..80fb4c60cf1 100755 >--- a/t/db_dependent/Koha/AdditionalContents.t >+++ b/t/db_dependent/Koha/AdditionalContents.t >@@ -39,16 +39,26 @@ subtest 'Koha::AdditionalContents basic test' => sub { > > my $library = $builder->build({ source => 'Branch'}); > my $nb_of_news = Koha::AdditionalContents->search->count; >- my $new_news_item_1 = Koha::AdditionalContent->new({ >- branchcode => $library->{branchcode}, >- title => 'a news', >- content => 'content for news 1', >- })->store; >- my $new_news_item_2 = Koha::AdditionalContent->new({ >- branchcode => $library->{branchcode}, >- title => 'another news', >- content => 'content for news 2', >- })->store; >+ my $new_news_item_1 = Koha::AdditionalContent->new( >+ { >+ category => 'news', >+ code => 'news_1', >+ location => 'staff_only', >+ branchcode => $library->{branchcode}, >+ title => 'a news', >+ content => 'content for news 1', >+ } >+ )->store; >+ my $new_news_item_2 = Koha::AdditionalContent->new( >+ { >+ category => 'news', >+ code => 'news_2', >+ location => 'staff_only', >+ branchcode => $library->{branchcode}, >+ title => 'another news', >+ content => 'content for news 2', >+ } >+ )->store; > > like( $new_news_item_1->idnew, qr|^\d+$|, 'Adding a new news_item should have set the idnew'); > is( Koha::AdditionalContents->search->count, $nb_of_news + 2, 'The 2 news should have been added' ); >@@ -130,6 +140,8 @@ subtest '->library' => sub { > subtest '->author' => sub { > plan tests => 3; > >+ $schema->storage->txn_begin; >+ > my $news_item = $builder->build_object({ class => 'Koha::AdditionalContents' }); > my $author = $news_item->author; > is( ref($author), 'Koha::Patron', 'Koha::AdditionalContent->author returns a Koha::Patron object' ); >@@ -139,11 +151,13 @@ subtest '->author' => sub { > $news_item = Koha::AdditionalContents->find($news_item->idnew); > is( ref($news_item), 'Koha::AdditionalContent', 'News are not deleted alongwith the author' ); > is( $news_item->author, undef, '->author returns undef is the author has been deleted' ); >+ >+ $schema->storage->txn_rollback; > }; > > subtest '->search_for_display' => sub { > >- plan tests => 13; >+ plan tests => 3; > > $schema->storage->txn_begin; > >@@ -227,9 +241,17 @@ subtest '->search_for_display' => sub { > number => 5, > } > }); >- my $news = Koha::AdditionalContents->search_for_display; > >- # FIXME Rewrite tests here >+ my $news = Koha::AdditionalContents->search_for_display({ location => 'staff_only' }); >+ is($news->count, 3, "There are 3 news for staff"); >+ >+ $news = Koha::AdditionalContents->search_for_display({ location => 'opac_only' }); >+ is($news->count, 0, "There are 0 news for OPAC"); >+ >+ $news = Koha::AdditionalContents->search_for_display({ location => 'staff_and_opac' }); >+ is($news->count, 1, "There is 1 news for staff and OPAC"); >+ >+ # TODO We should add more tests here > > $schema->storage->txn_rollback; > }; >-- >2.25.1
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 24387
:
122737
|
122738
|
122746
|
122748
|
122872
|
122873
|
122874
|
122878
|
122879
|
122880
|
123730
|
123731
|
123732
|
123733
|
123734
|
123795
|
123796
|
123797
|
123798
|
123803
|
123811
|
123854
| 123855 |
123856
|
124867
|
125545
|
142653