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
135 lines
4.2 KiB
Perl
135 lines
4.2 KiB
Perl
#-------------------------------------------------------------------
|
|
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
|
#-------------------------------------------------------------------
|
|
# Please read the legal notices (docs/legal.txt) and the license
|
|
# (docs/license.txt) that came with this distribution before using
|
|
# this software.
|
|
#-------------------------------------------------------------------
|
|
# http://www.plainblack.com info@plainblack.com
|
|
#-------------------------------------------------------------------
|
|
|
|
# 1. The basic framework for a test suite for Map Points.
|
|
# Includes setup, cleanup, boilerplate, etc. Basically the really boring,
|
|
# repetitive parts of the test that you don't want to write yourself.
|
|
|
|
use FindBin;
|
|
use strict;
|
|
use lib "$FindBin::Bin/../lib";
|
|
use WebGUI::Test;
|
|
use WebGUI::Session;
|
|
use Test::More tests => 18; # increment this value for each test you create
|
|
use Test::Deep;
|
|
use WebGUI::Asset::Wobject::Map;
|
|
use WebGUI::Asset::MapPoint;
|
|
use WebGUI::Search;
|
|
|
|
my $session = WebGUI::Test->session;
|
|
#Run as Admin
|
|
$session->user({ userId => 3 });
|
|
|
|
# Do our work in the import node
|
|
my $node = WebGUI::Test->asset;
|
|
|
|
# Create a map
|
|
my $map = $node->addChild({
|
|
className => 'WebGUI::Asset::Wobject::Map',
|
|
mapApiKey => undef,
|
|
startZoom => "0",
|
|
workflowIdPoint => "pbworkflow000000000003",
|
|
});
|
|
|
|
# Create a map point
|
|
my $test_point = {
|
|
website => 'http://www.plainblack.com',
|
|
address1 => '520 University Ave',
|
|
address2 => 'Suite 320',
|
|
city => 'Madison',
|
|
region => 'WI',
|
|
zipCode => '53703',
|
|
country => 'United States',
|
|
phone => '608-555-1212',
|
|
fax => '608-555-1212',
|
|
email => 'info@plainblack.com',
|
|
userDefined1 => 'one-plainblack',
|
|
userDefined2 => 'two-plainblack',
|
|
userDefined3 => 'three-plainblack',
|
|
userDefined4 => 'four-plainblack',
|
|
userDefined5 => 'five-plainblack',
|
|
};
|
|
|
|
my $mapPoint = $map->addChild({
|
|
className => 'WebGUI::Asset::MapPoint',
|
|
latitude => '43.0736',
|
|
longitude => '-89.3946',
|
|
%{$test_point}
|
|
});
|
|
|
|
#Call commit manually so we don't have to wait on spectre to run the autocommit workflow
|
|
$mapPoint->commit;
|
|
|
|
# Test for a sane object type
|
|
isa_ok($mapPoint, 'WebGUI::Asset::MapPoint');
|
|
|
|
################################################################
|
|
#
|
|
# indexContent
|
|
#
|
|
################################################################
|
|
|
|
# Test indexContent to make sure keywords are added to assetIndex by searching for them and
|
|
# ensuring the asset is returned in the results. indexContent itself does not need to be called
|
|
# because commit takes care of that for us.
|
|
|
|
#In all cases we should get back the one map point for these tests.
|
|
my $expected = [$mapPoint->getId];
|
|
|
|
foreach my $keyword (keys %$test_point) {
|
|
my $assetIds = WebGUI::Search->new($session)->search({
|
|
keywords => $test_point->{$keyword},
|
|
lineage => [ $map->get("lineage") ] #Limit the search to just map points under the newly create map.
|
|
})->getAssetIds;
|
|
|
|
is_deeply( $assetIds, $expected, "$keyword found in search" );
|
|
}
|
|
#my $assetIds = WebGUI::Search->new($session)->search(\%rules)->getAssetIds;
|
|
|
|
################################################################
|
|
#
|
|
# processAjaxEditForm
|
|
#
|
|
################################################################
|
|
|
|
#Test isHidden
|
|
sleep 1; #Make sure we have a different revision date
|
|
my $test_point_edit = {
|
|
%{$test_point},
|
|
'assetId' => $mapPoint->getId,
|
|
'isHidden' => 1,
|
|
};
|
|
|
|
$session->request->setup_body($test_point_edit);
|
|
|
|
$map->www_ajaxEditPointSave;
|
|
|
|
#Get the newest mapPoint revision
|
|
$mapPoint = WebGUI::Asset->newPending($session,$mapPoint->getId);
|
|
is($mapPoint->get("isHidden"),1,"isHidden changed");
|
|
|
|
#TO DO - Try to change isHidden as a user who can add points but cannot edit
|
|
|
|
|
|
#Test isGeocoded
|
|
sleep 1; #Make sure we have a different revision date
|
|
$test_point_edit = {
|
|
%{$test_point},
|
|
'assetId' => $mapPoint->getId,
|
|
'isGeocoded' => 1,
|
|
};
|
|
|
|
$session->request->setup_body($test_point_edit);
|
|
|
|
$map->www_ajaxEditPointSave;
|
|
|
|
#Get the newest mapPoint revision
|
|
$mapPoint = WebGUI::Asset->newPending($session,$mapPoint->getId);
|
|
is($mapPoint->get("isGeocoded"),1,"isGeocoded changed");
|