Commit | Line | Data |
6dd4c89d |
1 | use strict; |
2 | |
3 | use Test::More tests => 10; |
4 | |
5 | use lib 't'; |
6 | use mock; |
7 | |
8 | my $CLASS = 'Excel::Template'; |
9 | use_ok( $CLASS ); |
10 | |
11 | { |
c11fa570 |
12 | mock::reset; |
6dd4c89d |
13 | my $object = $CLASS->new( |
14 | renderer => 'big', |
15 | filename => 't/016.xml', |
16 | ); |
17 | isa_ok( $object, $CLASS ); |
18 | |
19 | ok( $object->write_file( 'filename' ), 'Something returned' ); |
20 | |
c11fa570 |
21 | my @calls = mock::get_calls; |
6dd4c89d |
22 | is( join( $/, @calls, '' ), <<__END_EXPECTED__, 'Calls match up' ); |
23 | Spreadsheet::WriteExcel::Big::new( 'filename' ) |
24 | Spreadsheet::WriteExcel::Big::add_format( '' ) |
25 | Spreadsheet::WriteExcel::Big::close( '' ) |
26 | __END_EXPECTED__ |
27 | } |
28 | |
29 | { |
c11fa570 |
30 | mock::reset; |
6dd4c89d |
31 | my $object = $CLASS->new( |
32 | renderer => Excel::Template->RENDER_XML, |
33 | filename => 't/016.xml', |
34 | ); |
35 | isa_ok( $object, $CLASS ); |
36 | |
37 | ok( $object->write_file( 'filename' ), 'Something returned' ); |
38 | |
c11fa570 |
39 | my @calls = mock::get_calls; |
6dd4c89d |
40 | is( join( $/, @calls, '' ), <<__END_EXPECTED__, 'Calls match up' ); |
41 | Spreadsheet::WriteExcelXML::new( 'filename' ) |
9ee3aea0 |
42 | Spreadsheet::WriteExcelXML::add_format( '' ) |
6dd4c89d |
43 | Spreadsheet::WriteExcelXML::close( '' ) |
44 | __END_EXPECTED__ |
45 | } |
46 | |
47 | { |
c11fa570 |
48 | mock::reset; |
6dd4c89d |
49 | my $object = $CLASS->new( |
50 | renderer => Excel::Template->RENDER_NML, |
51 | filename => 't/016.xml', |
52 | ); |
53 | isa_ok( $object, $CLASS ); |
54 | |
55 | ok( $object->write_file( 'filename' ), 'Something returned' ); |
56 | |
c11fa570 |
57 | my @calls = mock::get_calls; |
6dd4c89d |
58 | is( join( $/, @calls, '' ), <<__END_EXPECTED__, 'Calls match up' ); |
59 | Spreadsheet::WriteExcel::new( 'filename' ) |
9ee3aea0 |
60 | Spreadsheet::WriteExcel::add_format( '' ) |
6dd4c89d |
61 | Spreadsheet::WriteExcel::close( '' ) |
62 | __END_EXPECTED__ |
63 | } |