1 BEGIN { $| = 1; print "1..25\n"; }
2 END {print "not ok 1\n" unless $loaded;}
10 # Load some sample data from the items table
12 my $dbh=C4::Context->dbh();
13 my $sth=$dbh->prepare("select biblionumber,biblioitemnumber,itemnumber from items limit 30");
15 while (my ($biblionumber, $biblioitemnumber, $itemnumber) = $sth->fetchrow) {
16 push @$itemdata, { biblionumber=>$biblionumber, biblioitemnumber=>$biblioitemnumber, itemnumber=>$itemnumber };
19 if ($itemdata=~/^ARRAY/) {
27 # Create a couple of new shelves
29 my $shelf=Shelf->new('Shelf1', -1);
30 my $shelf2=Shelf->new('Shelf2', -1);
39 # Add some items to the shelves
42 for ($i=0; $i<20; $i++) {
43 $shelf->addtoshelf( -add => [[ $$itemdata[$i]->{biblionumber},
44 $$itemdata[$i]->{biblioitemnumber},
45 $$itemdata[$i]->{itemnumber} ]]);
47 for ($i=20; $i<30; $i++) {
48 $shelf2->addtoshelf( -add => [[ $$itemdata[$i]->{biblionumber},
49 $$itemdata[$i]->{biblioitemnumber},
50 $$itemdata[$i]->{itemnumber} ]]);
53 if ($shelf->itemcounter() == 20 && $shelf2->itemcounter() == 10 ) {
59 $shelf->attribute('testattribute1', 'testvalue1');
60 $shelf->attribute('testattribute2', 'testvalue2');
62 if ($shelf->attribute('testattribute1') eq 'testvalue1' && $shelf->attribute('testattribute2') eq 'testvalue2') {