2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
15 package Fake::DateTime;
18 has 'string_repr' => ( is => 'ro' );
22 use Mouse::Util::TypeConstraints;
24 coerce 'Fake::DateTime' => from 'Str' =>
25 via { Fake::DateTime->new( string_repr => $_ ) };
27 has 'closing_date' => (
29 isa => 'Fake::DateTime',
32 my ( $self, $val ) = @_;
33 ::pass('... trigger is being called');
34 ::isa_ok( $self->closing_date, 'Fake::DateTime' );
35 ::isa_ok( $val, 'Fake::DateTime' );
41 my $mtg = Mortgage->new( closing_date => 'yesterday' );
42 isa_ok( $mtg, 'Mortgage' );
44 # check that coercion worked
45 isa_ok( $mtg->closing_date, 'Fake::DateTime' );
48 Mortgage->meta->make_immutable;
49 ok( Mortgage->meta->is_immutable, '... Mortgage is now immutable' );
52 my $mtg = Mortgage->new( closing_date => 'yesterday' );
53 isa_ok( $mtg, 'Mortgage' );
55 # check that coercion worked
56 isa_ok( $mtg->closing_date, 'Fake::DateTime' );