DBIx-Simple-Class

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        - Perltidyed.

0.992   2012-09-12 23:03:46 EEST
        - Fixed typos in documentation
        - Fixed unnoticeable bug in the generated Schema Class
        - Slight improvements in documentation
        - Prefixed default namespace with 'DSCS::'
        to reduce possible namespace collision.

0.991   2012-09-07 17:30:04 EEST
        - Fixed failing tests on windows related to chmod.
        Thanks to Peter du Marchie van Voorthuysen.

0.99    2012-09-07 15:38:49 EEST
        - Added dbix method to the generated base/schema class
        so generated classes can have their
        own connection per schema class.
        - Fixed failing tests.

0.98    2012-09-07 01:03:34 EEST
        - Created DBIx::Simple::Class::Schema.

t/01-dbix-simple-class-schema-mysql.t  view on Meta::CPAN

delete $DSCS->_schemas->{Test};
$DSCS->load_schema(namespace => 'Your::Model', table => '%user%', type => "'TABLE'")
  ;    #void context ok
isa_ok($DSCS->_schemas('Your::Model'),
  'HASH', 'load_schema creates Your::Model namespace OK');

is($DSCS->_schemas('Your::Model')->{tables}[0]->{TABLE_NAME},
  'users', 'first table is "users"');
is(scalar @{$DSCS->_schemas('Your::Model')->{tables}}, 1, 'the only table is "users"');
SKIP: {
  skip "I have only linux, see http://perldoc.perl.org/perlport.html#chmod", 1,
    if $^O !~ /linux/i;
  chmod 0444, $INC[0];
  ok(!$DSCS->dump_schema_at(lib_root => $INC[0]), 'quits OK');
  chmod 0755, $INC[0];
}
ok($DSCS->dump_schema_at(lib_root => $INC[0]), 'dumps OK');
File::Path::remove_tree($INC[0] . '/Your');
$dbix->query('DROP TABLE IF EXISTS `groups`');
$dbix->query('DROP TABLE IF EXISTS `users`');

done_testing;

t/01-dbix-simple-class-schema-sqlite.t  view on Meta::CPAN

ok($DSCS->dump_schema_at(), 'does not quit OK');
unlink($INC[0] . '/DSCS/Memory.pm');

ok($DSCS->dump_schema_at(), 'does not quit OK');
$DSCS->DEBUG(1);
unlink($INC[0] . '/DSCS/Memory.pm');
unlink($INC[0] . '/DSCS/Memory/SqliteSequence.pm');
ok($DSCS->dump_schema_at(overwrite => 1), 'overwrites OK');
$DSCS->DEBUG(0);
SKIP: {
  skip "I have only linux and mac, see http://perldoc.perl.org/perlport.html#chmod", 1,
    if $^O !~ /linux|darwin/i;
  chmod 0444, $INC[0] . '/DSCS/Memory/Users.pm';
  ok(!$DSCS->dump_schema_at(overwrite => 1), 'quits OK');
  chmod 0644, $INC[0] . '/DSCS/Memory/Users.pm';
}
File::Path::remove_tree($INC[0] . '/DSCS/Memory');
unlink($INC[0] . '/DSCS/Memory.pm');

#PARAMS
delete $DSCS->_schemas->{Memory};
$DSCS->load_schema(namespace => 'Your::Model', table => 'user%', type => "'TABLE'")
  ;    #void context ok
isa_ok($DSCS->_schemas('Your::Model'),
  'HASH', 'load_schema creates Your::Model namespace OK');

t/01-dbix-simple-class-schema-sqlite.t  view on Meta::CPAN

  'users', 'first table is "users"');
is(scalar @{$DSCS->_schemas('Your::Model')->{tables}}, 1, 'the only table is "users"');

my $class_to_file = "$INC[0]/Your/Model.pm";
ok(!-f $class_to_file, 'schema class is NOT generated - OK');
my $class_code =
  $DSCS->load_schema(namespace => 'Your::Model', table => 'users', type => "'TABLE'");
unlike($class_code, qr/package\s+Your\:\:Model\;/x, 'No schema class generated - ok2');

SKIP: {
  skip "I have only linux and mac, see http://perldoc.perl.org/perlport.html#chmod", 1,
    if $^O !~ /linux|darwin/i;
  chmod 0444, $INC[0];
  ok(!$DSCS->dump_schema_at(lib_root => $INC[0]), 'quits OK');
  chmod 0755, $INC[0];
}
ok($DSCS->dump_schema_at(lib_root => $INC[0]), 'dumps OK');
File::Path::remove_tree($INC[0] . '/Your');


done_testing;



( run in 0.514 second using v1.01-cache-2.11-cpan-8d75d55dd25 )