9 plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for('admin')
10 unless DBIx::Class::Optional::Dependencies->req_ok_for('admin');
16 use_ok 'DBIx::Class::Admin';
19 { # test data maniplulation functions
21 # create a DBICTest so we can steal its connect info
22 my $schema = DBICTest->init_schema(
26 my $admin = DBIx::Class::Admin->new(
27 schema_class=> "DBICTest::Schema",
28 connect_info => $schema->storage->connect_info(),
32 isa_ok ($admin, 'DBIx::Class::Admin', 'create the admin object');
34 $admin->insert('Employee', { name => 'Matt' });
35 my $employees = $schema->resultset('Employee');
36 is ($employees->count(), 1, "insert okay" );
38 my $employee = $employees->find(1);
39 is($employee->name(), 'Matt', "insert valid" );
41 $admin->update('Employee', {name => 'Trout'}, {name => 'Matt'});
43 $employee = $employees->find(1);
44 is($employee->name(), 'Trout', "update Matt to Trout" );
46 $admin->insert('Employee', {name =>'Aran'});
49 [$employee->result_source->columns() ],
50 [1,1,undef,undef,undef,'Trout',undef],
51 [2,2,undef,undef,undef,'Aran',undef]
54 lives_ok { $data = $admin->select('Employee')} 'can retrive data from database';
55 is_deeply($data, $expected_data, 'DB matches whats expected');
57 $admin->delete('Employee', {name=>'Trout'});
58 my $del_rs = $employees->search({name => 'Trout'});
59 is($del_rs->count(), 0, "delete Trout" );
60 is ($employees->count(), 1, "left Aran" );