From: Peter Rabbitson Date: Sun, 17 Jan 2010 20:57:53 +0000 (+0000) Subject: More detabification X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1edd4ca695754f9ffdebff19f3ea918ecc72d2fd;p=dbsrgits%2FDBIx-Class-Historic.git More detabification --- diff --git a/t/admin/02ddl.t b/t/admin/02ddl.t index d65331f..df24bad 100644 --- a/t/admin/02ddl.t +++ b/t/admin/02ddl.t @@ -40,9 +40,9 @@ use DBICTest; my $sql_dir = dir($Bin,"..","var"); my @connect_info = DBICTest->_database( - no_deploy=>1, - no_populate=>1, - sqlite_use_file => 1, + no_deploy=>1, + no_populate=>1, + sqlite_use_file => 1, ); { # create the schema @@ -51,9 +51,9 @@ clean_dir($sql_dir); my $admin = DBIx::Class::Admin->new( - schema_class=> "DBICTest::Schema", - sql_dir=> $sql_dir, - connect_info => \@connect_info, + schema_class=> "DBICTest::Schema", + sql_dir=> $sql_dir, + connect_info => \@connect_info, ); isa_ok ($admin, 'DBIx::Class::Admin', 'create the admin object'); lives_ok { $admin->create('MySQL'); } 'Can create MySQL sql'; @@ -63,18 +63,18 @@ lives_ok { $admin->create('SQLite'); } 'Can Create SQLite sql'; { # upgrade schema #my $schema = DBICTest->init_schema( -# no_deploy => 1, -# no_populat => 1, -# sqlite_use_file => 1, +# no_deploy => 1, +# no_populat => 1, +# sqlite_use_file => 1, #); clean_dir($sql_dir); require DBICVersionOrig; my $admin = DBIx::Class::Admin->new( - schema_class => 'DBICVersion::Schema', - sql_dir => $sql_dir, - connect_info => \@connect_info, + schema_class => 'DBICVersion::Schema', + sql_dir => $sql_dir, + connect_info => \@connect_info, ); my $schema = $admin->schema(); @@ -91,9 +91,9 @@ is($schema->get_db_version, $DBICVersion::Schema::VERSION, 'Schema deployed and require DBICVersionNew; $admin = DBIx::Class::Admin->new( - schema_class => 'DBICVersion::Schema', - sql_dir => "t/var", - connect_info => \@connect_info + schema_class => 'DBICVersion::Schema', + sql_dir => "t/var", + connect_info => \@connect_info ); lives_ok { $admin->create($schema->storage->sqlt_type(), {}, "1.0" ); } 'Can create diff for ' . $schema->storage->sqlt_type; @@ -111,10 +111,10 @@ is($schema->get_db_version, $DBICVersion::Schema::VERSION, 'Schema and db versio clean_dir($sql_dir); my $admin = DBIx::Class::Admin->new( - schema_class => 'DBICVersion::Schema', - sql_dir => $sql_dir, - _confirm => 1, - connect_info => \@connect_info, + schema_class => 'DBICVersion::Schema', + sql_dir => $sql_dir, + _confirm => 1, + connect_info => \@connect_info, ); $admin->version("3.0"); @@ -129,16 +129,16 @@ is($admin->schema->get_db_version, "4.0", 'db thinks its version 4.0'); } sub clean_dir { - my ($dir) =@_; - $dir = $dir->resolve; - if ( ! -d $dir ) { - $dir->mkpath(); - } - foreach my $file ($dir->children) { - # skip any hidden files - next if ($file =~ /^\./); - unlink $file; - } + my ($dir) =@_; + $dir = $dir->resolve; + if ( ! -d $dir ) { + $dir->mkpath(); + } + foreach my $file ($dir->children) { + # skip any hidden files + next if ($file =~ /^\./); + unlink $file; + } } done_testing; diff --git a/t/admin/03data.t b/t/admin/03data.t index 1d51c26..35c285e 100644 --- a/t/admin/03data.t +++ b/t/admin/03data.t @@ -40,49 +40,49 @@ use DBICTest; { # test data maniplulation functions - # create a DBICTest so we can steal its connect info - my $schema = DBICTest->init_schema( - # no_deploy=>1, - # no_populate=>1, - sqlite_use_file => 1, - ); - - - my $admin = DBIx::Class::Admin->new( - schema_class=> "DBICTest::Schema", - connect_info => $schema->storage->connect_info(), - quiet => 1, - _confirm=>1, - ); - isa_ok ($admin, 'DBIx::Class::Admin', 'create the admin object'); - - $admin->insert('Employee', { name => 'Matt' }); - my $employees = $schema->resultset('Employee'); - is ($employees->count(), 1, "insert okay" ); - - my $employee = $employees->find(1); - is($employee->name(), 'Matt', "insert valid" ); - - $admin->update('Employee', {name => 'Trout'}, {name => 'Matt'}); - - $employee = $employees->find(1); - is($employee->name(), 'Trout', "update Matt to Trout" ); - - $admin->insert('Employee', {name =>'Aran'}); - - my $expected_data = [ - [$employee->result_source->columns() ], - [1,1,undef,undef,undef,'Trout'], - [2,2,undef,undef,undef,'Aran'] - ]; - my $data; - lives_ok { $data = $admin->select('Employee')} 'can retrive data from database'; - cmp_deeply($data, $expected_data, 'DB matches whats expected'); - - $admin->delete('Employee', {name=>'Trout'}); - my $del_rs = $employees->search({name => 'Trout'}); - is($del_rs->count(), 0, "delete Trout" ); - is ($employees->count(), 1, "left Aran" ); + # create a DBICTest so we can steal its connect info + my $schema = DBICTest->init_schema( + # no_deploy=>1, + # no_populate=>1, + sqlite_use_file => 1, + ); + + + my $admin = DBIx::Class::Admin->new( + schema_class=> "DBICTest::Schema", + connect_info => $schema->storage->connect_info(), + quiet => 1, + _confirm=>1, + ); + isa_ok ($admin, 'DBIx::Class::Admin', 'create the admin object'); + + $admin->insert('Employee', { name => 'Matt' }); + my $employees = $schema->resultset('Employee'); + is ($employees->count(), 1, "insert okay" ); + + my $employee = $employees->find(1); + is($employee->name(), 'Matt', "insert valid" ); + + $admin->update('Employee', {name => 'Trout'}, {name => 'Matt'}); + + $employee = $employees->find(1); + is($employee->name(), 'Trout', "update Matt to Trout" ); + + $admin->insert('Employee', {name =>'Aran'}); + + my $expected_data = [ + [$employee->result_source->columns() ], + [1,1,undef,undef,undef,'Trout'], + [2,2,undef,undef,undef,'Aran'] + ]; + my $data; + lives_ok { $data = $admin->select('Employee')} 'can retrive data from database'; + cmp_deeply($data, $expected_data, 'DB matches whats expected'); + + $admin->delete('Employee', {name=>'Trout'}); + my $del_rs = $employees->search({name => 'Trout'}); + is($del_rs->count(), 0, "delete Trout" ); + is ($employees->count(), 1, "left Aran" ); }