View | Details | Raw Unified | Return to bug 28873
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Patrons.t (-8 / +7 lines)
Lines 788-794 subtest 'is_valid_age' => sub { Link Here
788
    my $patron = $builder->build({
788
    my $patron = $builder->build({
789
        source => 'Borrower',
789
        source => 'Borrower',
790
        value => {
790
        value => {
791
            categorycode        => 'AGE_5_10'
791
            categorycode        => $category->categorycode
792
        }
792
        }
793
    });
793
    });
794
    $patron = Koha::Patrons->find( $patron->{borrowernumber} );
794
    $patron = Koha::Patrons->find( $patron->{borrowernumber} );
Lines 805-821 subtest 'is_valid_age' => sub { Link Here
805
            add_m3_m6_m1 =>
805
            add_m3_m6_m1 =>
806
              { date => '2016-08-27', expected_age => 3, valid => 0 },
806
              { date => '2016-08-27', expected_age => 3, valid => 0 },
807
            add_m7_m6_m1 =>
807
            add_m7_m6_m1 =>
808
              { date => '2015-02-28', expected_age => 7, valid => 1 },
808
              { date => '2013-02-28', expected_age => 7, valid => 1 },
809
            add_m5_0_0 =>
809
            add_m5_0_0 =>
810
              { date => '2015-02-28', expected_age => 5, valid => 1 },
810
              { date => '2015-02-28', expected_age => 5, valid => 1 },
811
            add_m5_0_p1 =>
811
            add_m5_0_p1 =>
812
              { date => '2015-03-01', expected_age => 5, valid => 0 },
812
              { date => '2015-03-01', expected_age => 4, valid => 0 },
813
            add_m5_0_m1 =>
813
            add_m5_0_m1 =>
814
              { date => '2015-02-27', expected_age => 5, valid => 1 },
814
              { date => '2015-02-27', expected_age => 5, valid => 1 },
815
            add_m11_0_0 =>
815
            add_m11_0_0 =>
816
              { date => '2009-02-28', expected_age => 11, valid => 0 },
816
              { date => '2009-02-28', expected_age => 11, valid => 0 },
817
            add_m11_0_p1 =>
817
            add_m11_0_p1 =>
818
              { date => '2009-03-01', expected_age => 11, valid => 1 },
818
              { date => '2009-03-01', expected_age => 10, valid => 1 },
819
            add_m11_0_m1 =>
819
            add_m11_0_m1 =>
820
              { date => '2009-02-27', expected_age => 11, valid => 0 },
820
              { date => '2009-02-27', expected_age => 11, valid => 0 },
821
        },
821
        },
Lines 827-833 subtest 'is_valid_age' => sub { Link Here
827
827
828
        Time::Fake->offset( $dt->epoch );
828
        Time::Fake->offset( $dt->epoch );
829
829
830
        for my $k ( keys %$date ) {
830
        for my $k ( sort keys %$date ) {
831
            next if $k eq 'today';
831
            next if $k eq 'today';
832
832
833
            my $dob = $date->{$k};
833
            my $dob = $date->{$k};
Lines 836-843 subtest 'is_valid_age' => sub { Link Here
836
                $patron->is_valid_age,
836
                $patron->is_valid_age,
837
                $dob->{valid},
837
                $dob->{valid},
838
                sprintf(
838
                sprintf(
839
                    "Today=%s, dob=%s, is %s, should be valid=%s",
839
                    "Today=%s, dob=%s, is %s, should be valid=%s in category %s",
840
                    $date->{today}, $dob->{date}, $dob->{expected_age}, $dob->{valid}
840
                    $date->{today}, $dob->{date}, $dob->{expected_age}, $dob->{valid}, $category->categorycode
841
                )
841
                )
842
            );
842
            );
843
        }
843
        }
844
- 

Return to bug 28873