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
11
t/Asset.t
11
t/Asset.t
|
|
@ -159,11 +159,6 @@ my $session = WebGUI::Test->session;
|
|||
is $asset->title, 'Root', 'got the right asset';
|
||||
}
|
||||
|
||||
{
|
||||
note "uiLevel";
|
||||
is +WebGUI::Asset->meta->uiLevel, 1, 'uiLevel: default for assets is 1';
|
||||
}
|
||||
|
||||
{
|
||||
note "write, update";
|
||||
|
||||
|
|
@ -301,3 +296,9 @@ my $session = WebGUI::Test->session;
|
|||
is ($asset->keywords, 'chess set', 'set and get of keywords via direct accessor');
|
||||
is ($asset->get('keywords'), 'chess set', 'via get method');
|
||||
}
|
||||
|
||||
{
|
||||
note "valid_parent_classes";
|
||||
my $classes = WebGUI::Asset->valid_parent_classes;
|
||||
cmp_deeply($classes, [qw/WebGUI::Asset/], 'Any asset okay');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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