Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # lets test that our new template variable for the fileloop in the main view method returns the
- # right values for the new field in the attached files loop: <tmpl_var extension>
- # first we create a new template with only the <tmpl_var extension> field in it
- # --------------------------------------------------------------------------------------------------
- my $viewTemplate = $node->addChild({className=>'WebGUI::Asset::Template'});
- my $tmplContent = "<tmpl_if attachment_loop><tmpl_loop attachment_loop><tmpl_var extension>|</tmpl_loop></tmpl_if>";
- my $newTemplateSettings = {
- namespace => 'Article',
- template => $tmplContent,
- };
- my @extTestFiles = ("rotation_test.png","littleTextFile","jquery.js","tooWide.gif");
- foreach my $f (@extTestFiles) {
- my $pathedFile = WebGUI::Test->getTestCollateralPath($f);
- my $storedFilename = $storage->addFileFromFilesystem($pathedFile);
- }
- $viewTemplate->update($newTemplateSettings);
- $article->update({templateId=>$viewTemplate->getId});
- $article->prepareView;
- my $newFieldoutput = $article->view;
- $newFieldoutput =~ s/\|$//;
- my @tmplExtensions = split /\|/,$newFieldoutput;
- my $extPassed = 1;
- # rememer there is a tar file already stored from earlier test, we reuse this.
- if ( $tmplExtensions[0] ne "tar") {$extPassed = 0;}
- if ( $tmplExtensions[1] ne "png") {$extPassed = 0;}
- if ( $tmplExtensions[2] ne "") {$extPassed = 0;}
- if ( $tmplExtensions[3] ne "js") {$extPassed = 0;}
- if ( $tmplExtensions[4] ne "gif") {$extPassed = 0;}
- ok ($extPassed, 'extension template variable in fileLoop working');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement