From 2daed0d1cc7813167a30f57660e3a03c320c2877 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 22 Jul 2009 00:20:44 +0000 Subject: [PATCH] Fix test. Inheritance wasn't working with the package defined inside the test. --- t/Crud/Subclass.t | 20 +------------------- t/lib/WebGUI/SubClass.pm | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 19 deletions(-) create mode 100644 t/lib/WebGUI/SubClass.pm diff --git a/t/Crud/Subclass.t b/t/Crud/Subclass.t index a747f4d8f..92fd009ba 100644 --- a/t/Crud/Subclass.t +++ b/t/Crud/Subclass.t @@ -1,22 +1,3 @@ -package WebGUI::Crud::Subclass; - -use strict; -use base 'WebGUI::Crud'; -sub crud_definition { - my ($class, $session) = @_; - my $definition = $class->SUPER::crud_definition($session); - $definition->{tableName} = 'crudSubclass'; - $definition->{tableKey} = 'crudSubclassId'; - $definition->{sequenceKey} = ''; - my $properties = $definition->{properties}; - $properties->{field1} = { - fieldType => 'integer', - defaultValue => 5, - }; - return $definition; -} - -#package main; # vim:syntax=perl #------------------------------------------------------------------- # WebGUI is Copyright 2001-2009 Plain Black Corporation. @@ -34,6 +15,7 @@ use strict; use lib "$FindBin::Bin/../lib"; use Test::More; use WebGUI::Test; # Must use this before any other WebGUI modules +use WebGUI::SubClass; #---------------------------------------------------------------------------- # Init diff --git a/t/lib/WebGUI/SubClass.pm b/t/lib/WebGUI/SubClass.pm new file mode 100644 index 000000000..482edbf5b --- /dev/null +++ b/t/lib/WebGUI/SubClass.pm @@ -0,0 +1,21 @@ +package WebGUI::Crud::Subclass; + +use strict; + +use base 'WebGUI::Crud'; + +sub crud_definition { + my ($class, $session) = @_; + my $definition = $class->SUPER::crud_definition($session); + $definition->{tableName} = 'crudSubclass'; + $definition->{tableKey} = 'crudSubclassId'; + $definition->{sequenceKey} = ''; + my $properties = $definition->{properties}; + $properties->{field1} = { + fieldType => 'integer', + defaultValue => 5, + }; + return $definition; +} + +1;