Lines 149-167
subtest 'enum_truncation_with_object_value' => sub {
Link Here
|
149 |
|
149 |
|
150 |
$schema->storage->txn_begin; |
150 |
$schema->storage->txn_begin; |
151 |
|
151 |
|
152 |
# Create a mock object with a property accessor |
152 |
# Create a mock object class with proper methods |
153 |
my $mock_object = bless { test_enum => 'invalid_value' }, 'TestObject'; |
153 |
package TestObject { |
154 |
|
154 |
|
155 |
# Add the can method to simulate a real object |
155 |
sub new { |
156 |
{ |
156 |
my ( $class, %args ) = @_; |
157 |
no strict 'refs'; |
157 |
return bless \%args, $class; |
158 |
*{"TestObject::can"} = sub { |
158 |
} |
|
|
159 |
|
160 |
sub can { |
159 |
my ( $self, $method ) = @_; |
161 |
my ( $self, $method ) = @_; |
160 |
return $method eq 'test_enum' ? sub { return $self->{test_enum} } : undef; |
162 |
return $method eq 'test_enum' ? \&test_enum : undef; |
161 |
}; |
163 |
} |
162 |
*{"TestObject::test_enum"} = sub { return $_[0]->{test_enum} }; |
164 |
|
|
|
165 |
sub test_enum { |
166 |
my ($self) = @_; |
167 |
return $self->{test_enum}; |
168 |
} |
163 |
} |
169 |
} |
164 |
|
170 |
|
|
|
171 |
# Create a mock object with a property accessor |
172 |
my $mock_object = TestObject->new( test_enum => 'invalid_value' ); |
173 |
|
165 |
# Create a mock DBIx::Class::Exception for enum data truncation |
174 |
# Create a mock DBIx::Class::Exception for enum data truncation |
166 |
my $exception = bless { msg => "Data truncated for column 'test_enum'" }, 'DBIx::Class::Exception'; |
175 |
my $exception = bless { msg => "Data truncated for column 'test_enum'" }, 'DBIx::Class::Exception'; |
167 |
|
176 |
|
168 |
- |
|
|