Add a test to make sure every property has a table defined in it. If you need an attribute without a table, use has.
This commit is contained in:
parent
e2033afbac
commit
a874b0201e
2 changed files with 20 additions and 5 deletions
|
|
@ -189,6 +189,8 @@ sub get_tables : Test(1) {
|
|||
my $test = shift;
|
||||
note "get_tables";
|
||||
my @tables = $test->class->meta->get_tables;
|
||||
use Data::Dumper;
|
||||
diag Dumper \@tables;
|
||||
cmp_bag(
|
||||
\@tables,
|
||||
$test->list_of_tables,
|
||||
|
|
@ -264,6 +266,18 @@ sub newByPropertyHashRef : Test(2) {
|
|||
is $asset->title, 'The Shawshank Snippet', 'title is assigned from the property hash';
|
||||
}
|
||||
|
||||
sub scan_properties : Test(1) {
|
||||
note "scan properties for table definitions";
|
||||
my $test = shift;
|
||||
my @properties = $test->class->meta->get_all_properties;
|
||||
my @undefined_tables = ();
|
||||
foreach my $prop (@properties) {
|
||||
push @undefined_tables, $prop->name if (!$prop->tableName);
|
||||
}
|
||||
ok !@undefined_tables, "all properties have tables defined"
|
||||
or diag "except these: ".join ", ", @undefined_tables;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue