Bugzilla – Attachment 22628 Details for
Bug 8435
new permissions on subscriptions "superserials"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8435: Fix unit tests
Bug-8435-Fix-unit-tests.patch (text/plain), 3.16 KB, created by
Jonathan Druart
on 2013-10-31 08:51:41 UTC
(
hide
)
Description:
Bug 8435: Fix unit tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-10-31 08:51:41 UTC
Size:
3.16 KB
patch
obsolete
>From c67a5c1885f2c9e1f459e86f21030bf5ecb8f545 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 31 Oct 2013 09:49:12 +0100 >Subject: [PATCH] Bug 8435: Fix unit tests > >C4::Serials::can_edit_subscription now deals with C4::Context->userenv. >--- > C4/Serials.pm | 1 + > t/db_dependent/Serials_2.t | 26 ++++++++++++++++---------- > 2 files changed, 17 insertions(+), 10 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 7c4bf82..da876e2 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -2805,6 +2805,7 @@ Return 1 if the subscription is editable by the current logged user (or a given > > sub can_edit_subscription { > my ( $subscription, $userid ) = @_; >+ return 0 unless C4::Context->userenv; > my $flags = C4::Context->userenv->{flags}; > $userid ||= C4::Context->userenv->{'id'}; > my $independent_branches = C4::Context->preference('IndependentBranches'); >diff --git a/t/db_dependent/Serials_2.t b/t/db_dependent/Serials_2.t >index 72d71d9..3d921b8 100644 >--- a/t/db_dependent/Serials_2.t >+++ b/t/db_dependent/Serials_2.t >@@ -1,10 +1,12 @@ > #!/usr/bin/perl > use Modern::Perl; > >-use Test::More tests => 4; >+use Test::More tests => 5; > > use MARC::Record; >+ > use C4::Biblio qw( AddBiblio ); >+use C4::Context; > use_ok('C4::Serials'); > use_ok('C4::Budgets'); > >@@ -12,6 +14,7 @@ my $dbh = C4::Context->dbh; > $dbh->{AutoCommit} = 0; > $dbh->{RaiseError} = 1; > >+ > my $supplierlist=eval{GetSuppliersWithLateIssues()}; > ok(length($@)==0,"No SQL problem in GetSuppliersWithLateIssues"); > >@@ -39,16 +42,19 @@ my $budget_id = AddBudget({ > }); > > my $subscriptionid = NewSubscription( >- undef, "", undef, undef, $budget_id, $biblionumber, '01-01-2013',undef, >- undef, undef, undef, undef, undef, undef, undef, undef, >- undef, undef, undef, undef, undef, undef, undef, undef, >- undef, undef, undef, undef, undef, undef, undef, 1, >- "notes", undef, undef, undef, undef, undef, undef, 0, >- "intnotes", 0, undef, undef, 0, undef, '12-31-2013', >+ undef, "", undef, undef, $budget_id, $biblionumber, >+ '2013-01-01', undef, undef, undef, undef, >+ undef, undef, undef, undef, undef, undef, >+ 1, "notes",undef, '2013-01-01', undef, undef, >+ undef, undef, 0, "intnotes", 0, >+ undef, undef, 0, undef, '2013-12-31', 0 > ); > die unless $subscriptionid; > >-# Can edit a subscription >+ >+my $subscription = GetSubscription( $subscriptionid ); >+is( C4::Serials::can_edit_subscription($subscription), 0, "cannot edit a subscription without userenv set"); >+ > my @USERENV = ( > 1, > 'test', >@@ -62,9 +68,9 @@ my @USERENV = ( > > C4::Context->_new_userenv ('DUMMY_SESSION_ID'); > C4::Context->set_userenv ( @USERENV ); >-my $userenv = C4::Context->userenv; > >-my $subscription = GetSubscription( $subscriptionid ); >+# Can edit a subscription >+my $userenv = C4::Context->userenv; > > is( C4::Serials::can_edit_subscription($subscription), 1, "User can edit a subscription with an empty branchcode"); > #TODO add UT when C4::Auth->set_permissions (or setuserflags) will exist. >-- >1.7.10.4
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 8435
:
10821
|
11377
|
11411
|
11892
|
13396
|
15673
|
16404
|
16462
|
16740
|
16750
|
16751
|
16798
|
16799
|
16801
|
16802
|
16803
|
16943
|
16944
|
19260
|
19261
|
19266
|
19268
|
20536
|
21286
|
21287
|
21288
|
21289
|
22624
|
22625
|
22626
|
22627
| 22628