"Fossies" - the Fresh Open Source Software Archive

Member "eprints3.4-3.4.4/tests/60_id_value.pl" (7 Aug 2022, 1820 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 "60_id_value.pl": 3.4-3.4.3_vs_3.4-3.4.4.

    1 use strict;
    2 use Test::More tests => 6;
    3 
    4 BEGIN { use_ok( "EPrints" ); }
    5 BEGIN { use_ok( "EPrints::Test" ); }
    6 
    7 my $session = EPrints::Test::get_test_session();
    8 my $repository = $session->get_repository;
    9 
   10 my $field = EPrints::MetaField->new(
   11     repository => $repository,
   12     name => "test",
   13     type => "text",
   14     );
   15 
   16 my $value = chr(0x169) . " X '\"&++";
   17 
   18 is( $field->get_id_from_value( $session, undef ), "NULL", "undef->NULL" );
   19 is( $field->get_value_from_id( $session, "NULL" ), undef, "NULL->''" );
   20 
   21 my $id = $field->get_id_from_value( $session, $value );
   22 is( $field->get_value_from_id( $session, $id ), $value, "value->id->value" );
   23 
   24 $field = EPrints::MetaField->new(
   25     repository => $repository,
   26     name => "test",
   27     type => "name",
   28     );
   29 
   30 my $name = {
   31     family => "XxXx '+:^%".chr(0x169),
   32     given => "XxXx '+:^%".chr(0x169),
   33     honourific => "DR.",
   34 };
   35 
   36 $id = $field->get_id_from_value( $session, $name );
   37 is_deeply( $field->get_value_from_id( $session, $id ), $name, "name->id->name" );
   38 
   39 
   40 =head1 COPYRIGHT
   41 
   42 =for COPYRIGHT BEGIN
   43 
   44 Copyright 2022 University of Southampton.
   45 EPrints 3.4 is supplied by EPrints Services.
   46 
   47 http://www.eprints.org/eprints-3.4/
   48 
   49 =for COPYRIGHT END
   50 
   51 =for LICENSE BEGIN
   52 
   53 This file is part of EPrints 3.4 L<http://www.eprints.org/>.
   54 
   55 EPrints 3.4 and this file are released under the terms of the
   56 GNU Lesser General Public License version 3 as published by
   57 the Free Software Foundation unless otherwise stated.
   58 
   59 EPrints 3.4 is distributed in the hope that it will be useful,
   60 but WITHOUT ANY WARRANTY; without even the implied warranty of
   61 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   62 See the GNU Lesser General Public License for more details.
   63 
   64 You should have received a copy of the GNU Lesser General Public
   65 License along with EPrints 3.4.
   66 If not, see L<http://www.gnu.org/licenses/>.
   67 
   68 =for LICENSE END
   69