10 plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for('admin')
11 unless DBIx::Class::Optional::Dependencies->req_ok_for('admin');
17 use_ok 'DBIx::Class::Admin';
20 { # test data maniplulation functions
22 # create a DBICTest so we can steal its connect info
23 my $schema = DBICTest->init_schema(
27 my $admin = DBIx::Class::Admin->new(
28 schema_class=> "DBICTest::Schema",
29 connect_info => $schema->storage->connect_info(),
33 isa_ok ($admin, 'DBIx::Class::Admin', 'create the admin object');
35 $admin->insert('Employee', { name => 'Matt' });
36 my $employees = $schema->resultset('Employee');
37 is ($employees->count(), 1, "insert okay" );
39 my $employee = $employees->find(1);
40 is($employee->name(), 'Matt', "insert valid" );
42 $admin->update('Employee', {name => 'Trout'}, {name => 'Matt'});
44 $employee = $employees->find(1);
45 is($employee->name(), 'Trout', "update Matt to Trout" );
47 $admin->insert('Employee', {name =>'Aran'});
50 [$employee->result_source->columns() ],
51 [1,1,undef,undef,undef,'Trout'],
52 [2,2,undef,undef,undef,'Aran']
55 lives_ok { $data = $admin->select('Employee')} 'can retrive data from database';
56 is_deeply($data, $expected_data, 'DB matches whats expected');
58 $admin->delete('Employee', {name=>'Trout'});
59 my $del_rs = $employees->search({name => 'Trout'});
60 is($del_rs->count(), 0, "delete Trout" );
61 is ($employees->count(), 1, "left Aran" );