getLineage tests. This thing is so big it could have its own test file.
This commit is contained in:
parent
bd577a6712
commit
8d65d4322c
1 changed files with 47 additions and 1 deletions
|
|
@ -17,7 +17,7 @@ use WebGUI::Session;
|
||||||
use WebGUI::User;
|
use WebGUI::User;
|
||||||
|
|
||||||
use WebGUI::Asset;
|
use WebGUI::Asset;
|
||||||
use Test::More tests => 67; # increment this value for each test you create
|
use Test::More tests => 72; # increment this value for each test you create
|
||||||
use Test::Deep;
|
use Test::Deep;
|
||||||
|
|
||||||
# Test the methods in WebGUI::AssetLineage
|
# Test the methods in WebGUI::AssetLineage
|
||||||
|
|
@ -352,6 +352,7 @@ ok($folder->hasChildren, 'hasChildren: cached from getFirstChild');
|
||||||
# newByLineage
|
# newByLineage
|
||||||
#
|
#
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
##Clear the stowed assetLineage hash
|
##Clear the stowed assetLineage hash
|
||||||
$session->stow->delete('assetLineage');
|
$session->stow->delete('assetLineage');
|
||||||
my $snippet4 = WebGUI::Asset->newByLineage($session, $snippets[4]->get('lineage'));
|
my $snippet4 = WebGUI::Asset->newByLineage($session, $snippets[4]->get('lineage'));
|
||||||
|
|
@ -369,6 +370,51 @@ delete $cachedLineage->{$snippet4->get('lineage')}->{class};
|
||||||
my $snippet4 = WebGUI::Asset->newByLineage($session, $snippets[4]->get('lineage'));
|
my $snippet4 = WebGUI::Asset->newByLineage($session, $snippets[4]->get('lineage'));
|
||||||
is ($snippet4->getId, $snippets[4]->getId, 'newByLineage: failing class cache forces lookup');
|
is ($snippet4->getId, $snippets[4]->getId, 'newByLineage: failing class cache forces lookup');
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
#
|
||||||
|
# getLineage
|
||||||
|
#
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
@snipIds = map { $_->getId } @snippets;
|
||||||
|
my $ids = $folder->getLineage(['descendants']);
|
||||||
|
cmp_bag(
|
||||||
|
\@snipIds,
|
||||||
|
$ids,
|
||||||
|
'getLineage: get descendants of folder'
|
||||||
|
);
|
||||||
|
|
||||||
|
$ids = $folder->getLineage(['self','descendants']);
|
||||||
|
unshift @snipIds, $folder->getId;
|
||||||
|
cmp_bag(
|
||||||
|
\@snipIds,
|
||||||
|
$ids,
|
||||||
|
'getLineage: get descendants of folder and self'
|
||||||
|
);
|
||||||
|
|
||||||
|
$ids = $folder->getLineage(['self','children']);
|
||||||
|
cmp_bag(
|
||||||
|
\@snipIds,
|
||||||
|
$ids,
|
||||||
|
'getLineage: descendants == children if there are no grandchildren'
|
||||||
|
);
|
||||||
|
|
||||||
|
$ids = $topFolder->getLineage(['self','children']);
|
||||||
|
cmp_bag(
|
||||||
|
[$topFolder->getId, $folder->getId, $folder2->getId, ],
|
||||||
|
$ids,
|
||||||
|
'getLineage: children (no descendants) of topFolder',
|
||||||
|
);
|
||||||
|
|
||||||
|
$ids = $topFolder->getLineage(['self','descendants']);
|
||||||
|
cmp_bag(
|
||||||
|
[$topFolder->getId, @snipIds, $folder2->getId, $snippet2->getId],
|
||||||
|
$ids,
|
||||||
|
'getLineage: descendants of topFolder',
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
END {
|
END {
|
||||||
$versionTag->rollback;
|
$versionTag->rollback;
|
||||||
foreach my $account ($editor) {
|
foreach my $account ($editor) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue