Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a4684ad1

Von Martin Helmling martin.helmling@octosoft.eu vor fast 8 Jahren hinzugefügt

  • ID a4684ad190c3a7adfa50ccec2c7c072ec2fe7f4f
  • Vorgänger 80b313fa
  • Nachfolger d9e8ef2c

Filesystem tests nun ohne anderen Output

Controller Downloaddaten werden umgelenkt und anschließend geprüft.

Unterschiede anzeigen:

t/file/filesystem.t
1 1
use strict;
2
use Test::More tests => 11;
2
use Test::More tests => 14;
3 3

  
4 4
use lib 't';
5 5

  
......
54 54
$content5 = $file6[1]->get_content;
55 55
ok( $$content5 eq 'inhalt3 created'                     ,"file has right old content");
56 56

  
57
print "\n\nController:\n";
57
#print "\n\nController Test:\n";
58 58
# now test controller
59 59
#$::form->{object_id}  = 1;
60 60
#$::form->{object_type}= 'sales_order';
61 61
#$::form->{file_type}  = 'document';
62

  
63
my $output;
64
open(my $outputFH, '>', \$output) or die; # This shouldn't fail
65
my $oldFH = select $outputFH;
66

  
62 67
$::form->{id}  = $file1->id;
63
print "id=".$::form->{id}."\n";
64 68
use SL::Controller::File;
65 69
SL::Controller::File->action_download();
70

  
71
select $oldFH;
72
close $outputFH;
73
my @lines = split "\n" , $output;
74
ok($lines[4] eq 'inhalt1 uploaded'                 ,"controller download has correct content");
75

  
76
#some controller checks
66 77
$::form->{object_id}   = 12345678;
67 78
$::form->{object_type} = undef;
79
my $result='xx1';
68 80
eval {
69 81
  SL::Controller::File->check_object_params();
82
  $result='yy1';
70 83
  1;
71 84
} or do {
72
    print $@;
85
  $result=$@;
73 86
};
74
$::form->{object_type} ='xx';
75
$::form->{file_type} ='yy';
87
ok($result eq "No object type at SL/Controller/File.pm line 327.\n","correct error 'No object type'");
88

  
89
$::form->{object_type} ='sales_order';
90
$::form->{file_type} ='';
91
$result='xx2';
76 92
eval {
77 93
  SL::Controller::File->check_object_params();
94
  $result='yy2';
78 95
  1;
79 96
} or do {
80
    print $@;
97
  $result=$@;
81 98
};
99
ok($result eq "No file type at SL/Controller/File.pm line 328.\n","correct error 'No file type'");
82 100

  
83 101
clear_up();
84 102
done_testing;

Auch abrufbar als: Unified diff