diff --git a/t/run_asset.t b/t/run_asset.t index c6b8a61a2..feb70c12e 100644 --- a/t/run_asset.t +++ b/t/run_asset.t @@ -11,5 +11,7 @@ use lib 'tests'; use Test::AssetBase; +use Test::Asset::File; +use Test::Asset::Snippet; Test::Class->runtests; diff --git a/t/tests/Test/Asset/File.pm b/t/tests/Test/Asset/File.pm new file mode 100644 index 000000000..72de8760a --- /dev/null +++ b/t/tests/Test/Asset/File.pm @@ -0,0 +1,30 @@ +package Test::Asset::File; +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2009 Plain Black Corporation. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use FindBin; +use lib "$FindBin::Bin/lib"; + +use base qw/Test::AssetBase/; +use WebGUI::Test; + +use Test::More; +use Test::Deep; +use Test::Exception; + +sub class { + return qw/WebGUI::Asset::File/; +} + +sub list_of_tables { + return [qw/assetData FileAsset/]; +} + +1; diff --git a/t/tests/Test/Asset/Snippet.pm b/t/tests/Test/Asset/Snippet.pm new file mode 100644 index 000000000..129e025bf --- /dev/null +++ b/t/tests/Test/Asset/Snippet.pm @@ -0,0 +1,34 @@ +package Test::Asset::Snippet; +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2009 Plain Black Corporation. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use FindBin; +use lib "$FindBin::Bin/lib"; + +use base qw/Test::AssetBase/; +use WebGUI::Test; + +use Test::More; +use Test::Deep; +use Test::Exception; + +sub class { + return qw/WebGUI::Asset::Snippet/; +} + +sub uiLevel { + return 5; +} + +sub list_of_tables { + return [qw/assetData snippet/]; +} + +1; diff --git a/t/tests/Test/AssetBase.pm b/t/tests/Test/AssetBase.pm index 312d57e00..1ebaf5b12 100644 --- a/t/tests/Test/AssetBase.pm +++ b/t/tests/Test/AssetBase.pm @@ -40,7 +40,8 @@ sub _00_init : Test(startup) { my $test = shift; my $session = WebGUI::Test->session; $test->{_session} = $session; - eval { require $test->class; }; + note "Loading ". $test->class; + eval { WebGUI::Asset->loadModule($test->class); }; } sub _constructor : Test(4) { @@ -149,7 +150,8 @@ sub uiLevel : Test(1) { my $test = shift; my $session = $test->session; note "uiLevel"; - is $test->class->meta->uiLevel, $test->assetUiLevel, 'asset uiLevel check'; + my $asset = $test->class->new({session => $session}); + is $asset->uiLevel, $test->assetUiLevel, 'asset uiLevel check'; } sub write_update : Test(8) { @@ -273,7 +275,7 @@ sub addRevision : Test(6) { $session->db->write("delete from assetData where assetId like 'wg8TestAsset00000%'"); } -sub addRevision : Test(2) { +sub newByPropertyHashRef : Test(2) { my $test = shift; my $session = $test->session; note "newByPropertyHashRef";