Merge commit 'v7.10.17' into 8
Conflicts: docs/upgrades/upgrade_7.9.13-7.10.0.pl lib/WebGUI.pm lib/WebGUI/Asset/Template/TemplateToolkit.pm lib/WebGUI/Asset/Wobject/AssetReport.pm lib/WebGUI/Asset/Wobject/Thingy.pm lib/WebGUI/Form/Captcha.pm lib/WebGUI/Macro/AdminBar.pm lib/WebGUI/Shop/Cart.pm lib/WebGUI/Shop/PayDriver.pm lib/WebGUI/Shop/PayDriver/PayPal/ExpressCheckout.pm lib/WebGUI/Shop/PayDriver/PayPal/PayPalStd.pm lib/WebGUI/Shop/Transaction.pm lib/WebGUI/Workflow/Instance.pm lib/WebGUI/Workflow/Spectre.pm lib/WebGUI/i18n/English/PayDriver.pm t/Asset/Asset.t t/Asset/AssetExportHtml.t t/Asset/AssetLineage.t t/Asset/Wobject/Thingy.t
This commit is contained in:
commit
795d88e7e5
69 changed files with 972 additions and 170 deletions
97
t/Macro/RenderThingData.t
Normal file
97
t/Macro/RenderThingData.t
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
#-------------------------------------------------------------------
|
||||
# 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
|
||||
#-------------------------------------------------------------------
|
||||
use FindBin;
|
||||
use strict;
|
||||
use lib "$FindBin::Bin/../lib";
|
||||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Test::MockAsset;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Asset::Template;
|
||||
use WebGUI::Macro::RenderThingData;
|
||||
use WebGUI::Asset::Wobject::Thingy;
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
use Test::MockObject;
|
||||
use Test::Deep;
|
||||
|
||||
my $templateId = lc 'VIEW_THING_DATA_TEMPL8T';
|
||||
my $templateUrl = 'view_thing_data_template';
|
||||
my $templateMock = WebGUI::Test::MockAsset->new('WebGUI::Asset::Template');
|
||||
my $templateVars;
|
||||
my $templateProcessed = 0;
|
||||
$templateMock->mock('process', sub { $templateVars = $_[1]; $templateProcessed = 1; } );
|
||||
my $session = WebGUI::Test->session;
|
||||
$templateMock->mock_id( $templateId );
|
||||
$templateMock->mock_url( $templateUrl );
|
||||
|
||||
plan tests => 4;
|
||||
|
||||
my $node = WebGUI::Test->asset;
|
||||
my $thingy = $node->addChild({
|
||||
className => 'WebGUI::Asset::Wobject::Thingy',
|
||||
groupIdView => 7,
|
||||
url => 'some_thing',
|
||||
});
|
||||
|
||||
my %thingProperties = (
|
||||
thingId => "THING_RECORD",
|
||||
label => 'Label',
|
||||
editScreenTitle => 'Edit',
|
||||
editInstructions => 'instruction_edit',
|
||||
groupIdAdd => '3',
|
||||
groupIdEdit => '3',
|
||||
saveButtonLabel => 'save',
|
||||
afterSave => 'searchThisThing',
|
||||
editTemplateId => "ThingyTmpl000000000003",
|
||||
groupIdView => '7',
|
||||
viewTemplateId => "ThingyTmpl000000000002",
|
||||
defaultView => 'searchThing',
|
||||
searchScreenTitle => 'Search',
|
||||
searchDescription => 'description_search',
|
||||
groupIdSearch => '7',
|
||||
groupIdExport => '7',
|
||||
groupIdImport => '7',
|
||||
searchTemplateId => "ThingyTmpl000000000004",
|
||||
thingsPerPage => 25,
|
||||
);
|
||||
my $thingId = $thingy->addThing(\%thingProperties);
|
||||
my $field1Id = $thingy->addField({
|
||||
thingId => $thingId,
|
||||
fieldId => "new",
|
||||
label => "textual",
|
||||
dateCreated => time(),
|
||||
fieldType => "text",
|
||||
status => "editable",
|
||||
display => 1,
|
||||
displayInSearch => 1,
|
||||
}, 0);
|
||||
|
||||
my ($thingDataId) = $thingy->editThingDataSave($thingId, 'new', {
|
||||
thingDataId => 'new',
|
||||
"field_$field1Id" => 'texty',
|
||||
});
|
||||
|
||||
my $thing_url = $thingy->getUrl('thingId='.$thingId.';thingDataId='.$thingDataId);
|
||||
my $output;
|
||||
|
||||
$output = WebGUI::Macro::RenderThingData::process($session, $thing_url);
|
||||
like $output, qr/specify a template/, 'returns an error message if no template is offered';
|
||||
ok !$templateProcessed, 'template not processed';
|
||||
$templateProcessed = 0;
|
||||
|
||||
$output = WebGUI::Macro::RenderThingData::process($session, $thing_url, $templateId);
|
||||
ok $templateProcessed, 'passed templateId, template processed';
|
||||
$templateProcessed = 0;
|
||||
|
||||
$output = WebGUI::Macro::RenderThingData::process($session, $thing_url, $templateUrl);
|
||||
ok $templateProcessed, 'passed template url, template processed';
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue