Skip to content

Instantly share code, notes, and snippets.

@willert
Created March 4, 2014 14:30
Show Gist options
  • Save willert/9347476 to your computer and use it in GitHub Desktop.
Save willert/9347476 to your computer and use it in GitHub Desktop.
Test case
package Util::Certificates;
use WeCARE::Test -app => 'AMG';
use utf8;
use AMG::Certificate;
sub test_cert {
my $self = shift;
my $template = $self->env->path_to( 'share', 'member_cert.pdf' );
my $boilerplate = $template->slurp( iomode => '<:raw' );
my $pdf = AMG::Certificate->new({
content => $boilerplate,
teilnehmername => 'Herr Herbert Müller',
});
$pdf->finalize_content;
my $tmp_dir = $self->env->path_to( 't', 'tmp' );
$tmp_dir->mkpath;
my $cert_file = $tmp_dir->file('cert.pdf');
$cert_file->spew( iomode => '>:raw', $pdf->content );
ok -f $cert_file->stringify, "Created pdf $cert_file";
system 'xdg-open' => $cert_file;
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment