Branch Coverage

blib/lib/EntityModel/Test/Storage.pm
Criterion Covered Total %
branch 1 46 2.1


line true false branch
92 0 0 unless $class->isa('EntityModel::Storage')
93 0 0 unless _methods_ok($class, $msg)
97 0 0 unless ($class eq 'EntityModel::Storage')
98 0 0 unless _simple_model($class, $opt, $msg)
114 0 0 unless _methods_ok($class, $msg)
132 0 0 unless do { $class->can($method) }->try(do { $failed{$method} = $_ }->catch)
136 0 0 if (keys %failed)
152 0 0 unless my $model = 'EntityModel'->new->load_from('Perl', {'name', 'mymodel', 'entity', [{'name', 'thing', 'primary', 'id', 'field', [{'name', 'id', 'type', 'int'}, {'name', 'name', 'type', 'varchar'}]}, {'name', 'other', 'primary', 'id', 'field', [{'name', 'id', 'type', 'int'}, {'name', 'extra', 'type', 'varchar'}]}]})
174 0 0 unless $model->add_storage($class, $opt)
178 0 0 unless @storage == 1
179 0 0 if grep {ref $_ ne $class;} @storage
185 0 0 unless $thing
192 0 0 if $failed and $next
195 0 0 if $failed
199 0 0 if $next
219 0 0 unless $storage->create('entity', $thing, 'data', {'name', 'Test name'}, 'on_complete', sub { $id = shift(); &$next(); } , 'on_fail', sub { &$fail('Something failed', $next); } )
223 0 0 if $failed
224 0 0 unless defined $id
236 0 0 unless $storage->read('entity', $thing, 'id', $id, 'on_complete', sub { $data = shift(); &$next(); } , 'on_fail', sub { &$fail('Something failed', $next); } )
240 0 0 unless [sort(keys %read)] ~~ ['id', 'name']
241 0 0 unless $read{'name'} eq 'Test name'
243 0 0 if $failed
260 0 1 if defined $diag