StoryTopic 'Alphabetically' sort order
This commit is contained in:
parent
33592f9dbb
commit
e033192328
6 changed files with 110 additions and 9 deletions
|
|
@ -31,7 +31,7 @@ my $session = WebGUI::Test->session;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 18;
|
||||
plan tests => 19;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# put your tests here
|
||||
|
|
@ -316,3 +316,44 @@ cmp_deeply(
|
|||
],
|
||||
'rssFeedItems'
|
||||
);
|
||||
|
||||
################################################################
|
||||
# Sort Order
|
||||
################################################################
|
||||
|
||||
$pastStory->update( { title => "aaaay was history but isn't any more" } );
|
||||
$pastStory->requestAutoCommit;
|
||||
|
||||
$topic->update({ storiesPer => 4, storiesShort => 4, }); # storiesPer is used when _standAlone is true, storiesShort otherwise
|
||||
$topic->{_standAlone} = 0;
|
||||
$topic->update( { storySortOrder => 'Alphabetically' } );
|
||||
|
||||
$templateVars = $topic->viewTemplateVariables();
|
||||
|
||||
cmp_deeply(
|
||||
$templateVars->{story_loop},
|
||||
[
|
||||
{
|
||||
title => "aaaay was history but isn't any more",
|
||||
url => ignore(),
|
||||
creationDate => $yesterday,
|
||||
},
|
||||
{
|
||||
title => 'andy',
|
||||
url => ignore(),
|
||||
creationDate => $now,
|
||||
},
|
||||
{
|
||||
title => 'bogs',
|
||||
url => ignore(),
|
||||
creationDate => $now,
|
||||
},
|
||||
{
|
||||
title => 'brooks',
|
||||
url => ignore(),
|
||||
creationDate => $now,
|
||||
},
|
||||
],
|
||||
'viewTemplateVars has right number and contents in the story_loop in sort order Alphabetically mode'
|
||||
);
|
||||
|
||||
|
|
|
|||
22
t/Keyword.t
22
t/Keyword.t
|
|
@ -17,7 +17,7 @@ use WebGUI::Keyword;
|
|||
use WebGUI::Asset;
|
||||
# load your modules here
|
||||
|
||||
use Test::More tests => 15; # increment this value for each test you create
|
||||
use Test::More tests => 16; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
use Data::Dumper;
|
||||
|
||||
|
|
@ -76,10 +76,28 @@ my $assetIds = $keyword->getMatchingAssets({ keyword => 'webgui', });
|
|||
|
||||
cmp_deeply(
|
||||
$assetIds,
|
||||
[$snippet->getId, $home->getId, ],
|
||||
[ $snippet->getId, $home->getId, ],
|
||||
'getMatchingAssets, by keyword, assetIds in order by creationDate, descending'
|
||||
);
|
||||
|
||||
# sorted by title, alphabetically
|
||||
|
||||
my $aa_story = $home->addChild({ className => 'WebGUI::Asset::Story', title => "aaaa", keywords => 'webgui' });
|
||||
WebGUI::Test->addToCleanup($aa_story);
|
||||
|
||||
$assetIds = $keyword->getMatchingAssets({ keyword => 'webgui', sortOrder => 'Alphabetically', });
|
||||
|
||||
cmp_deeply(
|
||||
$assetIds,
|
||||
[ $aa_story->getId, $home->getId, $snippet->getId, ], # 'aaa', 'Home', 'keyword snippet'
|
||||
'getMatchingAssets, by keyword, assetIds in order by title'
|
||||
);
|
||||
|
||||
$aa_story->trash();
|
||||
$aa_story->purge();
|
||||
|
||||
# trashed assets
|
||||
|
||||
$snippet->trash();
|
||||
|
||||
cmp_deeply(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue