|
Lines 54-60
subtest 'Start with some trivial tests' => sub {
Link Here
|
| 54 |
# return undef if a record exists |
54 |
# return undef if a record exists |
| 55 |
my $param = { source => 'Branch', value => { branchcode => 'MPL' } }; |
55 |
my $param = { source => 'Branch', value => { branchcode => 'MPL' } }; |
| 56 |
$builder->build( $param ); # at least it should exist now |
56 |
$builder->build( $param ); # at least it should exist now |
| 57 |
is( $builder->build( $param ), undef, 'Return undef when exists' ); |
57 |
warning_like { $builder->build( $param ) } |
|
|
58 |
qr/Violation of unique constraint/, |
| 59 |
'Catch warn on adding existing record'; |
| 58 |
}; |
60 |
}; |
| 59 |
|
61 |
|
| 60 |
|
62 |
|
|
Lines 229-235
subtest 'Test build with NULL values' => sub {
Link Here
|
| 229 |
|
231 |
|
| 230 |
# PK should not be null |
232 |
# PK should not be null |
| 231 |
my $params = { source => 'Branch', value => { branchcode => undef }}; |
233 |
my $params = { source => 'Branch', value => { branchcode => undef }}; |
| 232 |
is( $builder->build( $params ), undef, 'PK should not be null' ); |
234 |
warning_like { $builder->build( $params ) } |
|
|
235 |
qr/Null value for branchcode/, |
| 236 |
'Catch warn on adding branch with a null branchcode'; |
| 233 |
# Nullable column |
237 |
# Nullable column |
| 234 |
my $info = $schema->source( 'Item' )->column_info( 'barcode' ); |
238 |
my $info = $schema->source( 'Item' )->column_info( 'barcode' ); |
| 235 |
$params = { source => 'Item', value => { barcode => undef }}; |
239 |
$params = { source => 'Item', value => { barcode => undef }}; |
| 236 |
- |
|
|