Fix newByPropertyHashRef, which is required for class dispatch. Add tests. Fix addChild to use newByPropertyHashRef.

This commit is contained in:
Colin Kuskie 2010-01-20 18:44:48 -08:00
parent 36d1636f06
commit caa1f330b8
3 changed files with 19 additions and 9 deletions

View file

@ -20,7 +20,7 @@ use Test::More;
use Test::Deep;
use Test::Exception;
plan tests => 46;
plan tests => 49;
my $session = WebGUI::Test->session;
@ -141,6 +141,17 @@ my $session = WebGUI::Test->session;
is $class, undef, '... returns undef if the class cannot be found';
}
{
note "newByPropertyHashRef";
my $asset;
$asset = WebGUI::Asset->newByPropertyHashRef($session, {className => 'WebGUI::Asset::Snippet', title => 'The Shawshank Snippet'});
isa_ok $asset, 'WebGUI::Asset::Snippet';
is $asset->title, 'The Shawshank Snippet', 'title is assigned from the property hash';
my $a2 = WebGUI::Asset::Snippet->newByPropertyHashRef($session, {});
isa_ok $asset, 'WebGUI::Asset::Snippet';
}
{
note "new, fetching from db";
my $asset;