-#!perl -T
+#!/usr/bin/env perl -T
# the above line forces Test::Harness into taint-mode
+# DO NOT REMOVE
use strict;
use warnings;
use Test::More;
-BEGIN { plan tests => 7 }
+use Test::Exception;
+use lib qw(t/lib);
-package DBICTest::Taint::Classes;
+throws_ok (
+ sub { $ENV{PATH} . (kill (0)) },
+ qr/Insecure dependency in kill/,
+ 'taint mode active'
+);
-use Test::More;
-use Test::Exception;
+{
+ package DBICTest::Taint::Classes;
-use lib qw(t/lib);
-use base qw/DBIx::Class::Schema/;
+ use Test::More;
+ use Test::Exception;
-lives_ok (sub {
- __PACKAGE__->load_classes(qw/Manual/);
- ok( __PACKAGE__->source('Manual'), 'The Classes::Manual source has been registered' );
- __PACKAGE__->_unregister_source (qw/Manual/);
-}, 'Loading classes with explicit load_classes worked in taint mode' );
+ use base qw/DBIx::Class::Schema/;
-lives_ok (sub {
- __PACKAGE__->load_classes();
- ok( __PACKAGE__->source('Auto'), 'The Classes::Auto source has been registered' );
- ok( __PACKAGE__->source('Auto'), 'The Classes::Manual source has been re-registered' );
-}, 'Loading classes with Module::Find/load_classes worked in taint mode' );
+ lives_ok (sub {
+ __PACKAGE__->load_classes(qw/Manual/);
+ ok( __PACKAGE__->source('Manual'), 'The Classes::Manual source has been registered' );
+ __PACKAGE__->_unregister_source (qw/Manual/);
+ }, 'Loading classes with explicit load_classes worked in taint mode' );
+ lives_ok (sub {
+ __PACKAGE__->load_classes();
+ ok( __PACKAGE__->source('Auto'), 'The Classes::Auto source has been registered' );
+ ok( __PACKAGE__->source('Auto'), 'The Classes::Manual source has been re-registered' );
+ }, 'Loading classes with Module::Find/load_classes worked in taint mode' );
+}
-package DBICTest::Taint::Namespaces;
+{
+ package DBICTest::Taint::Namespaces;
-use Test::More;
-use Test::Exception;
+ use Test::More;
+ use Test::Exception;
-use lib qw(t/lib);
-use base qw/DBIx::Class::Schema/;
+ use base qw/DBIx::Class::Schema/;
-lives_ok (sub {
- __PACKAGE__->load_namespaces();
- ok( __PACKAGE__->source('Test'), 'The Namespaces::Test source has been registered' );
-}, 'Loading classes with Module::Find/load_namespaces worked in taint mode' );
+ lives_ok (sub {
+ __PACKAGE__->load_namespaces();
+ ok( __PACKAGE__->source('Test'), 'The Namespaces::Test source has been registered' );
+ }, 'Loading classes with Module::Find/load_namespaces worked in taint mode' );
+}
-1;
+done_testing;
-#!/usr/bin/perl -w
-
use strict;
-use warnings;
+use warnings;
use Test::More;
use lib qw(t/lib);
my $schema = DBICTest->init_schema();
-plan tests => 5;
-
my $cd = $schema->resultset("CD")->find(2);
ok $cd->liner_notes;
ok keys %{$cd->{_relationship_data}}, "_relationship_data populated";
ok $cd->liner_notes->delete;
$cd->discard_changes;
-ok !$cd->liner_notes, 'discard_changes resets relationship';
\ No newline at end of file
+ok !$cd->liner_notes, 'discard_changes resets relationship';
+
+done_testing;
-#!/usr/bin/perl -w
-
use strict;
-use warnings;
+use warnings;
use Test::More;
use lib qw(t/lib);
my $schema = DBICTest->init_schema();
-plan tests => 1;
-
{
my @warnings;
local $SIG{__WARN__} = sub { push @warnings, @_; };
# Test that this doesn't cause infinite recursion.
local *DBICTest::Artist::DESTROY;
local *DBICTest::Artist::DESTROY = sub { $_[0]->discard_changes };
-
+
my $artist = $schema->resultset("Artist")->create( {
artistid => 10,
name => "artist number 10",
});
-
+
$artist->name("Wibble");
-
+
print "# About to call DESTROY\n";
}
is_deeply \@warnings, [];
-}
\ No newline at end of file
+}
+
+done_testing;