Fixed: One can now turn off inheritUrlFromParent, and the code is now more

robust: moved from Asset->update to Asset->fixUrl.
This commit is contained in:
Chris Nehren 2008-06-20 19:21:30 +00:00
parent d387536807
commit 05cf8fa24c
3 changed files with 22 additions and 35 deletions

View file

@ -146,7 +146,7 @@ $canViewMaker->prepare(
},
);
plan tests => 97
plan tests => 98
+ scalar(@fixIdTests)
+ scalar(@fixTitleTests)
+ 2*scalar(@getTitleTests) #same tests used for getTitle and getMenuTitle
@ -766,15 +766,19 @@ $properties2 = {
url => 'inheriturlfromparent02',
};
my $iufpAsset2 = $iufpAsset->addChild($properties2, $properties2->{id});
$iufpAsset2->update( { inheritUrlFromParent => 1 } );
$iufpAsset2->commit;
is($iufpAsset2->getUrl, '/inheriturlfromparent01/inheriturlfromparent02', 'inheritUrlFromParent works');
# works for setting, now try disabling. Should not change the URL.
$iufpAsset2->update( { inheritUrlFromParent => 0 } );
$iufpAsset2->commit;
is($iufpAsset2->getUrl, '/inheriturlfromparent01/inheriturlfromparent02', 'setting inheritUrlFromParent to 0 works');
# also make sure that it is actually disabled
is($iufpAsset2->get('inheritUrlFromParent'), 0, "disabling inheritUrlFromParent actually works");
# works for setting and disabling, now ensure it recurses
my $properties3 = {
@ -785,8 +789,11 @@ my $properties3 = {
url => 'inheriturlfromparent03',
};
my $iufpAsset3 = $iufpAsset2->addChild($properties3, $properties3->{id});
$iufpAsset3->commit;
$iufpAsset2->update( { inheritUrlFromParent => 1 } );
$iufpAsset2->commit;
$iufpAsset3->update( { inheritUrlFromParent => 1 } );
$iufpAsset3->commit;
is($iufpAsset3->getUrl, '/inheriturlfromparent01/inheriturlfromparent02/inheriturlfromparent03', 'inheritUrlFromParent recurses properly');