Merge branch 'master' of git@github.com:plainblack/webgui
This commit is contained in:
commit
9db3e02444
38 changed files with 898 additions and 228 deletions
|
|
@ -24,12 +24,12 @@ use WebGUI::Session;
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
plan tests => 20; # Increment this number for each test you create
|
||||
plan tests => 21; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
my @addChildArgs = ( {skipAutoCommitWorkflows=>1} );
|
||||
my @addChildArgs = ( {skipAutoCommitWorkflows=>1, skipNotification => 1, } );
|
||||
my $collab = WebGUI::Asset->getImportNode( $session )->addChild({
|
||||
className => 'WebGUI::Asset::Wobject::Collaboration',
|
||||
threadsPerPage => 20,
|
||||
|
|
@ -54,7 +54,7 @@ my @threads = (
|
|||
$_->setSkipNotification for @threads; # 100+ messages later...
|
||||
my $versionTag = WebGUI::VersionTag->getWorking( $session );
|
||||
$versionTag->commit;
|
||||
WebGUI::Test->tagsToRollback($versionTag);
|
||||
addToCleanup($versionTag);
|
||||
|
||||
my $templateVars;
|
||||
my $posts;
|
||||
|
|
@ -89,4 +89,51 @@ ok( !$posts->[0]->{'user.isVisitor'}, 'first post made by visitor');
|
|||
ok( $posts->[0]->{'hideProfileUrl'}, 'hide profile url, and user is visitor');
|
||||
ok( !$posts->[0]->{'lastReply.user.isVisitor'}, 'lastReply not made by visitor');
|
||||
ok( $posts->[0]->{'lastReply.hideProfileUrl'}, 'lastReply hide profile url, since user is visitor');
|
||||
|
||||
|
||||
###################################################################
|
||||
#
|
||||
#isSecond, isThird, etc.
|
||||
#
|
||||
###################################################################
|
||||
|
||||
my @newThreads = ();
|
||||
foreach my $index (1 .. 5) {
|
||||
$newThreads[$index] = $collab->addChild( {
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
title => "X - Bar",
|
||||
isSticky => 0,
|
||||
ownerUserId => 3,
|
||||
}, undef, 2+$index, @addChildArgs);
|
||||
$newThreads[$index]->setSkipNotification;
|
||||
}
|
||||
my $vt2 = WebGUI::VersionTag->getWorking($session);
|
||||
$vt2->commit;
|
||||
addToCleanup($versionTag);
|
||||
|
||||
$session->user({userId => 3});
|
||||
$templateVars = $collab->getViewTemplateVars();
|
||||
my $indexVars;
|
||||
foreach my $post (@{ $templateVars->{post_loop }}) {
|
||||
push @{$indexVars}, {
|
||||
isSecond => $post->{isSecond} ? 1 : 0,
|
||||
isThird => $post->{isThird} ? 1 : 0,
|
||||
isFourth => $post->{isFourth} ? 1 : 0,
|
||||
isFifth => $post->{isFifth} ? 1 : 0,
|
||||
};
|
||||
}
|
||||
|
||||
cmp_deeply(
|
||||
$indexVars,
|
||||
[
|
||||
{ isSecond => 0, isThird => 0, isFourth => 0, isFifth => 0, },
|
||||
{ isSecond => 1, isThird => 0, isFourth => 0, isFifth => 0, },
|
||||
{ isSecond => 0, isThird => 1, isFourth => 0, isFifth => 0, },
|
||||
{ isSecond => 0, isThird => 0, isFourth => 1, isFifth => 0, },
|
||||
{ isSecond => 0, isThird => 0, isFourth => 0, isFifth => 1, },
|
||||
{ isSecond => 0, isThird => 0, isFourth => 0, isFifth => 0, }, ##No modulo
|
||||
{ isSecond => 0, isThird => 0, isFourth => 0, isFifth => 0, }, ##No modulo
|
||||
],
|
||||
'checking isSecond, isThird, isFourth, isFifth'
|
||||
);
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
55
t/Content/SetLanguage.t
Normal file
55
t/Content/SetLanguage.t
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#-------------------------------------------------------------------
|
||||
# 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::Session;
|
||||
use WebGUI::Content::SetLanguage;
|
||||
|
||||
# load your modules here
|
||||
|
||||
use Test::More tests => 5; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
# put your tests here
|
||||
my $formvariables = {
|
||||
'op' =>'setLanguage',
|
||||
'language' => 'English'
|
||||
};
|
||||
#test 1
|
||||
$session->request->setup_body($formvariables);
|
||||
WebGUI::Content::SetLanguage::handler($session);
|
||||
is($session->scratch->getLanguageOverride, 'English', 'the language was not set');
|
||||
#test2
|
||||
$formvariables->{'language'} = 'delete';
|
||||
$session->request->setup_body($formvariables);
|
||||
WebGUI::Content::SetLanguage::handler($session);
|
||||
is($session->scratch->getLanguageOverride, undef, 'language delete should remove the scratch variable');
|
||||
#test3
|
||||
$formvariables->{'op'} = 'SetLanguage';
|
||||
$formvariables->{'language'} = 'English';
|
||||
$session->request->setup_body($formvariables);
|
||||
WebGUI::Content::SetLanguage::handler($session);
|
||||
is($session->scratch->getLanguageOverride, undef, 'Naming the method wrongly should not change anything');
|
||||
#test4
|
||||
$formvariables->{'op'} = 'setLanguage';
|
||||
$formvariables->{'language'} = 'MyImaginaryLanguageThatIsNotInstalled';
|
||||
$session->request->setup_body($formvariables);
|
||||
WebGUI::Content::SetLanguage::handler($session);
|
||||
is($session->scratch->getLanguageOverride, undef, 'Giving a non installed language should not change anything');
|
||||
#test5
|
||||
$formvariables->{'language'} = undef;
|
||||
$session->request->setup_body($formvariables);
|
||||
WebGUI::Content::SetLanguage::handler($session);
|
||||
is($session->scratch->getLanguageOverride, undef, 'Passing an empty language variable should return undef');
|
||||
|
||||
|
|
@ -16,12 +16,13 @@ use WebGUI::Session;
|
|||
use Test::More; # increment this value for each test you create
|
||||
use File::Copy;
|
||||
use File::Spec;
|
||||
use WebGUI::Content::SetLanguage;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $numTests = 1; ##For conditional load check
|
||||
my $langTests = 4; ##For language look-up tests
|
||||
$numTests += 12 + $langTests;
|
||||
$numTests += 20 + $langTests;
|
||||
|
||||
plan tests => $numTests;
|
||||
|
||||
|
|
@ -50,6 +51,16 @@ is($i18n->get('topicName', 'WebGUI'), 'WebGUI', 'get: test manual namespace over
|
|||
|
||||
installPigLatin();
|
||||
|
||||
#tests for sub new
|
||||
my $i18nNew1 = WebGUI::International->new($session);
|
||||
is($i18nNew1->{_language}, 'English', 'Calling new without parameters should return object with language English');
|
||||
is($i18nNew1->{_namespace}, 'WebGUI', 'Calling without parameters should give namespace WebgUI');
|
||||
my $i18nNew2 = WebGUI::International->new($session, 'WebGUI::Asset');
|
||||
is($i18nNew2->{_language}, 'English', 'Calling new with only namespace parameter should return object with language English');
|
||||
is($i18nNew2->{_namespace}, 'WebGUI::Asset', 'Calling with only parameter namespace should give requested namespace');
|
||||
my $i18nNew3 = WebGUI::International->new($session, undef , 'PigLatin');
|
||||
is($i18nNew3->{_language}, 'PigLatin', 'Calling new with only language parameter should return object with language PigLatin');
|
||||
is($i18nNew3->{_namespace}, 'WebGUI', 'Calling with only parameter namespace should give WebGUI ');
|
||||
my $languages = $i18n->getLanguages();
|
||||
|
||||
my $gotPigLatin = exists $languages->{PigLatin};
|
||||
|
|
@ -102,6 +113,24 @@ sub installPigLatin {
|
|||
);
|
||||
}
|
||||
|
||||
#test for sub new with language overridden by scratch
|
||||
my $formvariables = {
|
||||
'op' =>'setLanguage',
|
||||
'language' => 'PigLatin'
|
||||
};
|
||||
$session->request->setup_body($formvariables);
|
||||
WebGUI::Content::SetLanguage::handler($session);
|
||||
my $newi18n = WebGUI::International->new($session);
|
||||
is(
|
||||
$newi18n->get('webgui','WebGUI','PigLatin'),
|
||||
'ebGUIWay',
|
||||
'if the piglatin language is in the scratch that messages should be retrieved'
|
||||
);
|
||||
is(
|
||||
$newi18n->get('104','Asset','PigLatin'),
|
||||
$newi18n->get('104', 'WebGUI', 'English'),
|
||||
'Language check after SetLanguage contentHandler : key from missing file return English key'
|
||||
);
|
||||
END {
|
||||
unlink File::Spec->catfile(WebGUI::Test->lib, qw/WebGUI i18n PigLatin WebGUI.pm/);
|
||||
unlink File::Spec->catfile(WebGUI::Test->lib, qw/WebGUI i18n PigLatin.pm/);
|
||||
|
|
|
|||
|
|
@ -14,26 +14,14 @@ use lib "$FindBin::Bin/../lib";
|
|||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Macro::AdminBar;
|
||||
use HTML::TokeParser;
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $numTests = 2;
|
||||
|
||||
$numTests += 1; #For the use_ok
|
||||
|
||||
plan tests => $numTests;
|
||||
|
||||
my $macro = 'WebGUI::Macro::AdminBar';
|
||||
my $loaded = use_ok($macro);
|
||||
|
||||
my $originalAssets = $session->config->get('assets');
|
||||
|
||||
SKIP: {
|
||||
|
||||
skip "Unable to load $macro", $numTests-1 unless $loaded;
|
||||
plan tests => 2;
|
||||
|
||||
my $output;
|
||||
$output = WebGUI::Macro::AdminBar::process($session);
|
||||
|
|
@ -42,9 +30,3 @@ $session->var->switchAdminOn;
|
|||
$output = WebGUI::Macro::AdminBar::process($session);
|
||||
ok($output, 'AdminBar returns something when admin is on');
|
||||
|
||||
|
||||
}
|
||||
|
||||
END: {
|
||||
$session->config->set('assets', $originalAssets);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,22 +14,14 @@ use lib "$FindBin::Bin/../lib";
|
|||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Macro::AdminText;
|
||||
use Data::Dumper;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
|
||||
my $numTests = 6 + 1;
|
||||
|
||||
plan tests => $numTests;
|
||||
|
||||
my $macro = 'WebGUI::Macro::AdminText';
|
||||
my $loaded = use_ok($macro);
|
||||
|
||||
SKIP: {
|
||||
|
||||
skip "Unable to load $macro", $numTests-1 unless $loaded;
|
||||
plan tests => 6;
|
||||
|
||||
my $output;
|
||||
|
||||
|
|
@ -54,5 +46,3 @@ is($output, undef, 'undef text');
|
|||
$session->var->switchAdminOff;
|
||||
$output = WebGUI::Macro::AdminText::process($session, 'admin');
|
||||
is($output, '', 'user is admin, not in admin mode');
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,13 @@ use WebGUI::Test;
|
|||
use WebGUI::Session;
|
||||
use HTML::TokeParser;
|
||||
use Data::Dumper;
|
||||
use WebGUI::Macro::AdminToggle;
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my ($versionTag, $template) = addTemplate();
|
||||
my $template = addTemplate();
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
$session->asset($homeAsset);
|
||||
|
|
@ -105,14 +106,7 @@ foreach my $testSet (@testSets) {
|
|||
$numTests += 1 + (ref $testSet->{output} eq 'CODE');
|
||||
}
|
||||
|
||||
plan tests => $numTests + 2; ##conditional module load and TODO at end
|
||||
|
||||
my $macro = 'WebGUI::Macro::AdminToggle';
|
||||
my $loaded = use_ok($macro);
|
||||
|
||||
SKIP: {
|
||||
|
||||
skip "Unable to load $macro", $numTests-1 unless $loaded;
|
||||
plan tests => $numTests + 1; ##conditional module load and TODO at end
|
||||
|
||||
foreach my $testSet (@testSets) {
|
||||
$session->user({userId=>$testSet->{userId}});
|
||||
|
|
@ -136,8 +130,6 @@ foreach my $testSet (@testSets) {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TODO: {
|
||||
local $TODO = 'Tests to make later';
|
||||
ok(0, 'Run tests with a user other than Admin');
|
||||
|
|
@ -159,7 +151,8 @@ sub addTemplate {
|
|||
};
|
||||
my $template = $importNode->addChild($properties, $properties->{id});
|
||||
$versionTag->commit;
|
||||
return ($versionTag, $template);
|
||||
addToCleanup($versionTag);
|
||||
return $template;
|
||||
}
|
||||
|
||||
sub simpleHTMLParser {
|
||||
|
|
@ -181,9 +174,3 @@ sub simpleTextParser {
|
|||
|
||||
return ($url, $label);
|
||||
}
|
||||
|
||||
END {
|
||||
if (defined $versionTag and ref $versionTag eq 'WebGUI::VersionTag') {
|
||||
$versionTag->rollback;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,23 +14,17 @@ use lib "$FindBin::Bin/../lib";
|
|||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Macro::At_username;
|
||||
use Data::Dumper;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
|
||||
my $numTests = 2 + 1; # For conditional load and skip
|
||||
my $numTests = 2; # For conditional load and skip
|
||||
|
||||
plan tests => $numTests;
|
||||
|
||||
my $macro = 'WebGUI::Macro::At_username';
|
||||
my $loaded = use_ok($macro);
|
||||
|
||||
SKIP: {
|
||||
|
||||
skip "Unable to load $macro", $numTests-1 unless $loaded;
|
||||
|
||||
my $output;
|
||||
|
||||
$session->user({userId => 1});
|
||||
|
|
@ -41,4 +35,3 @@ $session->user({userId => 3});
|
|||
$output = WebGUI::Macro::At_username::process($session);
|
||||
is($output, 'Admin', 'username = Admin');
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ my $session = WebGUI::Test->session;
|
|||
use Test::More; # increment this value for each test you create
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
my ($versionTag, $asset, $group, @users) = setupTest($session, $homeAsset);
|
||||
my ($asset, $group, @users) = setupTest($session, $homeAsset);
|
||||
|
||||
my @testSets = (
|
||||
{
|
||||
|
|
@ -111,17 +111,6 @@ sub setupTest {
|
|||
$users[1]->addToGroups([$cm->getId]);
|
||||
##User 2 is a member of a content manager sub-group
|
||||
$users[2]->addToGroups([$editGroup->getId]);
|
||||
return ($versionTag, $asset, $editGroup, @users);
|
||||
}
|
||||
|
||||
END { ##Clean-up after yourself, always
|
||||
if (defined $versionTag and ref $versionTag eq 'WebGUI::VersionTag') {
|
||||
$versionTag->rollback;
|
||||
}
|
||||
foreach my $testGroup ($group) {
|
||||
$testGroup->delete if (defined $testGroup and ref $testGroup eq 'WebGUI::Group');
|
||||
}
|
||||
foreach my $dude (@users) {
|
||||
$dude->delete if (defined $dude and ref $dude eq 'WebGUI::User');
|
||||
}
|
||||
addToCleanup($versionTag, $editGroup, @users);
|
||||
return ($asset, $editGroup, @users);
|
||||
}
|
||||
|
|
|
|||
125
t/Macro/PickLanguage.t
Normal file
125
t/Macro/PickLanguage.t
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
#-------------------------------------------------------------------
|
||||
# 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::Session;
|
||||
use WebGUI::Asset::Template;
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
use Test::MockObject;
|
||||
use Test::MockObject::Extends;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $numTests = 3;
|
||||
|
||||
$numTests += 1; #For the use_ok
|
||||
|
||||
plan tests => $numTests;
|
||||
|
||||
my $macro = 'WebGUI::Macro::PickLanguage';
|
||||
my $loaded = use_ok($macro);
|
||||
|
||||
my $macroMock = Test::MockObject->new({});
|
||||
$macroMock->set_isa('WebGUI::Macro::PickLanguage');
|
||||
$macroMock->set_true('process');
|
||||
|
||||
#test for normal use
|
||||
|
||||
my $templateId = 'PICKLANGUAGE_TEMPLATE_';
|
||||
|
||||
my $templateMock = Test::MockObject->new({});
|
||||
$templateMock->set_isa('WebGUI::Asset::Template');
|
||||
$templateMock->set_always('getId', $templateId);
|
||||
my $templateVars;
|
||||
$templateMock->mock('process', sub { $templateVars = $_[1]; } );
|
||||
|
||||
|
||||
{
|
||||
WebGUI::Test->mockAssetId($templateId, $templateMock);
|
||||
WebGUI::Macro::PickLanguage::process($session,$templateMock->getId);
|
||||
|
||||
cmp_deeply(
|
||||
$templateVars,
|
||||
{
|
||||
lang_loop => [
|
||||
{ 'language_url' => '?op=setLanguage;language=English',
|
||||
'language_lang' => 'English',
|
||||
'language_langAbbr' => 'en',
|
||||
'language_langAbbrLoc' => 'US',
|
||||
'language_langEng' => 'English'
|
||||
},
|
||||
],
|
||||
},
|
||||
'some template variables are created'
|
||||
);
|
||||
WebGUI::Test->unmockAssetId($templateId);
|
||||
}
|
||||
|
||||
#test when template Id is left empty
|
||||
|
||||
$templateId = '';
|
||||
my $templateNoId = $templateMock->mock('process','');
|
||||
$templateMock->set_always('getId', $templateId);
|
||||
$templateMock->mock('process', sub { $templateVars = $_[1]; } );
|
||||
|
||||
{
|
||||
|
||||
WebGUI::Test->mockAssetId($templateId, $templateMock);
|
||||
WebGUI::Macro::PickLanguage::process($session,$templateMock->getId);
|
||||
|
||||
cmp_deeply(
|
||||
$templateVars,
|
||||
{
|
||||
lang_loop => [
|
||||
{ 'language_url' => '?op=setLanguage;language=English',
|
||||
'language_lang' => 'English',
|
||||
'language_langAbbr' => 'en',
|
||||
'language_langAbbrLoc' => 'US',
|
||||
'language_langEng' => 'English'
|
||||
},
|
||||
],
|
||||
},
|
||||
'some template variables are created, when no templateId is passed on with the macro'
|
||||
);
|
||||
WebGUI::Test->unmockAssetId($templateId);
|
||||
}
|
||||
|
||||
|
||||
#{
|
||||
# WebGUI::Test->mockAssetId($templateNoId, $templateMock);
|
||||
# $error = WebGUI::Macro::PickLanguage::process($session,$templateMock->getId);
|
||||
#
|
||||
# is($error,'Could not instanciate template with id []',"Empty template Id should return error");
|
||||
#
|
||||
# WebGUI::Test->unmockAssetId($templateNoId);
|
||||
#}
|
||||
|
||||
#test for an incorrect template Id
|
||||
|
||||
$templateId = '1234567890123456789012';
|
||||
my $templateWrongId = $templateMock->mock('process','');
|
||||
$templateMock->set_always('getId', $templateId);
|
||||
$templateMock->mock('process', sub { $templateVars = $_[1]; } );
|
||||
my $error;
|
||||
|
||||
|
||||
{
|
||||
WebGUI::Test->mockAssetId($templateWrongId, $templateMock);
|
||||
$error = WebGUI::Macro::PickLanguage::process($session,$templateMock->getId);
|
||||
|
||||
is($error,'Could not instanciate template with id [1234567890123456789012]',"Template from the wrong namespace should not be initiated");
|
||||
WebGUI::Test->unmockAssetId($templateWrongId);
|
||||
}
|
||||
|
||||
|
|
@ -16,13 +16,14 @@ use WebGUI::Test;
|
|||
use WebGUI::Session;
|
||||
use HTML::TokeParser;
|
||||
use Data::Dumper;
|
||||
use WebGUI::Macro::a_account;
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
# <a class="myAccountLink" href="<tmpl_var account.url>"><tmpl_var account.text></a>
|
||||
my ($versionTag, $template) = addTemplate();
|
||||
my $template = addTemplate();
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
|
||||
|
|
@ -65,17 +66,8 @@ foreach my $testSet (@testSets) {
|
|||
$numTests += 1 + (ref $testSet->{output} eq 'CODE');
|
||||
}
|
||||
|
||||
$numTests += 1; #For the use_ok
|
||||
|
||||
plan tests => $numTests;
|
||||
|
||||
my $macro = 'WebGUI::Macro::a_account';
|
||||
my $loaded = use_ok($macro);
|
||||
|
||||
SKIP: {
|
||||
|
||||
skip "Unable to load $macro", $numTests-1 unless $loaded;
|
||||
|
||||
foreach my $testSet (@testSets) {
|
||||
my $output = WebGUI::Macro::a_account::process( $session,
|
||||
$testSet->{label}, $testSet->{template} );
|
||||
|
|
@ -90,8 +82,6 @@ foreach my $testSet (@testSets) {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub addTemplate {
|
||||
$session->user({userId=>3});
|
||||
my $importNode = WebGUI::Asset->getImportNode($session);
|
||||
|
|
@ -108,7 +98,8 @@ sub addTemplate {
|
|||
};
|
||||
my $template = $importNode->addChild($properties, $properties->{id});
|
||||
$versionTag->commit;
|
||||
return ($versionTag, $template);
|
||||
addToCleanup($versionTag);
|
||||
return $template;
|
||||
}
|
||||
|
||||
sub simpleHTMLParser {
|
||||
|
|
@ -130,9 +121,3 @@ sub simpleTextParser {
|
|||
|
||||
return ($url, $label);
|
||||
}
|
||||
|
||||
END {
|
||||
if (defined $versionTag and ref $versionTag eq 'WebGUI::VersionTag') {
|
||||
$versionTag->rollback;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,9 +122,7 @@ $mail = WebGUI::Mail::Send->create( $session, {
|
|||
});
|
||||
$mail->addHeaderField('List-ID', "H\x{00C4}ufige Fragen");
|
||||
my $messageId = $mail->queue;
|
||||
diag $messageId;
|
||||
my $dbMail = WebGUI::Mail::Send->retrieve($session, $messageId);
|
||||
diag ref $dbMail;
|
||||
is($dbMail->getMimeEntity->head->get('List-ID'), "=?UTF-8?Q?H=C3=84ufige=20Fragen?=\n", 'addHeaderField: handles utf-8 correctly');
|
||||
|
||||
# TODO: Test that addHtml creates a body with the right content type
|
||||
|
|
@ -337,7 +335,7 @@ $mail->send;
|
|||
is(scalar @mailIds, $startingMessages+2, 'sending a message with a group added two messages');
|
||||
|
||||
@mailIds = $session->db->buildArray("select messageId from mailQueue where message like ?",['%Mail::Send test message%']);
|
||||
is(scalar @mailIds, $startingMessages+2, 'sending a message with a group added the right two messages');
|
||||
is(scalar @mailIds, 2, 'sending a message with a group added the right two messages');
|
||||
|
||||
my @emailAddresses = ();
|
||||
foreach my $mailId (@mailIds) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use lib "$FindBin::Bin/../lib";
|
|||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
|
||||
use Test::More tests => 58; # increment this value for each test you create
|
||||
use Test::More tests => 62; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
|
@ -117,6 +117,16 @@ is($sessionBank[0]->scratch->deleteNameByValue('',''), undef, 'deleteNameByValue
|
|||
is($sessionBank[3]->scratch->deleteNameByValue('falseValue','0'), 1, 'deleteNameByValue will delete values that are false (0)');
|
||||
is($sessionBank[2]->scratch->deleteNameByValue('falseValue',''), 1, "deleteNameByValue will delete values that are false ('')");
|
||||
|
||||
$scratch->setLanguageOverride('English');
|
||||
is($scratch->getLanguageOverride, 'English', 'session scratch language is not correctly set');
|
||||
$scratch->removeLanguageOverride;
|
||||
is($scratch->getLanguageOverride, undef, 'The session scratch variable language is not removed');
|
||||
$scratch->setLanguageOverride('myimmaginarylanguagethatisnotinstalled');
|
||||
is($scratch->getLanguageOverride, undef, 'A non-existing language is set');
|
||||
$scratch->setLanguageOverride('English');
|
||||
$scratch->setLanguageOverride();
|
||||
is($scratch->getLanguageOverride, 'English', 'A empty string is falsely recognised as a language');
|
||||
|
||||
END {
|
||||
$session->scratch->deleteAll;
|
||||
foreach my $wgSess ($newSession, @sessionBank) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue