Skip to content

Commit 333aea9

Browse files
simbabqueoalders
authored andcommitted
add test for set_fields with upload and text
1 parent 1f30ce8 commit 333aea9

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

t/file_upload.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<form method="post" enctype="multipart/form-data">
22
<input type="file" name="document">
3+
<input type="text" name="another_field">
34
<input type="submit">
45
</form>

t/file_upload.t

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ $as_string = $form->make_request->as_string;
9292
like( $as_string, qr! filename="$filename" !x,
9393
q/$mc->set_fields( 'document' => [[ undef, $filename, Content => 'content' ], 1] )/ );
9494

95+
# &set_fields with multiple fields
96+
$mc->get( $uri );
97+
$mc->set_fields( 'another_field' => 'foo', 'document' => [ $file, $filename ] );
98+
($form) = $mc->forms;
99+
like( $form->make_request->as_string, qr! filename="$filename" !x,
100+
q/$mc->set_fields( 'another_field' => 'foo', 'document' => [ $file, $filename ] )/ );
101+
102+
95103
# field does not exist
96104
$mc->get( $uri );
97105
lives_ok { $mc->set_fields( 'does_not_exist' => [ [$file], 1 ] ) }

0 commit comments

Comments
 (0)