File: 09-test-postgresql.t

package info (click to toggle)
libtest-dbix-class-perl 0.52-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 3,088 kB
  • sloc: perl: 2,193; makefile: 2
file content (50 lines) | stat: -rw-r--r-- 972 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
BEGIN {
	$ENV{TEST_DBIC_LAST_NAME} = 'Li' unless
	  defined $ENV{TEST_DBIC_LAST_NAME};
}

use Test::More; {

	use strict;
	use warnings;

	BEGIN {
		eval "use Test::Postgresql58"; if($@) {
			plan skip_all => 'Test::Postgresql58 not installed';
		}
		eval "use DateTime::Format::Pg"; if($@) {
			plan skip_all => 'DateTime::Format::Pg not installed';
		}
	}

	my $lastname;
	ok $lastname = $ENV{TEST_DBIC_LAST_NAME},
	  "Got Lastname of $lastname";

	use Test::DBIx::Class 
		-config_path=>[qw/t etc example schema/],
		-traits=>'Testpostgresql';

	is_resultset Person;
	is_resultset Job;

	fixtures_ok 'basic';

	is_fields 'email', NotTeenager, [
		"vanessa$lastname\@school.com",
		'john@nowehere.com',
	], 'Got Expected Email Addresses';

	is_fields ['name','age'], Person, [
		['John',40],
		['Vincent',15],
		["Vanessa",35],
	], 'Found People';

	is_fields ['name','age'], NotTeenager, [
		['John',40],
		["Vanessa",35],
	], 'No longer a teenager';

	done_testing;
}