Skip to content

Instantly share code, notes, and snippets.

@hisaichi5518
Created November 28, 2011 04:05
Show Gist options
  • Save hisaichi5518/1399049 to your computer and use it in GitHub Desktop.
Save hisaichi5518/1399049 to your computer and use it in GitHub Desktop.
DBIx::Unko
use strict;
use warnings;
use utf8;
use Test::More;
use DBI;
use DBIx::Unko;
my $dbh = DBI->connect(...);
my $unko = DBIx::Unko->new(dbh => $dbh, namespace => 'Geri');
my $geri = $unko->create_factory(
create_factory_data => {
table => 'test_factory',
columns => {
int => '[0-9]{32}',
double => sub { rand(32) },
string => '[あ-か0-9a-zA-Z]{32}',
},
},
...
);
my $values = $geri->create_factory_data;
ok $value->{string};
$values = $geri->create_factory_data(string => 'hisaichi5518');
is $value->{string}, 'hisaichi5518';
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment