11 plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for('admin')
12 unless DBIx::Class::Optional::Dependencies->req_ok_for('admin');
18 use ok 'DBIx::Class::Admin';
21 { # test data maniplulation functions
23 # create a DBICTest so we can steal its connect info
24 my $schema = DBICTest->init_schema(
28 my $admin = DBIx::Class::Admin->new(
29 schema_class=> "DBICTest::Schema",
30 connect_info => $schema->storage->connect_info(),
34 isa_ok ($admin, 'DBIx::Class::Admin', 'create the admin object');
36 $admin->insert('Employee', { name => 'Matt' });
37 my $employees = $schema->resultset('Employee');
38 is ($employees->count(), 1, "insert okay" );
40 my $employee = $employees->find(1);
41 is($employee->name(), 'Matt', "insert valid" );
43 $admin->update('Employee', {name => 'Trout'}, {name => 'Matt'});
45 $employee = $employees->find(1);
46 is($employee->name(), 'Trout', "update Matt to Trout" );
48 $admin->insert('Employee', {name =>'Aran'});
51 [$employee->result_source->columns() ],
52 [1,1,undef,undef,undef,'Trout'],
53 [2,2,undef,undef,undef,'Aran']
56 lives_ok { $data = $admin->select('Employee')} 'can retrive data from database';
57 cmp_deeply($data, $expected_data, 'DB matches whats expected');
59 $admin->delete('Employee', {name=>'Trout'});
60 my $del_rs = $employees->search({name => 'Trout'});
61 is($del_rs->count(), 0, "delete Trout" );
62 is ($employees->count(), 1, "left Aran" );