Convert Shop::Pay to use Moose instead of Class::InsideOut. Update tests, and core usages to Moose syntax. Provide a shim so the old, base ->new($session) syntax.
This commit is contained in:
parent
3fbc109429
commit
9678c3d8a7
5 changed files with 39 additions and 62 deletions
33
t/Shop/Pay.t
33
t/Shop/Pay.t
|
|
@ -18,7 +18,7 @@ use strict;
|
|||
use lib "$FindBin::Bin/../lib";
|
||||
use Test::More;
|
||||
use Test::Deep;
|
||||
#use Test::Exception;
|
||||
use Test::Exception;
|
||||
use JSON;
|
||||
use HTML::Form;
|
||||
|
||||
|
|
@ -30,12 +30,6 @@ use WebGUI::TestException;
|
|||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
my $tests = 18;
|
||||
plan tests => 1 + $tests;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# put your tests here
|
||||
|
||||
|
|
@ -45,31 +39,19 @@ my $storage;
|
|||
my $newDriver;
|
||||
my $anotherDriver;
|
||||
|
||||
SKIP: {
|
||||
|
||||
skip 'Unable to load module WebGUI::Shop::Pay', $tests unless $loaded;
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# new
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
my $e;
|
||||
my $pay;
|
||||
|
||||
dies_ok { $pay = WebGUI::Shop::Pay->new(); }
|
||||
'new takes an exception to not giving it a session variable';
|
||||
|
||||
throws_deeply ( sub { $pay = WebGUI::Shop::Pay->new(); },
|
||||
'WebGUI::Error::InvalidObject',
|
||||
{
|
||||
error => 'Must provide a session variable',
|
||||
got => '',
|
||||
expected => 'WebGUI::Session',
|
||||
},
|
||||
'new takes an exception to not giving it a session variable'
|
||||
);
|
||||
|
||||
$pay = WebGUI::Shop::Pay->new($session);
|
||||
lives_ok { $pay = WebGUI::Shop::Pay->new(session => $session); } 'new called with hash arguments';
|
||||
lives_ok { $pay = WebGUI::Shop::Pay->new($session); } 'new called only with session';
|
||||
isa_ok($pay, 'WebGUI::Shop::Pay', 'new returned the right kind of object');
|
||||
|
||||
#######################################################################
|
||||
|
|
@ -232,14 +214,11 @@ cmp_bag(
|
|||
#
|
||||
#######################################################################
|
||||
|
||||
|
||||
}
|
||||
done_testing();
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Cleanup
|
||||
END {
|
||||
defined $newDriver and $newDriver->delete;
|
||||
defined $newDriver and $anotherDriver->delete;
|
||||
my $count = $session->db->quickScalar('select count(*) from paymentGateway');
|
||||
is($count, 2, 'WebGUI ships with two drivers by default');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue