Skip to content
Permalink
Browse files

Update this test to not use getPage.

  • Loading branch information...
perlDreamer committed Nov 4, 2011
1 parent 3ba6d43 commit 42ed112d1f8cf39313ec6f3f5cccaaf546e2cc8f
Showing with 29 additions and 18 deletions.
  1. +29 −18 t/Asset/Wobject/Layout.t
@@ -16,9 +16,9 @@ use lib "$FindBin::Bin/../../lib";
use Test::MockTime qw/:all/; ##Must be loaded before all other code
use WebGUI::Test;
use WebGUI::Session;
use Test::More tests => 5; # increment this value for each test you create
use Test::More;
use WebGUI::Asset::Wobject::Layout;
use WebGUI::Asset::Template;
use WebGUI::Asset;

my $session = WebGUI::Test->session;

@@ -67,23 +67,34 @@ is $page->getContentLastModifiedBy, $revised_user1->userId, '... check that a ne

# inheriting mobileStyleTemplateId and mobileTemplateId; from ``Mobile template is not being inherited (#12246)''

my $importNode = WebGUI::Asset::Template->getImportNode($session);
my $template1 = $importNode->addChild({className=>"WebGUI::Asset::Template"});
my $template2 = $importNode->addChild({className=>"WebGUI::Asset::Template"});
WebGUI::Test->addToCleanup($template1, $template2);
$session->setting->set('useMobileStyle', 1);
$session->setting->set('anonymousRegistration', 1);

my $importNode = WebGUI::Asset->getImportNode($session);
my $template1 = $importNode->addChild({className=>"WebGUI::Asset::Template", namespace => 'style', });
my $template2 = $importNode->addChild({className=>"WebGUI::Asset::Template", namespace => 'Layout', });

my $mobileStyleTemplateId = $template1->getId;
my $mobileTemplateId = $template2->getId;
$page->update({ mobileStyleTemplateId => $mobileStyleTemplateId, mobileTemplateId => $mobileTemplateId });
my $url = $page->get('url') . '/layout_child_test';
my $html = WebGUI::Test->getPage($page, "www_add", {
userId => 3,
formParams => {
class => 'WebGUI::Asset::Wobject::Layout',
url => $page->get('url') . '/layout_child_test',
},
});

like $html, qr/name="mobileTemplateId" value="$mobileTemplateId"/, 'child PageLayout inherited parents mobileTempaleId';
like $html, qr/name="mobileStyleTemplateId" value="$mobileStyleTemplateId"/, 'child PageLayout inherited parents mobileStyleTempaleId';

my $mobile_page = $importNode->addChild({
className => "WebGUI::Asset::Wobject::Layout",
mobileStyleTemplateId => $mobileStyleTemplateId,
mobileTemplateId => $mobileTemplateId, }
);
WebGUI::Test->addToCleanup($template1, $template2);

my $tag = WebGUI::VersionTag->getWorking($session);
$tag->commit;
WebGUI::Test->addToCleanup($tag);

my $mech = WebGUI::Test::Mechanize->new( config => WebGUI::Test->config );
$mech->get_ok('/');
$mech->session->user({userId => 3});
$mech->get_ok($mobile_page->getUrl('func=add;userId=3;className=WebGUI::Asset::Wobject::Layout'));
my ($mobileTemplateInput) = $mech->find_all_inputs(name => 'mobileTemplateId');
is $mobileTemplateInput->value, $mobileTemplateId, 'child PageLayout inherited parents mobileTemplateId';
my ($mobileStyleTemplateInput) = $mech->find_all_inputs(name => 'mobileStyleTemplateId');
is $mobileStyleTemplateInput->value, $mobileStyleTemplateId, 'child PageLayout inherited parents mobileStyleTemplateId';

done_testing;

0 comments on commit 42ed112

Please sign in to comment.
You can’t perform that action at this time.