Do not send emails when a Post or Thread is copied inside WebGUI. Fixes bug #12024.
This commit is contained in:
parent
ca54f439e9
commit
8c2958b042
3 changed files with 41 additions and 4 deletions
|
|
@ -16,7 +16,7 @@ use strict;
|
|||
use lib "$FindBin::Bin/../../lib";
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use Test::More tests => 9; # increment this value for each test you create
|
||||
use Test::More tests => 12; # increment this value for each test you create
|
||||
use WebGUI::Asset::Wobject::Collaboration;
|
||||
use WebGUI::Asset::Post;
|
||||
use WebGUI::Asset::Post::Thread;
|
||||
|
|
@ -101,5 +101,30 @@ is $url,
|
|||
$expected_url,
|
||||
'url UTF8 checks out';
|
||||
|
||||
my $before_copy = $session->db->quickScalar('select count(*) from mailQueue');
|
||||
|
||||
{
|
||||
|
||||
##Disable sending email
|
||||
my $sendmock = Test::MockObject->new( {} );
|
||||
$sendmock->set_isa('WebGUI::Mail::Send');
|
||||
$sendmock->set_true('addText', 'send', 'addHeaderField', 'addHtml', 'queue', 'addFooter');
|
||||
my $was_sent = 0;
|
||||
my $was_queued = 0;
|
||||
$sendmock->set_bound('send', $was_sent);
|
||||
$sendmock->set_bound('queue', $was_queued);
|
||||
local *WebGUI::Mail::Send::create;
|
||||
$sendmock->fake_module('WebGUI::Mail::Send',
|
||||
create => sub { return $sendmock },
|
||||
);
|
||||
|
||||
my $t1p1_copy = $t1p1->duplicate();
|
||||
WebGUI::Test->addToCleanup($t1p1_copy);
|
||||
is $was_sent, 0, 'email not sent when Post is duplicated';
|
||||
is $was_queued, 0, '... nor queued';
|
||||
my $after_copy = $session->db->quickScalar('select count(*) from mailQueue');
|
||||
is $after_copy, $before_copy, '... and no additional mails in the queue';
|
||||
}
|
||||
|
||||
#vim:ft=perl
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue