Reverting previous work. Asset->new must return an Asset, even if
no className is passed and the invocant's class is Asset. This is due to the root. In the db, the root Asset has the className WebGUI::Asset, and the getRoot method matches this. Changed the failing test in Asset.t to look for a WebGUI::Asset to be returned. Added two tests to Asset.t to validate the object returned by Asset->getRoot method. Reverted previous work and updated the POD for Asset->new.
This commit is contained in:
parent
c956ba3969
commit
000b2fcce3
3 changed files with 11 additions and 10 deletions
|
|
@ -17,7 +17,7 @@ use WebGUI::Session;
|
|||
use WebGUI::Asset;
|
||||
use WebGUI::Asset::Wobject::Navigation;
|
||||
|
||||
use Test::More tests => 11; # increment this value for each test you create
|
||||
use Test::More tests => 13; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
|
|
@ -47,9 +47,8 @@ $deadAsset = WebGUI::Asset->new($session, '', 'WebGUI::Asset::Wobject::Navigatio
|
|||
is ($deadAsset, undef,'new constructor with no assetId returns undef');
|
||||
|
||||
# -- no class
|
||||
$deadAsset = 1;
|
||||
$deadAsset = WebGUI::Asset->new($session, $assetId);
|
||||
is ($deadAsset, undef,'new constructor with no class returns undef');
|
||||
my $primevalAsset = WebGUI::Asset->new($session, $assetId);
|
||||
isa_ok ($primevalAsset, 'WebGUI::Asset');
|
||||
|
||||
# Test the newByDynamicClass Constructor
|
||||
$asset = undef;
|
||||
|
|
@ -70,6 +69,11 @@ $deadAsset = 1;
|
|||
$deadAsset = WebGUI::Asset->newByDynamicClass($session);
|
||||
is ($deadAsset, undef, 'newByDynamicClass constructor with no assetId returns undef');
|
||||
|
||||
# Root Asset
|
||||
my $rootAsset = WebGUI::Asset->getRoot($session);
|
||||
isa_ok($rootAsset, 'WebGUI::Asset');
|
||||
is($rootAsset->getId, 'PBasset000000000000001', 'Root Asset ID check');
|
||||
|
||||
# TODO
|
||||
# Test the newByPropertiesHashRef Constructor
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue