fixed #9953: Matrix 2.0 - Not enough tests
This commit is contained in:
parent
52b8143707
commit
be430dfdd2
3 changed files with 75 additions and 28 deletions
|
|
@ -12,6 +12,7 @@
|
||||||
- fixed: assets can have urls with /./ or /../ in them, making them inaccessible
|
- fixed: assets can have urls with /./ or /../ in them, making them inaccessible
|
||||||
- fixed: Icons don't show on first view of admin panel in IE
|
- fixed: Icons don't show on first view of admin panel in IE
|
||||||
- refixed #10260: WebGUI::Asset::Wobject::Gallery.pm default search date misfunction
|
- refixed #10260: WebGUI::Asset::Wobject::Gallery.pm default search date misfunction
|
||||||
|
- fixed #9953: Matrix 2.0 - Not enough tests
|
||||||
|
|
||||||
7.7.9
|
7.7.9
|
||||||
- fixed #10266: Public Profile overrides Able to be friend
|
- fixed #10266: Public Profile overrides Able to be friend
|
||||||
|
|
|
||||||
|
|
@ -770,7 +770,9 @@ sub view {
|
||||||
assetData.title as productName,
|
assetData.title as productName,
|
||||||
assetData.url,
|
assetData.url,
|
||||||
rating.listingId,
|
rating.listingId,
|
||||||
rating.meanValue,
|
rating.meanValue,
|
||||||
|
rating.medianValue,
|
||||||
|
rating.countValue,
|
||||||
asset.parentId
|
asset.parentId
|
||||||
from
|
from
|
||||||
MatrixListing_ratingSummary as rating
|
MatrixListing_ratingSummary as rating
|
||||||
|
|
@ -1236,12 +1238,15 @@ An array of listingIds that should be shown in the compare list datatable.
|
||||||
sub www_getCompareListData {
|
sub www_getCompareListData {
|
||||||
|
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my @listingIds = @_;
|
my $listingIds = shift;
|
||||||
my $session = $self->session;
|
my $session = $self->session;
|
||||||
my $i18n = WebGUI::International->new($session,'Asset_Matrix');
|
my $i18n = WebGUI::International->new($session,'Asset_Matrix');
|
||||||
my (@results,@columnDefs);
|
my (@results,@columnDefs,@listingIds);
|
||||||
|
|
||||||
unless (scalar(@listingIds)) {
|
if ($listingIds) {
|
||||||
|
@listingIds = @{$listingIds};
|
||||||
|
}
|
||||||
|
else{
|
||||||
@listingIds = $self->session->form->checkList("listingId");
|
@listingIds = $self->session->form->checkList("listingId");
|
||||||
}
|
}
|
||||||
my @responseFields = ("attributeId", "name", "description","fieldType", "checked");
|
my @responseFields = ("attributeId", "name", "description","fieldType", "checked");
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ use lib "$FindBin::Bin/../../lib";
|
||||||
|
|
||||||
use WebGUI::Test;
|
use WebGUI::Test;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use Test::More tests => 21; # increment this value for each test you create
|
use Test::More tests => 26; # increment this value for each test you create
|
||||||
use Test::Deep;
|
use Test::Deep;
|
||||||
use JSON;
|
use JSON;
|
||||||
use WebGUI::Asset::Wobject::Matrix;
|
use WebGUI::Asset::Wobject::Matrix;
|
||||||
|
|
@ -62,11 +62,18 @@ cmp_deeply (
|
||||||
'getCategories method returned correct hashref'
|
'getCategories method returned correct hashref'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Test add/edit privileges
|
||||||
|
|
||||||
# add a new attribute
|
is ($matrix->canEdit,'0',"Checking canEdit privilege");
|
||||||
|
is ($matrix->canAddMatrixListing,'0',"Checking canAddMatrixListing privilege");
|
||||||
|
|
||||||
$session->user({userId => 3});
|
$session->user({userId => 3});
|
||||||
|
|
||||||
|
is ($matrix->canEdit,'1',"Checking canEdit privilege as Admin");
|
||||||
|
is ($matrix->canAddMatrixListing,'1',"Checking canAddMatrixListing privilege as Admin");
|
||||||
|
|
||||||
|
# add a new attribute
|
||||||
|
|
||||||
my $attributeProperties = {
|
my $attributeProperties = {
|
||||||
name =>'test attribute',
|
name =>'test attribute',
|
||||||
description =>'description of the test attribute',
|
description =>'description of the test attribute',
|
||||||
|
|
@ -106,7 +113,13 @@ isa_ok($matrixListing, 'WebGUI::Asset::MatrixListing');
|
||||||
|
|
||||||
is($matrixListing->getAutoCommitWorkflowId,undef,"The matrix listings getAutoCommitWorkflowId method correctly returns undef, because the auto commit workflow should only be used on adding a new matrix listing.");
|
is($matrixListing->getAutoCommitWorkflowId,undef,"The matrix listings getAutoCommitWorkflowId method correctly returns undef, because the auto commit workflow should only be used on adding a new matrix listing.");
|
||||||
|
|
||||||
is($matrixListing->hasRated,'0',"The matrix listings hasRated method returns correct value.");
|
#is($matrixListing->hasRated,'0',"The matrix listings hasRated method returns correct value.");
|
||||||
|
|
||||||
|
$matrixListing->setRatings({category1=>'1',category2=>'10'});
|
||||||
|
|
||||||
|
ok($matrixListing->hasRated > 0,"Checking hasRated method after rating.");
|
||||||
|
|
||||||
|
$matrixListing->setRatings({category1=>'2',category2=>'5'});
|
||||||
|
|
||||||
$matrixListing->www_click;
|
$matrixListing->www_click;
|
||||||
|
|
||||||
|
|
@ -184,6 +197,34 @@ cmp_deeply(
|
||||||
'Getting compareFormData as JSON: www_getCompareFormData returns correct data as JSON.'
|
'Getting compareFormData as JSON: www_getCompareFormData returns correct data as JSON.'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Test getting compareListData
|
||||||
|
$json = $matrix->www_getCompareListData([$expectedAssetId]);
|
||||||
|
|
||||||
|
my $compareListData = JSON->new->decode($json);
|
||||||
|
|
||||||
|
my $matrixListingLastUpdatedHuman = $session->datetime->epochToHuman( $matrixListing->get('lastUpdated'),"%z" );
|
||||||
|
|
||||||
|
cmp_deeply(
|
||||||
|
$compareListData,
|
||||||
|
{ResultSet=>{
|
||||||
|
Result=>[
|
||||||
|
{$expectedAssetId=>$matrixListingLastUpdatedHuman,fieldType=>"lastUpdated",name=>"Last Updated"},
|
||||||
|
{fieldType=>"category",name=>"category1",$expectedAssetId=>$matrixListing->get('title').' '},
|
||||||
|
{fieldType=>"category",name=>"category2",$expectedAssetId=>$matrixListing->get('title').' '}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
ColumnDefs=>[{
|
||||||
|
key =>$expectedAssetId,
|
||||||
|
label =>$matrixListing->get('title').' '.$matrixListing->get('version'),
|
||||||
|
formatter =>"formatColors",
|
||||||
|
url =>$matrixListing->getUrl,
|
||||||
|
lastUpdated =>$matrixListingLastUpdatedHuman,
|
||||||
|
}],
|
||||||
|
ResponseFields=>["attributeId", "name", "description","fieldType", "checked",$expectedAssetId,$expectedAssetId."_compareColor"]
|
||||||
|
},
|
||||||
|
'Getting compareListData as JSON'
|
||||||
|
);
|
||||||
|
|
||||||
# Test statistics caching by view method
|
# Test statistics caching by view method
|
||||||
|
|
||||||
$matrix->view;
|
$matrix->view;
|
||||||
|
|
@ -200,7 +241,7 @@ cmp_deeply(
|
||||||
bestViews_name=>$matrixListing->get('title'),
|
bestViews_name=>$matrixListing->get('title'),
|
||||||
bestViews_sortButton=>"<span id='sortByViews'><button type='button'>Sort by views</button></span><br />",
|
bestViews_sortButton=>"<span id='sortByViews'><button type='button'>Sort by views</button></span><br />",
|
||||||
bestCompares_url=>'/'.$matrixListing->get('url'),
|
bestCompares_url=>'/'.$matrixListing->get('url'),
|
||||||
bestCompares_count=>0,
|
bestCompares_count=>1,
|
||||||
bestCompares_name=>$matrixListing->get('title'),
|
bestCompares_name=>$matrixListing->get('title'),
|
||||||
bestCompares_sortButton=>"<span id='sortByCompares'><button type='button'>Sort by compares</button></span><br />",
|
bestCompares_sortButton=>"<span id='sortByCompares'><button type='button'>Sort by compares</button></span><br />",
|
||||||
bestClicks_url=>'/'.$matrixListing->get('url'),
|
bestClicks_url=>'/'.$matrixListing->get('url'),
|
||||||
|
|
@ -214,36 +255,36 @@ cmp_deeply(
|
||||||
}],
|
}],
|
||||||
lastUpdated_sortButton=>"<span id='sortByUpdated'><button type='button'>Sort by updated</button></span><br />",
|
lastUpdated_sortButton=>"<span id='sortByUpdated'><button type='button'>Sort by updated</button></span><br />",
|
||||||
best_rating_loop=>[{
|
best_rating_loop=>[{
|
||||||
url=>'/',
|
url=>'/'.$matrixListing->get('url'),
|
||||||
category=>'category1',
|
category=>'category1',
|
||||||
name=>undef,
|
name=>'untitled',
|
||||||
mean=>undef,
|
mean=>'1.50',
|
||||||
median=>undef,
|
median=>2,
|
||||||
count=>undef,
|
count=>2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url=>'/',
|
url=>'/'.$matrixListing->get('url'),
|
||||||
category=>'category2',
|
category=>'category2',
|
||||||
name=>undef,
|
name=>'untitled',
|
||||||
mean=>undef,
|
mean=>'7.50',
|
||||||
median=>undef,
|
median=>10,
|
||||||
count=>undef,
|
count=>2,
|
||||||
}],
|
}],
|
||||||
worst_rating_loop=>[{
|
worst_rating_loop=>[{
|
||||||
url=>'/',
|
url=>'/'.$matrixListing->get('url'),
|
||||||
category=>'category1',
|
category=>'category1',
|
||||||
name=>undef,
|
name=>'untitled',
|
||||||
mean=>undef,
|
mean=>'1.50',
|
||||||
median=>undef,
|
median=>2,
|
||||||
count=>undef,
|
count=>2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url=>'/',
|
url=>'/'.$matrixListing->get('url'),
|
||||||
category=>'category2',
|
category=>'category2',
|
||||||
name=>undef,
|
name=>'untitled',
|
||||||
mean=>undef,
|
mean=>'7.50',
|
||||||
median=>undef,
|
median=>10,
|
||||||
count=>undef,
|
count=>2,
|
||||||
}],
|
}],
|
||||||
listingCount=>1,
|
listingCount=>1,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue