diff --git a/t/etc/fixtures/config/search.pl b/t/etc/fixtures/config/search.pl new file mode 100644 index 0000000..78c869c --- /dev/null +++ b/t/etc/fixtures/config/search.pl @@ -0,0 +1,88 @@ +#! /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; + +$fixtures->populate({ + directory => "$Bin/../data/users", + no_deploy => 1, + schema => $schema, +}); + +my @orgs = ( + { + organisation => { + name => 'Avanti Bar & Restaurant', + street_name => '57 Main St', + town => 'Kirkby Lonsdale', + postcode => 'LA6 2AH', + sector => 'I', + }, + type => "organisation", + }, + { + organisation => { + name => 'Full House Noodle Bar', + street_name => '21 Common Garden St', + town => 'Lancaster', + postcode => 'LA1 1XD', + sector => 'I', + }, + type => "organisation", + }, + { + organisation => { + name => 'The Quay\'s Fishbar', + street_name => '1 Adcliffe Rd', + town => 'Lancaster', + postcode => 'LA1 1SS', + sector => 'I', + }, + type => "organisation", + }, + { + organisation => { + name => 'Dan\'s Fishop', + street_name => '56 North Rd', + town => 'Lancaster', + postcode => 'LA1 1LT', + sector => 'I', + }, + type => "organisation", + }, + { + organisation => { + name => 'Hodgeson\'s Chippy', + street_name => '96 Prospect St', + town => 'Lancaster', + postcode => 'LA1 3BH', + sector => 'I', + }, + type => "organisation", + }, +); + +$schema->resultset('Entity')->create( $_ ) for @orgs; + +my $data_set = 'search'; + +$fixtures->dump({ + all => 1, + schema => $schema, + directory => "$Bin/../data/" . $data_set, +}); + diff --git a/t/etc/fixtures/data/search/_config_set b/t/etc/fixtures/data/search/_config_set new file mode 100644 index 0000000..5f8269a --- /dev/null +++ b/t/etc/fixtures/data/search/_config_set @@ -0,0 +1,57 @@ +$VAR1 = { + 'has_many' => { + 'fetch' => 0 + }, + 'sets' => [ + { + 'class' => 'Feedback', + 'quantity' => 'all' + }, + { + 'quantity' => 'all', + 'class' => 'Transaction' + }, + { + 'quantity' => 'all', + 'class' => 'User' + }, + { + 'quantity' => 'all', + 'class' => 'LeaderboardSet' + }, + { + 'class' => 'Customer', + 'quantity' => 'all' + }, + { + 'quantity' => 'all', + 'class' => 'Organisation' + }, + { + 'quantity' => 'all', + 'class' => 'LeaderboardValue' + }, + { + 'class' => 'Entity', + 'quantity' => 'all' + }, + { + 'quantity' => 'all', + 'class' => 'Leaderboard' + }, + { + 'class' => 'SessionToken', + 'quantity' => 'all' + }, + { + 'quantity' => 'all', + 'class' => 'AccountToken' + } + ], + 'might_have' => { + 'fetch' => 0 + }, + 'belongs_to' => { + 'fetch' => 0 + } + }; diff --git a/t/etc/fixtures/data/search/_dumper_version b/t/etc/fixtures/data/search/_dumper_version new file mode 100644 index 0000000..8d0321e --- /dev/null +++ b/t/etc/fixtures/data/search/_dumper_version @@ -0,0 +1 @@ +1.001036 \ No newline at end of file diff --git a/t/etc/fixtures/data/search/customers/1.fix b/t/etc/fixtures/data/search/customers/1.fix new file mode 100644 index 0000000..705c22d --- /dev/null +++ b/t/etc/fixtures/data/search/customers/1.fix @@ -0,0 +1,8 @@ +$HASH1 = { + display_name => 'Test User1', + entity_id => 1, + full_name => 'Test User1', + id => 1, + postcode => 'LA1 1AA', + year_of_birth => 2006 + }; diff --git a/t/etc/fixtures/data/search/customers/2.fix b/t/etc/fixtures/data/search/customers/2.fix new file mode 100644 index 0000000..0fee4aa --- /dev/null +++ b/t/etc/fixtures/data/search/customers/2.fix @@ -0,0 +1,8 @@ +$HASH1 = { + display_name => 'Test User2', + entity_id => 2, + full_name => 'Test User2', + id => 2, + postcode => 'LA1 1AA', + year_of_birth => 2006 + }; diff --git a/t/etc/fixtures/data/search/customers/3.fix b/t/etc/fixtures/data/search/customers/3.fix new file mode 100644 index 0000000..a64e402 --- /dev/null +++ b/t/etc/fixtures/data/search/customers/3.fix @@ -0,0 +1,8 @@ +$HASH1 = { + display_name => 'Test User3', + entity_id => 3, + full_name => 'Test User3', + id => 3, + postcode => 'LA1 1AA', + year_of_birth => 2006 + }; diff --git a/t/etc/fixtures/data/search/customers/4.fix b/t/etc/fixtures/data/search/customers/4.fix new file mode 100644 index 0000000..49d0530 --- /dev/null +++ b/t/etc/fixtures/data/search/customers/4.fix @@ -0,0 +1,8 @@ +$HASH1 = { + display_name => 'Test User4', + entity_id => 4, + full_name => 'Test User4', + id => 4, + postcode => 'LA1 1AA', + year_of_birth => 2006 + }; diff --git a/t/etc/fixtures/data/search/customers/5.fix b/t/etc/fixtures/data/search/customers/5.fix new file mode 100644 index 0000000..50ef1c2 --- /dev/null +++ b/t/etc/fixtures/data/search/customers/5.fix @@ -0,0 +1,8 @@ +$HASH1 = { + display_name => 'Test Admin', + entity_id => 6, + full_name => 'Test Admin', + id => 5, + postcode => 'LA1 1AA', + year_of_birth => 2006 + }; diff --git a/t/etc/fixtures/data/search/entities/1.fix b/t/etc/fixtures/data/search/entities/1.fix new file mode 100644 index 0000000..a45e065 --- /dev/null +++ b/t/etc/fixtures/data/search/entities/1.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 1, + type => 'customer' + }; diff --git a/t/etc/fixtures/data/search/entities/10.fix b/t/etc/fixtures/data/search/entities/10.fix new file mode 100644 index 0000000..918c437 --- /dev/null +++ b/t/etc/fixtures/data/search/entities/10.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 10, + type => 'organisation' + }; diff --git a/t/etc/fixtures/data/search/entities/11.fix b/t/etc/fixtures/data/search/entities/11.fix new file mode 100644 index 0000000..4f5536d --- /dev/null +++ b/t/etc/fixtures/data/search/entities/11.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 11, + type => 'organisation' + }; diff --git a/t/etc/fixtures/data/search/entities/2.fix b/t/etc/fixtures/data/search/entities/2.fix new file mode 100644 index 0000000..20849e3 --- /dev/null +++ b/t/etc/fixtures/data/search/entities/2.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 2, + type => 'customer' + }; diff --git a/t/etc/fixtures/data/search/entities/3.fix b/t/etc/fixtures/data/search/entities/3.fix new file mode 100644 index 0000000..3fd6a9a --- /dev/null +++ b/t/etc/fixtures/data/search/entities/3.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 3, + type => 'customer' + }; diff --git a/t/etc/fixtures/data/search/entities/4.fix b/t/etc/fixtures/data/search/entities/4.fix new file mode 100644 index 0000000..bacb15b --- /dev/null +++ b/t/etc/fixtures/data/search/entities/4.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 4, + type => 'customer' + }; diff --git a/t/etc/fixtures/data/search/entities/5.fix b/t/etc/fixtures/data/search/entities/5.fix new file mode 100644 index 0000000..9aa374d --- /dev/null +++ b/t/etc/fixtures/data/search/entities/5.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 5, + type => 'organisation' + }; diff --git a/t/etc/fixtures/data/search/entities/6.fix b/t/etc/fixtures/data/search/entities/6.fix new file mode 100644 index 0000000..ee9f57f --- /dev/null +++ b/t/etc/fixtures/data/search/entities/6.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 6, + type => 'customer' + }; diff --git a/t/etc/fixtures/data/search/entities/7.fix b/t/etc/fixtures/data/search/entities/7.fix new file mode 100644 index 0000000..beeb562 --- /dev/null +++ b/t/etc/fixtures/data/search/entities/7.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 7, + type => 'organisation' + }; diff --git a/t/etc/fixtures/data/search/entities/8.fix b/t/etc/fixtures/data/search/entities/8.fix new file mode 100644 index 0000000..da99144 --- /dev/null +++ b/t/etc/fixtures/data/search/entities/8.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 8, + type => 'organisation' + }; diff --git a/t/etc/fixtures/data/search/entities/9.fix b/t/etc/fixtures/data/search/entities/9.fix new file mode 100644 index 0000000..fe3b1f4 --- /dev/null +++ b/t/etc/fixtures/data/search/entities/9.fix @@ -0,0 +1,4 @@ +$HASH1 = { + id => 9, + type => 'organisation' + }; diff --git a/t/etc/fixtures/data/search/leaderboards/1.fix b/t/etc/fixtures/data/search/leaderboards/1.fix new file mode 100644 index 0000000..597a843 --- /dev/null +++ b/t/etc/fixtures/data/search/leaderboards/1.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 1, + name => 'Daily Total', + type => 'daily_total' + }; diff --git a/t/etc/fixtures/data/search/leaderboards/2.fix b/t/etc/fixtures/data/search/leaderboards/2.fix new file mode 100644 index 0000000..08fef2c --- /dev/null +++ b/t/etc/fixtures/data/search/leaderboards/2.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 2, + name => 'Daily Count', + type => 'daily_count' + }; diff --git a/t/etc/fixtures/data/search/leaderboards/3.fix b/t/etc/fixtures/data/search/leaderboards/3.fix new file mode 100644 index 0000000..4166f18 --- /dev/null +++ b/t/etc/fixtures/data/search/leaderboards/3.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 3, + name => 'Weekly Total', + type => 'weekly_total' + }; diff --git a/t/etc/fixtures/data/search/leaderboards/4.fix b/t/etc/fixtures/data/search/leaderboards/4.fix new file mode 100644 index 0000000..feb773c --- /dev/null +++ b/t/etc/fixtures/data/search/leaderboards/4.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 4, + name => 'Weekly Count', + type => 'weekly_count' + }; diff --git a/t/etc/fixtures/data/search/leaderboards/5.fix b/t/etc/fixtures/data/search/leaderboards/5.fix new file mode 100644 index 0000000..d0522b2 --- /dev/null +++ b/t/etc/fixtures/data/search/leaderboards/5.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 5, + name => 'Monthly Total', + type => 'monthly_total' + }; diff --git a/t/etc/fixtures/data/search/leaderboards/6.fix b/t/etc/fixtures/data/search/leaderboards/6.fix new file mode 100644 index 0000000..f7bb145 --- /dev/null +++ b/t/etc/fixtures/data/search/leaderboards/6.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 6, + name => 'Monthly Count', + type => 'monthly_count' + }; diff --git a/t/etc/fixtures/data/search/leaderboards/7.fix b/t/etc/fixtures/data/search/leaderboards/7.fix new file mode 100644 index 0000000..b2aadcd --- /dev/null +++ b/t/etc/fixtures/data/search/leaderboards/7.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 7, + name => 'All Time Total', + type => 'all_time_total' + }; diff --git a/t/etc/fixtures/data/search/leaderboards/8.fix b/t/etc/fixtures/data/search/leaderboards/8.fix new file mode 100644 index 0000000..df58698 --- /dev/null +++ b/t/etc/fixtures/data/search/leaderboards/8.fix @@ -0,0 +1,5 @@ +$HASH1 = { + id => 8, + name => 'All Time Count', + type => 'all_time_count' + }; diff --git a/t/etc/fixtures/data/search/organisations/1.fix b/t/etc/fixtures/data/search/organisations/1.fix new file mode 100644 index 0000000..b761450 --- /dev/null +++ b/t/etc/fixtures/data/search/organisations/1.fix @@ -0,0 +1,16 @@ +$HASH1 = { + country => undef, + entity_id + => 5, + id => 1, + name => 'Test Org', + pending => 0, + postcode + => 'LA1 1AA', + sector => undef, + street_name + => 'Test Street', + submitted_by_id + => undef, + town => 'Lancaster' + }; diff --git a/t/etc/fixtures/data/search/organisations/2.fix b/t/etc/fixtures/data/search/organisations/2.fix new file mode 100644 index 0000000..5da65f1 --- /dev/null +++ b/t/etc/fixtures/data/search/organisations/2.fix @@ -0,0 +1,16 @@ +$HASH1 = { + country => undef, + entity_id + => 7, + id => 2, + name => 'Avanti Bar & Restaurant', + pending => 0, + postcode + => 'LA6 2AH', + sector => 'I', + street_name + => '57 Main St', + submitted_by_id + => undef, + town => 'Kirkby Lonsdale' + }; diff --git a/t/etc/fixtures/data/search/organisations/3.fix b/t/etc/fixtures/data/search/organisations/3.fix new file mode 100644 index 0000000..000cb56 --- /dev/null +++ b/t/etc/fixtures/data/search/organisations/3.fix @@ -0,0 +1,16 @@ +$HASH1 = { + country => undef, + entity_id + => 8, + id => 3, + name => 'Full House Noodle Bar', + pending => 0, + postcode + => 'LA1 1XD', + sector => 'I', + street_name + => '21 Common Garden St', + submitted_by_id + => undef, + town => 'Lancaster' + }; diff --git a/t/etc/fixtures/data/search/organisations/4.fix b/t/etc/fixtures/data/search/organisations/4.fix new file mode 100644 index 0000000..565b447 --- /dev/null +++ b/t/etc/fixtures/data/search/organisations/4.fix @@ -0,0 +1,16 @@ +$HASH1 = { + country => undef, + entity_id + => 9, + id => 4, + name => 'The Quay\'s Fishbar', + pending => 0, + postcode + => 'LA1 1SS', + sector => 'I', + street_name + => '1 Adcliffe Rd', + submitted_by_id + => undef, + town => 'Lancaster' + }; diff --git a/t/etc/fixtures/data/search/organisations/5.fix b/t/etc/fixtures/data/search/organisations/5.fix new file mode 100644 index 0000000..9e9cbe5 --- /dev/null +++ b/t/etc/fixtures/data/search/organisations/5.fix @@ -0,0 +1,16 @@ +$HASH1 = { + country => undef, + entity_id + => 10, + id => 5, + name => 'Dan\'s Fishop', + pending => 0, + postcode + => 'LA1 1LT', + sector => 'I', + street_name + => '56 North Rd', + submitted_by_id + => undef, + town => 'Lancaster' + }; diff --git a/t/etc/fixtures/data/search/organisations/6.fix b/t/etc/fixtures/data/search/organisations/6.fix new file mode 100644 index 0000000..2d941bf --- /dev/null +++ b/t/etc/fixtures/data/search/organisations/6.fix @@ -0,0 +1,16 @@ +$HASH1 = { + country => undef, + entity_id + => 11, + id => 6, + name => 'Hodgeson\'s Chippy', + pending => 0, + postcode + => 'LA1 3BH', + sector => 'I', + street_name + => '96 Prospect St', + submitted_by_id + => undef, + town => 'Lancaster' + }; diff --git a/t/etc/fixtures/data/search/users/1.fix b/t/etc/fixtures/data/search/users/1.fix new file mode 100644 index 0000000..9507717 --- /dev/null +++ b/t/etc/fixtures/data/search/users/1.fix @@ -0,0 +1,8 @@ +$HASH1 = { + email => 'test1@example.com', + entity_id => 1, + id => 1, + is_admin => 0, + join_date => '2017-08-31 12:17:25', + password => '$2a$08$HSuznDeSU1fuONwKhp2/S.TX/X4p4g0dHtz20kVXxprm8hIg5QQma' + }; diff --git a/t/etc/fixtures/data/search/users/2.fix b/t/etc/fixtures/data/search/users/2.fix new file mode 100644 index 0000000..9654ada --- /dev/null +++ b/t/etc/fixtures/data/search/users/2.fix @@ -0,0 +1,8 @@ +$HASH1 = { + email => 'test2@example.com', + entity_id => 2, + id => 2, + is_admin => 0, + join_date => '2017-08-31 12:17:25', + password => '$2a$08$5XYLWPJvVGuWUvfSWj9cIOg4/tyB4fZ3knzwgw5UnBSKFBFIKOiFC' + }; diff --git a/t/etc/fixtures/data/search/users/3.fix b/t/etc/fixtures/data/search/users/3.fix new file mode 100644 index 0000000..fd07648 --- /dev/null +++ b/t/etc/fixtures/data/search/users/3.fix @@ -0,0 +1,8 @@ +$HASH1 = { + email => 'test3@example.com', + entity_id => 3, + id => 3, + is_admin => 0, + join_date => '2017-08-31 12:17:25', + password => '$2a$08$p5VU4leHetEvuz2P3uMfYuuPTkDGg8wsM7QuSVKkXR.s3B9T2JaVW' + }; diff --git a/t/etc/fixtures/data/search/users/4.fix b/t/etc/fixtures/data/search/users/4.fix new file mode 100644 index 0000000..e8300ec --- /dev/null +++ b/t/etc/fixtures/data/search/users/4.fix @@ -0,0 +1,8 @@ +$HASH1 = { + email => 'test4@example.com', + entity_id => 4, + id => 4, + is_admin => 0, + join_date => '2017-08-31 12:17:25', + password => '$2a$08$fkkTUYA9zvt32iBbN7aOcOnmiHzOkbMEjN31PB9CsitGrE.KF7cAG' + }; diff --git a/t/etc/fixtures/data/search/users/5.fix b/t/etc/fixtures/data/search/users/5.fix new file mode 100644 index 0000000..97859de --- /dev/null +++ b/t/etc/fixtures/data/search/users/5.fix @@ -0,0 +1,8 @@ +$HASH1 = { + email => 'org@example.com', + entity_id => 5, + id => 5, + is_admin => 0, + join_date => '2017-08-31 12:17:25', + password => '$2a$08$MWC45.w1AnLPNNHiS96ICOHfNlTrIqB0.7OPzy5qB.z0pZB0theo.' + }; diff --git a/t/etc/fixtures/data/search/users/6.fix b/t/etc/fixtures/data/search/users/6.fix new file mode 100644 index 0000000..d1b52dc --- /dev/null +++ b/t/etc/fixtures/data/search/users/6.fix @@ -0,0 +1,8 @@ +$HASH1 = { + email => 'admin@example.com', + entity_id => 6, + id => 6, + is_admin => 1, + join_date => '2017-08-31 12:17:25', + password => '$2a$08$1sPcPB9GnoNgzhBAk2bHSOqEmv6.Y6YLrAa2DJ6TR2WefzTYZQ92G' + };