"Fossies" - the Fresh Open Source Software Archive

Member "email-reminder-0.8.1/t/load-data.t" (14 Mar 2015, 1933 Bytes) of package /linux/privat/email-reminder-0.8.1.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.

    1 #!/usr/bin/perl
    2 
    3 use strict;
    4 use warnings;
    5 use Data::Dumper;
    6 use Test::More tests => 21;
    7 use EmailReminder::EventList;
    8 use EmailReminder::Event;
    9 
   10 my @strs = (
   11     'weekly:7) 5-a-side - 1',
   12     'weekly:8) 5-a-side - 7',
   13     'yearly:5) Christmas Day - 12-25',
   14     'yearly:6) New Year\'s Day - 2008-01-01',
   15     'anniversary:3) My Sister and Bro in Law - 2000-10-20',
   16     'anniversary:4) My Brother and Sis in Law - 1997-02-01',
   17     'monthly:0) PayDay - 16',
   18     'monthly:1) Clean the House - 1',
   19     'birthday:2) Sister - 1980-07-04',
   20     'birthday:9) Bro - 1976-11-23',
   21     'birthday:10) Friend - 1976-02-29',
   22 );
   23 
   24 # tests
   25 my $events = EmailReminder::EventList->new('t/data.xml', 1);
   26 
   27 is(join(' ', $events->get_user_name), 'My Name', 'user name');
   28 is($events->get_user_email, 'my.name@example.org', 'user email');
   29 
   30 $events->set_user_fname('New');
   31 $events->set_user_lname('Surname');
   32 $events->set_user_email('new.surname@example.com');
   33 
   34 is(join(' ', $events->get_user_name), 'New Surname', 'user name (changed)');
   35 is($events->get_user_email, 'new.surname@example.com', 'user email (changed)');
   36 
   37 # check the stores
   38 my $anniversary_model = $events->get_model("anniversary");
   39 is($anniversary_model->get_nb_events(), 2, 'anniversary events');
   40 
   41 my $birthday_model = $events->get_model("birthday");
   42 is($birthday_model->get_nb_events(), 3, 'birthday events');
   43 
   44 my $monthly_model = $events->get_model("monthly");
   45 is($monthly_model->get_nb_events(), 2, 'monthly events');
   46 
   47 my $weekly_model = $events->get_model("weekly");
   48 is($weekly_model->get_nb_events(), 2, 'weekly events');
   49 
   50 my $yearly_model = $events->get_model("yearly");
   51 is($yearly_model->get_nb_events(), 2, 'yearly events');
   52 
   53 # loop through all the events themselves
   54 foreach my $event ($events->get_events()) {
   55     my ($i) = grep { $strs[$_] eq "$event" } 0..$#strs;
   56     splice (@strs, $i, 1);
   57     ok(defined($i), "event rendering ($i)");
   58 }
   59 is(scalar @strs, 0, "all events were found");