my $colinfo = $self->column_info($col);
- $self->throw_exception('FilterColumn does not work with InflateColumn')
- if $self->isa('DBIx::Class::InflateColumn') &&
- defined $colinfo->{_inflate_info};
+ $self->throw_exception("FilterColumn can not be used on a column with a declared InflateColumn inflator")
+ if defined $colinfo->{_inflate_info} and $self->isa('DBIx::Class::InflateColumn');
$self->throw_exception("No such column $col to filter")
unless $self->has_column($col);
my $colinfo = $self->column_info($col);
- $self->throw_exception("InflateColumn does not work with FilterColumn")
- if $self->isa('DBIx::Class::FilterColumn') &&
- defined $colinfo->{_filter_info};
+ $self->throw_exception("InflateColumn can not be used on a column with a declared FilterColumn filter")
+ if defined $colinfo->{_filter_info} and $self->isa('DBIx::Class::FilterColumn');
$self->throw_exception("No such column $col to inflate")
unless $self->has_column($col);
}
IC_DIE: {
- dies_ok {
+ throws_ok {
DBICTest::Schema::Artist->inflate_column(rank =>
{ inflate => sub {}, deflate => sub {} }
);
- } q(Can't inflate column after filter column);
+ } qr/InflateColumn can not be used on a column with a declared FilterColumn filter/, q(Can't inflate column after filter column);
DBICTest::Schema::Artist->inflate_column(name =>
{ inflate => sub {}, deflate => sub {} }
);
- dies_ok {
+ throws_ok {
DBICTest::Schema::Artist->filter_column(name => {
filter_to_storage => sub {},
filter_from_storage => sub {}
});
- } q(Can't filter column after inflate column);
+ } qr/FilterColumn can not be used on a column with a declared InflateColumn inflator/, q(Can't filter column after inflate column);
}
# test when we do not set both filter_from_storage/filter_to_storage