Merge commit 'v7.10.15' into 8
Conflicts: docs/gotcha.txt docs/previousVersion.sql docs/templates.txt lib/WebGUI.pm lib/WebGUI/Asset.pm lib/WebGUI/Asset/Event.pm lib/WebGUI/Asset/File.pm lib/WebGUI/Asset/MapPoint.pm lib/WebGUI/Asset/RichEdit.pm lib/WebGUI/Asset/Sku/Product.pm lib/WebGUI/Asset/Snippet.pm lib/WebGUI/Asset/Story.pm lib/WebGUI/Asset/Template.pm lib/WebGUI/Asset/Template/TemplateToolkit.pm lib/WebGUI/Asset/Wobject/Calendar.pm lib/WebGUI/Asset/Wobject/Carousel.pm lib/WebGUI/Asset/Wobject/Collaboration.pm lib/WebGUI/Asset/Wobject/Dashboard.pm lib/WebGUI/Asset/Wobject/DataForm.pm lib/WebGUI/Asset/Wobject/Folder.pm lib/WebGUI/Asset/Wobject/Map.pm lib/WebGUI/Asset/Wobject/Search.pm lib/WebGUI/Asset/Wobject/Shelf.pm lib/WebGUI/Asset/Wobject/StockData.pm lib/WebGUI/Asset/Wobject/StoryTopic.pm lib/WebGUI/Asset/Wobject/SyndicatedContent.pm lib/WebGUI/Asset/Wobject/Thingy.pm lib/WebGUI/Asset/Wobject/WeatherData.pm lib/WebGUI/AssetClipboard.pm lib/WebGUI/AssetCollateral/DataForm/Entry.pm lib/WebGUI/AssetExportHtml.pm lib/WebGUI/AssetLineage.pm lib/WebGUI/AssetMetaData.pm lib/WebGUI/AssetTrash.pm lib/WebGUI/AssetVersioning.pm lib/WebGUI/Auth.pm lib/WebGUI/Cache/CHI.pm lib/WebGUI/Content/AssetManager.pm lib/WebGUI/Fork/ProgressBar.pm lib/WebGUI/Form/JsonTable.pm lib/WebGUI/Form/TimeField.pm lib/WebGUI/Form/Zipcode.pm lib/WebGUI/Group.pm lib/WebGUI/International.pm lib/WebGUI/Macro/AssetProxy.pm lib/WebGUI/Macro/FileUrl.pm lib/WebGUI/Operation/SSO.pm lib/WebGUI/Operation/User.pm lib/WebGUI/Role/Asset/Subscribable.pm lib/WebGUI/Shop/Cart.pm lib/WebGUI/Shop/Transaction.pm lib/WebGUI/Shop/TransactionItem.pm lib/WebGUI/Test.pm lib/WebGUI/URL/Content.pm lib/WebGUI/URL/Uploads.pm lib/WebGUI/User.pm lib/WebGUI/Workflow/Activity/ExtendCalendarRecurrences.pm lib/WebGUI/Workflow/Activity/SendNewsletters.pm lib/WebGUI/i18n/English/Asset.pm lib/WebGUI/i18n/English/WebGUI.pm sbin/installClass.pl sbin/rebuildLineage.pl sbin/search.pl sbin/testEnvironment.pl t/Asset/Asset.t t/Asset/AssetClipboard.t t/Asset/AssetLineage.t t/Asset/AssetMetaData.t t/Asset/Event.t t/Asset/File.t t/Asset/File/Image.t t/Asset/Post/notification.t t/Asset/Sku.t t/Asset/Story.t t/Asset/Template.t t/Asset/Wobject/Collaboration/templateVariables.t t/Asset/Wobject/Collaboration/unarchiveAll.t t/Asset/Wobject/Shelf.t t/Auth.t t/Macro/EditableToggle.t t/Macro/FilePump.t t/Shop/Cart.t t/Shop/Transaction.t t/Storage.t t/User.t t/Workflow.t
This commit is contained in:
commit
277faae8a1
783 changed files with 32041 additions and 25495 deletions
|
|
@ -35,7 +35,7 @@ my $article = WebGUI::Test->asset->addChild( {
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 16; # Increment this number for each test you create
|
||||
plan tests => 24; # Increment this number for each test you create
|
||||
|
||||
use_ok( 'WebGUI::Search::Index' );
|
||||
|
||||
|
|
@ -67,6 +67,7 @@ cmp_deeply (
|
|||
re("keyword1"), re("keyword2"),
|
||||
),
|
||||
lineage => $article->get('lineage'),
|
||||
subId => undef,
|
||||
},
|
||||
"Index has correct information"
|
||||
);
|
||||
|
|
@ -79,7 +80,7 @@ is( $indexer->getId, $article->getId, "getId() returns assetId" );
|
|||
|
||||
# setIsPublic
|
||||
$indexer->setIsPublic(0);
|
||||
is( $db->quickScalar( "SELECT isPublic FROM assetIndex WHERE assetId=?", [$article->getId] ),
|
||||
is( $db->quickScalar( "SELECT isPublic FROM assetIndex WHERE assetId=? and url=?", [$article->getId, $article->get('url')] ),
|
||||
0,
|
||||
"setIsPublic updates database",
|
||||
);
|
||||
|
|
@ -89,7 +90,7 @@ isa_ok( $indexer->session, 'WebGUI::Session', 'session returns session' );
|
|||
|
||||
# updateSynopsis
|
||||
$indexer->updateSynopsis( "A new synopsis" );
|
||||
is( $db->quickScalar( "SELECT synopsis FROM assetIndex WHERE assetId=?", [$article->getId] ),
|
||||
is( $db->quickScalar( "SELECT synopsis FROM assetIndex WHERE assetId=? and url=?", [$article->getId, $article->get('url')] ),
|
||||
"A new synopsis",
|
||||
"updateSynopsis updates assetIndex"
|
||||
);
|
||||
|
|
@ -104,9 +105,9 @@ isnt(
|
|||
# TODO
|
||||
|
||||
# addKeywords
|
||||
my $currentKeywords = $db->quickScalar( "SELECT keywords FROM assetIndex WHERE assetId=?", [$article->getId] );
|
||||
my $currentKeywords = $db->quickScalar( "SELECT keywords FROM assetIndex WHERE assetId=? and url=?", [$article->getId, $article->get('url')] );
|
||||
$indexer->addKeywords("shawshank");
|
||||
my $newKeywords = $db->quickScalar( "SELECT keywords FROM assetIndex WHERE assetId=?", [$article->getId] );
|
||||
my $newKeywords = $db->quickScalar( "SELECT keywords FROM assetIndex WHERE assetId=? and url=?", [$article->getId, $article->get('url')] );
|
||||
like( $newKeywords, qr{$currentKeywords}, "addKeywords keeps old keywords" );
|
||||
like( $newKeywords, qr{shawshank}, "addKeywords adds the keywords" );
|
||||
|
||||
|
|
@ -118,7 +119,7 @@ $article->update({
|
|||
} );
|
||||
$indexer = WebGUI::Search::Index->create( $article );
|
||||
|
||||
ok ( $row = $db->quickHashRef( "SELECT * FROM assetIndex WHERE assetId=?", [ $article->getId ] ),
|
||||
ok ( $row = $db->quickHashRef( "SELECT * FROM assetIndex WHERE assetId=? and url=?", [ $article->getId, $article->get('url') ] ),
|
||||
"assetId exists in assetIndex"
|
||||
);
|
||||
cmp_deeply (
|
||||
|
|
@ -143,6 +144,7 @@ cmp_deeply (
|
|||
re("keyword1"), re("keyword2"),
|
||||
),
|
||||
lineage => $article->get('lineage'),
|
||||
subId => undef,
|
||||
},
|
||||
"Index has synopsis information in keywords"
|
||||
);
|
||||
|
|
@ -156,7 +158,7 @@ $article->update({
|
|||
});
|
||||
$indexer = WebGUI::Search::Index->create( $article );
|
||||
|
||||
$row = $db->quickHashRef( "SELECT * FROM assetIndex WHERE assetId=?", [ $article->getId ]);
|
||||
$row = $db->quickHashRef( "SELECT * FROM assetIndex WHERE assetId=? and url=?", [ $article->getId, $article->get('url') ]);
|
||||
cmp_deeply (
|
||||
$row,
|
||||
{
|
||||
|
|
@ -179,6 +181,7 @@ cmp_deeply (
|
|||
re("keyword1"), re("keyword2"),
|
||||
),
|
||||
lineage => $article->get('lineage'),
|
||||
subId => undef,
|
||||
},
|
||||
"Index has description in keywords"
|
||||
);
|
||||
|
|
@ -192,7 +195,7 @@ $article->update({
|
|||
});
|
||||
$indexer = WebGUI::Search::Index->create( $article );
|
||||
|
||||
$row = $db->quickHashRef( "SELECT * FROM assetIndex WHERE assetId=?", [ $article->getId ] );
|
||||
$row = $db->quickHashRef( "SELECT * FROM assetIndex WHERE assetId=? and url=?", [ $article->getId, $article->get('url') ] );
|
||||
cmp_deeply (
|
||||
$row,
|
||||
{
|
||||
|
|
@ -214,6 +217,7 @@ cmp_deeply (
|
|||
re("keyword1"), re("keyword2"),
|
||||
),
|
||||
lineage => $article->get('lineage'),
|
||||
subId => undef,
|
||||
},
|
||||
"Index has synopsis and description in keywords"
|
||||
);
|
||||
|
|
@ -225,7 +229,7 @@ $article->update({
|
|||
});
|
||||
$indexer = WebGUI::Search::Index->create( $article );
|
||||
|
||||
$row = $db->quickHashRef( "SELECT * FROM assetIndex WHERE assetId=?", [ $article->getId ] );
|
||||
$row = $db->quickHashRef( "SELECT * FROM assetIndex WHERE assetId=? and url=?", [ $article->getId, $article->get('url') ] );
|
||||
cmp_deeply (
|
||||
$row,
|
||||
superhashof({
|
||||
|
|
@ -251,7 +255,7 @@ SKIP: {
|
|||
});
|
||||
$indexer = WebGUI::Search::Index->create( $article );
|
||||
|
||||
$row = $db->quickHashRef( "SELECT * FROM assetIndex WHERE assetId=?", [ $article->getId ] );
|
||||
$row = $db->quickHashRef( "SELECT * FROM assetIndex WHERE assetId=? and url=?", [ $article->getId, $article->get('url') ] );
|
||||
cmp_deeply (
|
||||
$row,
|
||||
superhashof({
|
||||
|
|
@ -265,4 +269,39 @@ SKIP: {
|
|||
);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test addRecord
|
||||
note "addRecord";
|
||||
$article->update({
|
||||
description => "descriptive",
|
||||
});
|
||||
$indexer = WebGUI::Search::Index->create( $article );
|
||||
is $session->db->quickScalar('select count(*) from assetIndex where assetId=?', [$article->getId]), 1, 'create puts 1 record into the db';
|
||||
$indexer->addRecord( url => 'something else');
|
||||
is $session->db->quickScalar('select count(*) from assetIndex where assetId=?', [$article->getId]), 1, 'addRecord does nothing without url and keywords entries';
|
||||
$indexer->addRecord( keywords => 'something else');
|
||||
is $session->db->quickScalar('select count(*) from assetIndex where assetId=?', [$article->getId]), 1, 'addRecord does nothing without url and keywords entries';
|
||||
$indexer->addRecord( keywords => 'something else', url => '', );
|
||||
is $session->db->quickScalar('select count(*) from assetIndex where assetId=?', [$article->getId]), 1, 'addRecord does nothing without url and keywords entries';
|
||||
$indexer->addRecord( keywords => 'something else', url => 'another/thing/coming', );
|
||||
is $session->db->quickScalar('select count(*) from assetIndex where assetId=?', [$article->getId]), 2, 'new record added';
|
||||
|
||||
my %original_record = $session->db->quickHash('select * from assetIndex where assetId=? and url=?', [$article->getId, $article->get('url')]);
|
||||
my %new_record = $session->db->quickHash('select * from assetIndex where assetId=? and url=?', [$article->getId, 'another/thing/coming']);
|
||||
|
||||
delete @original_record{qw/url keywords/};
|
||||
delete @new_record{qw/url keywords/};
|
||||
|
||||
cmp_deeply(\%original_record, \%new_record, 'records are the same, aside from url and keywords');
|
||||
|
||||
$indexer->delete;
|
||||
is $session->db->quickScalar('select count(*) from assetIndex where assetId=?', [$article->getId]), 0, 'all records deleted';
|
||||
|
||||
$indexer = WebGUI::Search::Index->create( $article );
|
||||
$indexer->addRecord(url => 'other', keywords => 'yada yada yada', lineage => 'hike');
|
||||
my %original_record = $session->db->quickHash('select * from assetIndex where assetId=? and url=?', [$article->getId, $article->get('url')]);
|
||||
my %new_record = $session->db->quickHash('select * from assetIndex where assetId=? and url=?', [$article->getId, 'other']);
|
||||
|
||||
is $original_record{lineage}, $new_record{lineage}, 'lineage is not allowed to be overridden';
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue