Fixing some failing tests
This commit is contained in:
parent
93ce217ad9
commit
c86ee12651
4 changed files with 26 additions and 9 deletions
|
|
@ -2627,15 +2627,14 @@ sub setState {
|
|||
stateChanged = ?
|
||||
WHERE assetId = ?
|
||||
};
|
||||
my @props = ($state, $self->session->user->userId, time);
|
||||
$self->session->db->write(
|
||||
$sql, [
|
||||
$state,
|
||||
$self->session->user->userId,
|
||||
time,
|
||||
@props,
|
||||
$self->getId,
|
||||
]
|
||||
);
|
||||
$self->{_properties}->{state} = $state;
|
||||
@{$self->{_properties}}{qw(state stateChangedBy stateChanged)} = @props;
|
||||
$self->purgeCache;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -328,7 +328,16 @@ sub trash {
|
|||
$outputSub->($i18n->get('Clearing cache'));
|
||||
$asset->purgeCache;
|
||||
$asset->updateHistory("trashed");
|
||||
$asset->setState($asset->getId eq $rootId ? 'trash' : 'trash-limbo');
|
||||
if ($asset->getId eq $rootId) {
|
||||
$asset->setState('trash');
|
||||
# setState will take care of _properties in $asset, but not in
|
||||
# $self (whooops!), so we need to manually update.
|
||||
my @keys = qw(state stateChangedBy stateChanged);
|
||||
@{$self->{_properties}}{@keys} = @{$asset->{_properties}}{@keys};
|
||||
}
|
||||
else {
|
||||
$asset->setState('trash-limbo');
|
||||
}
|
||||
}
|
||||
$db->commit;
|
||||
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ checkModule("CHI", "0.34" );
|
|||
checkModule('IO::Socket::SSL', );
|
||||
checkModule('Net::Twitter', "3.13006" );
|
||||
checkModule('PerlIO::eol', "0.14" );
|
||||
checkModule('Monkey::Patch', '0.3' );
|
||||
checkModule('Monkey::Patch', '0.03' );
|
||||
|
||||
failAndExit("Required modules are missing, running no more checks.") if $missingModule;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ use WebGUI::Session;
|
|||
use WebGUI::Utility;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::VersionTag;
|
||||
use Test::MockObject;
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
plan tests => 29;
|
||||
|
|
@ -148,12 +149,20 @@ sub copied {
|
|||
return undef;
|
||||
}
|
||||
|
||||
my @methods = qw(Single Children Descendants);
|
||||
my $process = Test::MockObject->new->mock(update => sub {});
|
||||
my @methods = (
|
||||
# single duplicate doesn't fork, so we can just test the www method to
|
||||
# make sure it gets it right
|
||||
sub { shift->www_copy },
|
||||
sub { shift->duplicateBranch(1, 'clipboard') },
|
||||
sub { shift->duplicateBranch(0, 'clipboard') },
|
||||
);
|
||||
my @prefixes = qw(single children descendants);
|
||||
for my $i (0..2) {
|
||||
my $meth = "_wwwCopy$methods[$i]";
|
||||
my $meth = $methods[$i];
|
||||
$root->$meth();
|
||||
my $clip = copied();
|
||||
is_tree_of_folders($clip, $i+1, $meth);
|
||||
is_tree_of_folders($clip, $i+1, @prefixes[$i]);
|
||||
$clip->purge;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue