-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
78 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Revision history for Test::Factory::DBI | ||
Revision history for DBIx::DataFactory | ||
|
||
0.0.1 Tue Oct 18 08:56:04 2011 | ||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package Test::Factory::DBI::Type; | ||
package DBIx::DataFactory::Type; | ||
|
||
use strict; | ||
use warnings; | ||
|
4 changes: 2 additions & 2 deletions
4
lib/Test/Factory/DBI/Type/Int.pm → lib/DBIx/DataFactory/Type/Int.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
lib/Test/Factory/DBI/Type/Num.pm → lib/DBIx/DataFactory/Type/Num.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package DBIx::DataFactory::Type::Set; | ||
|
||
use strict; | ||
use warnings; | ||
use Carp; | ||
|
||
use base qw(DBIx::DataFactory::Type); | ||
|
||
use Smart::Args; | ||
|
||
sub type_name { 'Set' } | ||
|
||
sub make_value { | ||
args my $class => 'ClassName', | ||
my $set => 'ArrayRef'; | ||
return $set->[int rand(scalar @$set)]; | ||
} | ||
|
||
1; |
4 changes: 2 additions & 2 deletions
4
lib/Test/Factory/DBI/Type/Str.pm → lib/DBIx/DataFactory/Type/Str.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
use Test::More tests => 1; | ||
|
||
BEGIN { | ||
use_ok( 'Test::Factory::DBI' ); | ||
use_ok( 'DBIx::DataFactory' ); | ||
} | ||
|
||
diag( "Testing Test::Factory::DBI $Test::Factory::DBI::VERSION" ); | ||
diag( "Testing DBIx::DataFactory $DBIx::DataFactory::VERSION" ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,56 @@ | ||
package test::Test::Factory::DBI; | ||
package test::DBIx::DataFactory; | ||
use strict; | ||
use warnings; | ||
use Test::More tests => 1; | ||
|
||
use Test::Factory::DBI; | ||
use DBIx::DataFactory; | ||
use String::Random; | ||
|
||
Test::Factory::DBI->username('nobody'); | ||
Test::Factory::DBI->password('nobody'); | ||
Test::Factory::DBI->create_factory_method( | ||
method => 'create_factory', | ||
# DBIx::DataFactory->username('nobody'); | ||
# DBIx::DataFactory->password('nobody'); | ||
# DBIx::DataFactory->create_factory_method( | ||
# method => 'create_factory', | ||
# dbi => 'dbi:mysql:dbname=test_factory;host=localhost', | ||
# table => 'test_factory', | ||
# columns => { | ||
# int => { | ||
# type => 'Int', | ||
# size => 10, | ||
# }, | ||
# double => { | ||
# type => 'Num', | ||
# size => 5, | ||
# }, | ||
# string => { | ||
# type => 'Set', | ||
# set => ['test', 'test2', 'test3'], | ||
# }, | ||
# }, | ||
# ); | ||
|
||
# my $factory = create_factory(nullable => 100); | ||
# use Data::Dumper; | ||
# warn Dumper($factory); | ||
|
||
use DBIx::DataFactory; | ||
DBIx::DataFactory->username('nobody'); | ||
DBIx::DataFactory->password('nobody'); | ||
DBIx::DataFactory->create_factory_method( | ||
method => 'create_factory_data', | ||
dbi => 'dbi:mysql:dbname=test_factory;host=localhost', | ||
table => 'test_factory', | ||
columns => { | ||
int => { | ||
type => 'Int', | ||
size => 10, | ||
}, | ||
double => { | ||
type => 'Num', | ||
size => 5, | ||
}, | ||
string => { | ||
type => 'Str', | ||
size => 50, | ||
} | ||
size => 10, | ||
}, | ||
}, | ||
); | ||
|
||
my $factory = create_factory(nullable => 100); | ||
use Data::Dumper; | ||
warn Dumper($factory); | ||
my $values = create_factory_data( | ||
text => 'test text', | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters