This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
Foodloop-Server/t/etc/fixtures/config/users.pl

128 lines
2.6 KiB
Perl
Raw Permalink Normal View History

2017-08-25 15:36:43 +00:00
#! /usr/bin/env perl
use strict;
use warnings;
use DBIx::Class::Fixtures;
use FindBin qw/ $Bin /;
use lib "$Bin/../../../../lib";
use Pear::LocalLoop::Schema;
use DateTime;
my $fixtures = DBIx::Class::Fixtures->new({
config_dir => "$Bin",
});
my $schema = Pear::LocalLoop::Schema->connect('dbi:SQLite::memory:');
$schema->deploy;
$schema->resultset('Leaderboard')->populate([
[ qw/ name type / ],
[ 'Daily Total', 'daily_total' ],
[ 'Daily Count', 'daily_count' ],
[ 'Weekly Total', 'weekly_total' ],
[ 'Weekly Count', 'weekly_count' ],
[ 'Monthly Total', 'monthly_total' ],
[ 'Monthly Count', 'monthly_count' ],
[ 'All Time Total', 'all_time_total' ],
[ 'All Time Count', 'all_time_count' ],
]);
my $entity1 = {
2017-08-25 15:36:43 +00:00
customer => {
full_name => 'Test User1',
display_name => 'Test User1',
postcode => 'LA1 1AA',
year_of_birth => 2006,
},
user => {
email => 'test1@example.com',
password => 'abc123',
},
type => "customer",
2017-08-25 15:36:43 +00:00
};
my $entity2 = {
2017-08-25 15:36:43 +00:00
customer => {
full_name => 'Test User2',
display_name => 'Test User2',
postcode => 'LA1 1AA',
2017-08-25 15:36:43 +00:00
year_of_birth => 2006,
},
user => {
email => 'test2@example.com',
password => 'abc123',
},
type => "customer",
2017-08-25 15:36:43 +00:00
};
my $entity3 = {
2017-08-25 15:36:43 +00:00
customer => {
full_name => 'Test User3',
display_name => 'Test User3',
postcode => 'LA1 1AA',
2017-08-25 15:36:43 +00:00
year_of_birth => 2006,
},
user => {
email => 'test3@example.com',
password => 'abc123',
},
type => "customer",
2017-08-25 15:36:43 +00:00
};
my $entity4 = {
2017-08-25 15:36:43 +00:00
customer => {
full_name => 'Test User4',
display_name => 'Test User4',
postcode => 'LA1 1AA',
2017-08-25 15:36:43 +00:00
year_of_birth => 2006,
},
user => {
email => 'test4@example.com',
password => 'abc123',
},
type => "customer",
2017-08-25 15:36:43 +00:00
};
my $entity5 = {
2017-08-25 15:36:43 +00:00
organisation => {
name => 'Test Org',
street_name => 'Test Street',
town => 'Lancaster',
postcode => 'LA1 1AA',
2017-12-15 17:52:02 +00:00
sector => 'A',
2017-08-25 15:36:43 +00:00
},
user => {
email => 'org@example.com',
password => 'abc123',
},
2017-08-31 15:35:51 +00:00
type => "organisation",
};
my $entity6 = {
customer => {
full_name => 'Test Admin',
display_name => 'Test Admin',
postcode => 'LA1 1AA',
year_of_birth => 2006,
},
user => {
email => 'admin@example.com',
password => 'abc123',
is_admin => \"1",
},
type => "customer",
2017-08-25 15:36:43 +00:00
};
$schema->resultset('Entity')->create( $_ )
for ( $entity1, $entity2, $entity3, $entity4, $entity5, $entity6 );
2017-08-25 15:36:43 +00:00
my $data_set = 'users';
$fixtures->dump({
all => 1,
schema => $schema,
directory => "$Bin/../data/" . $data_set,
});