Commit | Line | Data |
f733d664 |
1 | use strict; |
f54428ab |
2 | use warnings; |
f733d664 |
3 | |
4 | use Test::More; |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
7 | |
8 | plan tests => 1; |
9 | |
f3d405dc |
10 | # Set up the "usual" sqlite for DBICTest and disconnect |
fcf741b1 |
11 | my $normal_schema = DBICTest->init_schema( sqlite_use_file => 1 ); |
f3d405dc |
12 | $normal_schema->storage->disconnect; |
f733d664 |
13 | |
14 | # Steal the dsn, which should be like 'dbi:SQLite:t/var/DBIxClass.db' |
f3d405dc |
15 | my @dsn = ($normal_schema->storage->_dbi_connect_info->[0], undef, undef, { |
16 | RaiseError => 1 |
17 | }); |
f733d664 |
18 | |
19 | # Make a new clone with a new connection, using a code reference |
f3d405dc |
20 | my $code_ref_schema = $normal_schema->connect(sub { DBI->connect(@dsn); }); |
f733d664 |
21 | |
22 | # Stolen from 60core.t - this just verifies things seem to work at all |
23 | my @art = $code_ref_schema->resultset("Artist")->search({ }, { order_by => 'name DESC'}); |
24 | cmp_ok(@art, '==', 3, "Three artists returned"); |