From 6b378ca7ca0e5fc0933ea90fc66a45d7440b08f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Mon, 16 Jan 2012 18:38:39 +0100 Subject: [PATCH] Tests von Dispatcher auf TestSetup umgeschrieben. Dispatcher kann keine validen Datenbankhandle zur richtigen Zeit bereitstellen, und die Mechanismen gegen kaputte DB Handle vertragen sich nicht mit reinem offline Testing. --- t/helper/attr.t | 10 ++++------ t/helper/csv.t | 21 ++++++++------------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/t/helper/attr.t b/t/helper/attr.t index ef49d8e74..3fc0607d5 100644 --- a/t/helper/attr.t +++ b/t/helper/attr.t @@ -1,21 +1,19 @@ use Test::More tests => 29; +use lib 't'; + use DateTime; +use_ok 'Support::TestSetup'; use_ok 'SL::DB::Part'; use_ok 'SL::DB::Order'; use_ok 'SL::DB::Invoice'; -use_ok 'SL::Dispatcher'; +Support::TestSetup::login(); { -$::dispatcher = SL::Dispatcher->new; -$::dispatcher->pre_startup_setup; -no warnings 'once'; -$::form = Form->new; $::myconfig{numberformat} = '1.000,00'; $::myconfig{dateformat} = 'dd.mm.yyyy'; -$::locale = Locale->new('de'); } my $p = new_ok 'SL::DB::Part'; diff --git a/t/helper/csv.t b/t/helper/csv.t index a78a6a960..4e7ef121c 100644 --- a/t/helper/csv.t +++ b/t/helper/csv.t @@ -1,12 +1,16 @@ -use Test::More tests => 39; -use SL::Dispatcher; +use Test::More tests => 40; + +use lib 't'; + use Data::Dumper; use utf8; +use_ok 'Support::TestSetup'; use_ok 'SL::Helper::Csv'; -my $csv; -$csv = SL::Helper::Csv->new( +Support::TestSetup::login(); + +my $csv = SL::Helper::Csv->new( file => \"Kaffee\n", header => [ 'description' ], class => 'SL::DB::Part', @@ -17,20 +21,11 @@ isa_ok $csv->_io, 'IO::File'; isa_ok $csv->parse, 'SL::Helper::Csv', 'parsing returns self'; is_deeply $csv->get_data, [ { description => 'Kaffee' } ], 'simple case works'; - is $csv->get_objects->[0]->description, 'Kaffee', 'get_object works'; #### -{ -no warnings 'once'; -$::dispatcher = SL::Dispatcher->new; -$::dispatcher->pre_startup_setup(); -} - -$::form = Form->new; $::myconfig{numberformat} = '1.000,00'; $::myconfig{dateformat} = 'dd.mm.yyyy'; -$::locale = Locale->new('de'); $csv = SL::Helper::Csv->new( file => \"Kaffee;0.12;12,2;1,5234\n", -- 2.20.1