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 my $employees = $schema->resultset('Employee');
23 my $cmd = qq|script/dbicadmin --schema=DBICTest::Schema --class=Employee --tlibs --connect='["dbi:SQLite:dbname=t/var/DBIxClass.db","",""]' --force --tlibs|;
25 `$cmd --op=insert --set='{name:"Matt"}'`;
26 ok( ($employees->count()==1), 'insert count' );
28 my $employee = $employees->find(1);
29 ok( ($employee->name() eq 'Matt'), 'insert valid' );
31 `$cmd --op=update --set='{name:"Trout"}'`;
32 $employee = $employees->find(1);
33 ok( ($employee->name() eq 'Trout'), 'update' );
35 `$cmd --op=insert --set='{name:"Aran"}'`;
36 my $data = `$cmd --op=select --attrs='{order_by:"name"}'`;
37 ok( ($data=~/Aran.*Trout/s), 'select with attrs' );
39 `$cmd --op=delete --where='{name:"Trout"}'`;
40 ok( ($employees->count()==1), 'delete' );