Revision 196cb3e0
Von Kivitendo Admin vor mehr als 7 Jahren hinzugefügt
SL/Dev/ALL.pm | ||
---|---|---|
7 | 7 |
use SL::Dev::Inventory; |
8 | 8 |
use SL::Dev::Record; |
9 | 9 |
use SL::Dev::Payment; |
10 |
use SL::Dev::Shop; |
|
10 | 11 |
|
11 | 12 |
1; |
12 | 13 |
|
SL/Dev/Shop.pm | ||
---|---|---|
1 |
package SL::Dev::Shop; |
|
2 |
|
|
3 |
use strict; |
|
4 |
use base qw(Exporter); |
|
5 |
our @EXPORT = qw(create_shop create_shop_part create_shop_order); |
|
6 |
|
|
7 |
use SL::DB::Shop; |
|
8 |
|
|
9 |
sub create_shop { |
|
10 |
my (%params) = @_; |
|
11 |
|
|
12 |
my $shop = SL::DB::Shop->new( |
|
13 |
description => 'testshop', |
|
14 |
%params |
|
15 |
); |
|
16 |
return $shop; |
|
17 |
} |
|
18 |
|
|
19 |
sub create_shop_part { |
|
20 |
my (%params) = @_; |
|
21 |
|
|
22 |
my $part = delete $params{part}; |
|
23 |
my $shop = delete $params{shop}; |
|
24 |
|
|
25 |
my $shop_part = SL::DB::ShopPart->new( |
|
26 |
part => $part, |
|
27 |
shop => $shop, |
|
28 |
%params |
|
29 |
)->save; |
|
30 |
return $shop_part; |
|
31 |
} |
|
32 |
|
|
33 |
sub create_shop_order { |
|
34 |
my (%params) = @_; |
|
35 |
|
|
36 |
my $shop_order = SL::DB::ShopOrder->new( |
|
37 |
shop => $params{shop}, |
|
38 |
%params |
|
39 |
); |
|
40 |
return $shop_order; |
|
41 |
} |
|
42 |
|
|
43 |
|
|
44 |
1; |
|
45 |
|
|
46 |
__END__ |
|
47 |
|
|
48 |
=head1 NAME |
|
49 |
|
|
50 |
SL::Dev::Shop - create shop objects for testing, with minimal defaults |
|
51 |
|
|
52 |
=head1 FUNCTIONS |
|
53 |
|
|
54 |
=head2 C<create_shop %PARAMS> |
|
55 |
|
|
56 |
Creates a new shop object. |
|
57 |
|
|
58 |
my $shop = SL::Dev::Shop::create_shop(); |
|
59 |
|
|
60 |
Add a part as a shop part to the shop: |
|
61 |
|
|
62 |
my $part = SL::Dev::Part::create_part(); |
|
63 |
$shop->add_shop_parts( SL::DB::ShopPart->new(part => $part, shop_description => 'Simply the best part!' ) ); |
|
64 |
$shop->save; |
|
65 |
|
|
66 |
|
|
67 |
=head1 BUGS |
|
68 |
|
|
69 |
Nothing here yet. |
|
70 |
|
|
71 |
=head1 AUTHOR |
|
72 |
|
|
73 |
G. Richardson E<lt>grichardson@kivitendo-premium.deE<gt> |
|
74 |
|
|
75 |
=cut |
Auch abrufbar als: Unified diff
SL/Dev/Shop - erste Version von Shop Dev