9 my $schema = DBICTest->init_schema();
12 plan skip_all => 'Install JSON to run this test' if ($@);
14 eval 'require Text::CSV_XS';
16 eval 'require Text::CSV_PP';
17 plan skip_all => 'Install Text::CSV_XS or Text::CSV_PP to run this test' if ($@);
22 # double quotes round the arguments and single-quote within to make sure the
23 # tests run on windows as well
25 my $employees = $schema->resultset('Employee');
26 my $cmd = qq|$^X script/dbicadmin --schema=DBICTest::Schema --class=Employee --tlibs --connect="['dbi:SQLite:dbname=t/var/DBIxClass.db','','',{AutoCommit:1}]" --force --tlibs|;
28 `$cmd --op=insert --set="{name:'Matt'}"`;
29 ok( ($employees->count()==1), 'insert count' );
31 my $employee = $employees->find(1);
32 ok( ($employee->name() eq 'Matt'), 'insert valid' );
34 `$cmd --op=update --set="{name:'Trout'}"`;
35 $employee = $employees->find(1);
36 ok( ($employee->name() eq 'Trout'), 'update' );
38 `$cmd --op=insert --set="{name:'Aran'}"`;
39 my $data = `$cmd --op=select --attrs="{order_by:'name'}"`;
40 ok( ($data=~/Aran.*Trout/s), 'select with attrs' );
42 `$cmd --op=delete --where="{name:'Trout'}"`;
43 ok( ($employees->count()==1), 'delete' );