Lines 50-56
subtest 'CRUD' => sub {
Link Here
|
50 |
|
50 |
|
51 |
my $shelf = Koha::Virtualshelf->new({ |
51 |
my $shelf = Koha::Virtualshelf->new({ |
52 |
shelfname => "my first shelf", |
52 |
shelfname => "my first shelf", |
53 |
owner => $patron->{borrowernumber}, |
53 |
owner_id => $patron->{borrowernumber}, |
54 |
public => 0, |
54 |
public => 0, |
55 |
} |
55 |
} |
56 |
)->store; |
56 |
)->store; |
Lines 79-85
subtest 'CRUD' => sub {
Link Here
|
79 |
eval { |
79 |
eval { |
80 |
$shelf = Koha::Virtualshelf->new({ |
80 |
$shelf = Koha::Virtualshelf->new({ |
81 |
shelfname => "my first shelf", |
81 |
shelfname => "my first shelf", |
82 |
owner => $patron->{borrowernumber}, |
82 |
owner_id => $patron->{borrowernumber}, |
83 |
public => 0, |
83 |
public => 0, |
84 |
} |
84 |
} |
85 |
)->store; |
85 |
)->store; |
Lines 95-101
subtest 'CRUD' => sub {
Link Here
|
95 |
|
95 |
|
96 |
$shelf = Koha::Virtualshelf->new({ |
96 |
$shelf = Koha::Virtualshelf->new({ |
97 |
shelfname => "my first shelf", |
97 |
shelfname => "my first shelf", |
98 |
owner => $another_patron->{borrowernumber}, |
98 |
owner_id => $another_patron->{borrowernumber}, |
99 |
public => 0, |
99 |
public => 0, |
100 |
} |
100 |
} |
101 |
)->store; |
101 |
)->store; |
Lines 127-140
subtest 'Sharing' => sub {
Link Here
|
127 |
|
127 |
|
128 |
my $shelf_to_share = Koha::Virtualshelf->new({ |
128 |
my $shelf_to_share = Koha::Virtualshelf->new({ |
129 |
shelfname => "my first shelf", |
129 |
shelfname => "my first shelf", |
130 |
owner => $patron_wants_to_share->{borrowernumber}, |
130 |
owner_id => $patron_wants_to_share->{borrowernumber}, |
131 |
public => 0, |
131 |
public => 0, |
132 |
} |
132 |
} |
133 |
)->store; |
133 |
)->store; |
134 |
|
134 |
|
135 |
my $shelf_not_to_share = Koha::Virtualshelf->new({ |
135 |
my $shelf_not_to_share = Koha::Virtualshelf->new({ |
136 |
shelfname => "my second shelf", |
136 |
shelfname => "my second shelf", |
137 |
owner => $patron_wants_to_share->{borrowernumber}, |
137 |
owner_id => $patron_wants_to_share->{borrowernumber}, |
138 |
public => 0, |
138 |
public => 0, |
139 |
} |
139 |
} |
140 |
)->store; |
140 |
)->store; |
Lines 216-222
subtest 'Shelf content' => sub {
Link Here
|
216 |
my $dt_yesterday = dt_from_string->subtract_duration( DateTime::Duration->new( days => 1 ) ); |
216 |
my $dt_yesterday = dt_from_string->subtract_duration( DateTime::Duration->new( days => 1 ) ); |
217 |
my $shelf = Koha::Virtualshelf->new( |
217 |
my $shelf = Koha::Virtualshelf->new( |
218 |
{ shelfname => "my first shelf", |
218 |
{ shelfname => "my first shelf", |
219 |
owner => $patron1->{borrowernumber}, |
219 |
owner_id => $patron1->{borrowernumber}, |
220 |
public => 0, |
220 |
public => 0, |
221 |
lastmodified => $dt_yesterday, |
221 |
lastmodified => $dt_yesterday, |
222 |
} |
222 |
} |
Lines 333-339
subtest 'Shelf permissions' => sub {
Link Here
|
333 |
|
333 |
|
334 |
my $public_shelf = Koha::Virtualshelf->new( |
334 |
my $public_shelf = Koha::Virtualshelf->new( |
335 |
{ shelfname => "my first shelf", |
335 |
{ shelfname => "my first shelf", |
336 |
owner => $patron1->{borrowernumber}, |
336 |
owner_id => $patron1->{borrowernumber}, |
337 |
public => 1, |
337 |
public => 1, |
338 |
allow_change_from_owner => 0, |
338 |
allow_change_from_owner => 0, |
339 |
allow_change_from_others => 0, |
339 |
allow_change_from_others => 0, |
Lines 473-479
subtest 'Shelf permissions' => sub {
Link Here
|
473 |
|
473 |
|
474 |
my $private_shelf = Koha::Virtualshelf->new( |
474 |
my $private_shelf = Koha::Virtualshelf->new( |
475 |
{ shelfname => "my first shelf", |
475 |
{ shelfname => "my first shelf", |
476 |
owner => $patron1->{borrowernumber}, |
476 |
owner_id => $patron1->{borrowernumber}, |
477 |
public => 0, |
477 |
public => 0, |
478 |
allow_change_from_owner => 0, |
478 |
allow_change_from_owner => 0, |
479 |
allow_change_from_others => 0, |
479 |
allow_change_from_others => 0, |
Lines 595-631
subtest 'Get shelves' => sub {
Link Here
|
595 |
|
595 |
|
596 |
my $private_shelf1_1 = Koha::Virtualshelf->new({ |
596 |
my $private_shelf1_1 = Koha::Virtualshelf->new({ |
597 |
shelfname => "private shelf 1 for patron 1", |
597 |
shelfname => "private shelf 1 for patron 1", |
598 |
owner => $patron1->{borrowernumber}, |
598 |
owner_id => $patron1->{borrowernumber}, |
599 |
public => 0, |
599 |
public => 0, |
600 |
} |
600 |
} |
601 |
)->store; |
601 |
)->store; |
602 |
my $private_shelf1_2 = Koha::Virtualshelf->new({ |
602 |
my $private_shelf1_2 = Koha::Virtualshelf->new({ |
603 |
shelfname => "private shelf 2 for patron 1", |
603 |
shelfname => "private shelf 2 for patron 1", |
604 |
owner => $patron1->{borrowernumber}, |
604 |
owner_id => $patron1->{borrowernumber}, |
605 |
public => 0, |
605 |
public => 0, |
606 |
} |
606 |
} |
607 |
)->store; |
607 |
)->store; |
608 |
my $private_shelf2_1 = Koha::Virtualshelf->new({ |
608 |
my $private_shelf2_1 = Koha::Virtualshelf->new({ |
609 |
shelfname => "private shelf 1 for patron 2", |
609 |
shelfname => "private shelf 1 for patron 2", |
610 |
owner => $patron2->{borrowernumber}, |
610 |
owner_id => $patron2->{borrowernumber}, |
611 |
public => 0, |
611 |
public => 0, |
612 |
} |
612 |
} |
613 |
)->store; |
613 |
)->store; |
614 |
my $public_shelf1_1 = Koha::Virtualshelf->new({ |
614 |
my $public_shelf1_1 = Koha::Virtualshelf->new({ |
615 |
shelfname => "public shelf 1 for patron 1", |
615 |
shelfname => "public shelf 1 for patron 1", |
616 |
owner => $patron1->{borrowernumber}, |
616 |
owner_id => $patron1->{borrowernumber}, |
617 |
public => 1, |
617 |
public => 1, |
618 |
} |
618 |
} |
619 |
)->store; |
619 |
)->store; |
620 |
my $public_shelf1_2 = Koha::Virtualshelf->new({ |
620 |
my $public_shelf1_2 = Koha::Virtualshelf->new({ |
621 |
shelfname => "public shelf 2 for patron 1", |
621 |
shelfname => "public shelf 2 for patron 1", |
622 |
owner => $patron1->{borrowernumber}, |
622 |
owner_id => $patron1->{borrowernumber}, |
623 |
public => 1, |
623 |
public => 1, |
624 |
} |
624 |
} |
625 |
)->store; |
625 |
)->store; |
626 |
my $shelf_to_share = Koha::Virtualshelf->new({ |
626 |
my $shelf_to_share = Koha::Virtualshelf->new({ |
627 |
shelfname => "shared shelf", |
627 |
shelfname => "shared shelf", |
628 |
owner => $patron1->{borrowernumber}, |
628 |
owner_id => $patron1->{borrowernumber}, |
629 |
public => 0, |
629 |
public => 0, |
630 |
} |
630 |
} |
631 |
)->store; |
631 |
)->store; |
Lines 661-679
subtest 'Get shelves containing biblios' => sub {
Link Here
|
661 |
|
661 |
|
662 |
my $shelf1 = Koha::Virtualshelf->new( |
662 |
my $shelf1 = Koha::Virtualshelf->new( |
663 |
{ shelfname => "my first shelf", |
663 |
{ shelfname => "my first shelf", |
664 |
owner => $patron1->{borrowernumber}, |
664 |
owner_id => $patron1->{borrowernumber}, |
665 |
public => 0, |
665 |
public => 0, |
666 |
} |
666 |
} |
667 |
)->store; |
667 |
)->store; |
668 |
my $shelf2 = Koha::Virtualshelf->new( |
668 |
my $shelf2 = Koha::Virtualshelf->new( |
669 |
{ shelfname => "my x second shelf", # 'x' to make it sorted after 'third' |
669 |
{ shelfname => "my x second shelf", # 'x' to make it sorted after 'third' |
670 |
owner => $patron2->{borrowernumber}, |
670 |
owner_id => $patron2->{borrowernumber}, |
671 |
public => 0, |
671 |
public => 0, |
672 |
} |
672 |
} |
673 |
)->store; |
673 |
)->store; |
674 |
my $shelf3 = Koha::Virtualshelf->new( |
674 |
my $shelf3 = Koha::Virtualshelf->new( |
675 |
{ shelfname => "my third shelf", |
675 |
{ shelfname => "my third shelf", |
676 |
owner => $patron1->{borrowernumber}, |
676 |
owner_id => $patron1->{borrowernumber}, |
677 |
public => 1, |
677 |
public => 1, |
678 |
} |
678 |
} |
679 |
)->store; |
679 |
)->store; |
Lines 748-756
subtest 'cannot_be_transferred' => sub {
Link Here
|
748 |
$removed_patron->delete; |
748 |
$removed_patron->delete; |
749 |
|
749 |
|
750 |
# Create three lists |
750 |
# Create three lists |
751 |
my $private_list = Koha::Virtualshelf->new({ shelfname => "A", owner => $listowner->id })->store; |
751 |
my $private_list = Koha::Virtualshelf->new({ shelfname => "A", owner_id => $listowner->id })->store; |
752 |
my $public_list = Koha::Virtualshelf->new({ shelfname => "B", public => 1, owner => $listowner->id })->store; |
752 |
my $public_list = Koha::Virtualshelf->new({ shelfname => "B", public => 1, owner_id => $listowner->id })->store; |
753 |
my $shared_list = Koha::Virtualshelf->new({ shelfname => "C", owner => $listowner->id })->store; |
753 |
my $shared_list = Koha::Virtualshelf->new({ shelfname => "C", owner_id => $listowner->id })->store; |
754 |
$shared_list->share("key")->accept( "key", $receiver->id ); |
754 |
$shared_list->share("key")->accept( "key", $receiver->id ); |
755 |
|
755 |
|
756 |
# Test on private list |
756 |
# Test on private list |