Eve
view release on metacpan or search on metacpan
lib/Eve/DbiStub.pm view on Meta::CPAN
'display_name' => undef,
'email' => undef},
'profile_1' => {
'provider_name' => 'facebook',
'identifier' => '100000123812',
'display_name' => 'John Q. Doe',
'email' => 'john.q.doe@example.net'},
'profile_2' => {
'provider_name' => 'twitter',
'identifier' => '1000001211812',
'display_name' => 'John M. Doe',
'email' => 'john.m.doe@example.net'},
'profile_3' => {
'provider_name' => 'facebook',
'identifier' => '100000123812',
'display_name' => 'John Q. Deere',
'email' => 'john.q.deere@example.net'},
'profile_4' => {
'provider_name' => 'twitter',
'identifier' => '100000123813',
'display_name' => 'John M. Smith',
'email' => 'john.m.smith@example.com'}};
my $data_hash_list = {
'test_function_1' => {
'sql_pattern' => 'pgsql_function_test\.test_function_1',
'data' => [[
{'id' => 1, 'memo' => 'text 1'},
{'id' => 2, 'memo' => 'text 2'}]]},
'test_function_2' => {
'sql_pattern' => 'pgsql_function_test\.test_function_2',
'data' => [[{'memo' => 'text'}]]},
'account_add' => {
'sql_pattern' => 'account_add',
'input_type_list' => [],
'data' => [
[$data_template_hash->{'entry_1'}],
[$data_template_hash->{'entry_2'}]]},
'account_get' => {
'sql_pattern' => 'account_get',
'input_type_list' => [DBD::Pg::PG_INT8],
'data' => [
[{%{$data_template_hash->{'entry_1'}}, 'id' => 987654321}],
[{%{$data_template_hash->{'entry_2'}}, 'id' => 123456789}]]},
'account_get_by_userid' => {
'sql_pattern' => 'account_get_by_userid',
'input_type_list' => [DBD::Pg::PG_TEXT],
'data' => [
[{%{$data_template_hash->{'entry_1'}}, 'id' => 987654321}],
[{%{$data_template_hash->{'entry_2'}}, 'id' => 123456789}]]},
'external_profile_add' => {
'sql_pattern' => 'external_profile_add',
'input_type_list' => [DBD::Pg::PG_INT8, (DBD::Pg::PG_TEXT) x 4],
'data' => [
[{%{$data_template_hash->{'entry_1'}},
'account_id' => 123123123,
%{$data_template_hash->{'profile_1'}}}],
[{%{$data_template_hash->{'entry_2'}},
'account_id' => 123123,
%{$data_template_hash->{'profile_2'}}}]]},
'external_profile_get_by_credentials' => {
'sql_pattern' => 'external_profile_get_by_credentials',
'input_type_list' => [DBD::Pg::PG_TEXT, DBD::Pg::PG_TEXT],
'data' => [
[{%{$data_template_hash->{'entry_1'}},
'id' => 987654321,
'account_id' => 123123123,
%{$data_template_hash->{'profile_1'}}}],
[{%{$data_template_hash->{'entry_3'}},
'account_id' => 123123,
%{$data_template_hash->{'profile_2'}},
'identifier' => '100000123813'}],
[{%{$data_template_hash->{'entry_undef'}},
'account_id' => undef,
%{$data_template_hash->{'profile_undef'}}}]]},
'external_profile_update' => {
'sql_pattern' => 'external_profile_update',
'input_type_list' => [DBD::Pg::PG_INT8, (DBD::Pg::PG_TEXT) x 4],
'data' => [
[{%{$data_template_hash->{'entry_1'}},
'modified' => '2011-03-24 00:00:00',
'account_id' => 123123123,
%{$data_template_hash->{'profile_3'}}}],
[{%{$data_template_hash->{'entry_3'}},
'modified' => '2012-04-15 00:00:00',
'account_id' => 123123,
%{$data_template_hash->{'profile_4'}}}]]}};
return $data_hash_list;
}
=head2 B<mock_sth()>
Returns a mock statement handle.
=cut
sub mock_sth {
my $sql = shift;
my $sth_mock = Test::MockObject->new();
$sth_mock->{'input_type_list'} = [];
$sth_mock->{'data_hash_list'} = get_data();
$sth_mock->mock(
'bind_param',
sub {
my ($self, $index, undef, $attr_hash) = @_;
push(@{$self->{'input_type_list'}}, $attr_hash->{'pg_type'});
return;
});
$sth_mock->mock(
'execute',
sub {
my $self = shift;
$self->set_always('value_list', [@_]);
$self->{'return_list'} = [];
( run in 1.054 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )