"Fossies" - the Fresh Open Source Software Archive

Member "eprints3.4-3.4.4/tests/05_bug_fixes.pl" (7 Aug 2022, 3043 Bytes) of package /linux/www/eprints3.4-3.4.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "05_bug_fixes.pl": 3.4-3.4.3_vs_3.4-3.4.4.

    1 #!/usr/bin/perl
    2 
    3 use Test::More tests => 15;
    4 
    5 use strict;
    6 use warnings;
    7 
    8 BEGIN { use_ok( "EPrints" ); }
    9 BEGIN { use_ok( "EPrints::Test" ); }
   10 
   11 my $repoid = EPrints::Test::get_test_id();
   12 my $ep = EPrints->new();
   13 isa_ok( $ep, "EPrints", "EPrints->new()" );
   14 my $repo = $ep->repository( $repoid );
   15 isa_ok( $repo, "EPrints::Repository", "Get a repository object ($repoid)" );
   16 
   17 my $dataset = $repo->dataset( "eprint" );
   18 my $dataobj = EPrints::Test::get_test_dataobj( $dataset );
   19 my $user = EPrints::Test::get_test_dataobj( $repo->dataset( "user" ) );
   20 my $list;
   21 
   22 #3648 - 100 in review messages
   23 $list = $dataset->search( limit => 3 );
   24 is($list->count, 3, "list is 3 long");
   25 $list->map(sub {});
   26 is($list->count, 3, "list is 3 long after map");
   27 is(scalar($list->slice(0)), 3, "all slice is 3 long");
   28 is(scalar($list->slice(0,3)), 3, "slice is 3 long");
   29 is(scalar($list->slice(0,5)), 3, "slice is 3 long, asked for 5");
   30 is(scalar($list->slice(0,2)), 2, "slice is 2 long, asked for 2");
   31 is($list->count, 3, "list is 3 long after slice");
   32 
   33 #3679 - 4096 [size] files issues on ECS Eprints
   34 {
   35     my $str = 'x' x 5000;
   36     my $doc = $dataobj->create_subdataobj( 'documents', {
   37         format => $dataobj->{session}->{types}->{'document'}->[0]
   38     });
   39     my $file = $doc->create_subdataobj( 'files', {
   40         _content => \$str,
   41         filename => "TEST_DATA",
   42         filesize => length($str),
   43     });
   44     my $cnt = "";
   45     $file->get_file( sub { $cnt .= $_[0] } );
   46     is( length($cnt), length($str), "file stored ok" );
   47     my $doc_clone = $doc->clone( $dataobj );
   48     my $file_clone = $doc_clone->get_stored_file( "TEST_DATA" );
   49     my $clone_str = "";
   50     $file_clone->get_file( sub { $clone_str .= $_[0] } );
   51     is( length($clone_str), length($str), "file clones ok" );
   52     $doc_clone->remove;
   53     $file->remove;
   54 }
   55 
   56 # 3704 - Secret fields being retrieved from database
   57 {
   58     is( $user->value( "password" ), undef, "secret (password) is undef" );
   59 }
   60 
   61 # 4014 - get_citation_spec() undefined error
   62 SKIP: {
   63     my $citation = $repo->dataset( "eprint" )->citation( "default" );
   64     skip "requires EPC citation", 1
   65         unless $citation->isa( "EPrints::Citation::EPC" );
   66     my $xml = $repo->get_citation_spec( $repo->dataset( "eprint" ), "default" );
   67     ok( defined($xml), "get_citation_spec" );
   68 }
   69 
   70 =head1 COPYRIGHT
   71 
   72 =for COPYRIGHT BEGIN
   73 
   74 Copyright 2022 University of Southampton.
   75 EPrints 3.4 is supplied by EPrints Services.
   76 
   77 http://www.eprints.org/eprints-3.4/
   78 
   79 =for COPYRIGHT END
   80 
   81 =for LICENSE BEGIN
   82 
   83 This file is part of EPrints 3.4 L<http://www.eprints.org/>.
   84 
   85 EPrints 3.4 and this file are released under the terms of the
   86 GNU Lesser General Public License version 3 as published by
   87 the Free Software Foundation unless otherwise stated.
   88 
   89 EPrints 3.4 is distributed in the hope that it will be useful,
   90 but WITHOUT ANY WARRANTY; without even the implied warranty of
   91 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   92 See the GNU Lesser General Public License for more details.
   93 
   94 You should have received a copy of the GNU Lesser General Public
   95 License along with EPrints 3.4.
   96 If not, see L<http://www.gnu.org/licenses/>.
   97 
   98 =for LICENSE END
   99