NAME

Mojolicious::Plugin::Images::Test

VERSION

version 0.007

SYNOPSIS

use Mojolicious::Plugin::Images::Test qw(test_image test_upload);

# create test image
my $img = test_image;  

# create a Mojo::Upload object containing jpeg data
my $upload = test_upload;
my $img = Imager::->new(data => $upload->slurp);

DESCRIPTION

Helpful functions for testing purposes

FUNCTIONS

uniq_id

my $id = uniq_id;

Returns uniq id

test_image ($w, $h)

my $img = test_image;
$img = test_image(1024, 800);

Returns an Imager object. If arguments were provided, they will be used as width and height of a created image. Defaults are (1024, 800)

test_controller ($w, $h)

Builds a controller that contains upload under the provided name or 'image' with the image

my $c = test_controller;
my $c = test_controller(200, 300, 'image');
my $data = test_controller()->req->upload('image')->slurp;

test_upload ($w, $h)

my $upload = test_upload;
$upload = test_upload(1024, 800);

Returns a Mojo::Upload object with valid jpeg binary data (1024x800 by default)

AUTHOR

alexbyk <alexbyk@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by alexbyk.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.