From 01835737dc587591ddd05a52f4cb76d137c9e128 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 1 Apr 2008 23:22:03 +0000 Subject: [PATCH] widget script for throwing Products into the db for testing upgrades --- t/Shop/loadProducts.pl | 73 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 t/Shop/loadProducts.pl diff --git a/t/Shop/loadProducts.pl b/t/Shop/loadProducts.pl new file mode 100644 index 000000000..503309c51 --- /dev/null +++ b/t/Shop/loadProducts.pl @@ -0,0 +1,73 @@ +# vim:syntax=perl +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2008 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 +#------------------------------------------------------------------ + +# Write a little about what this script tests. +# +# + +use FindBin; +use strict; +use lib "$FindBin::Bin/../lib"; +use Test::More qw(no_plan); + +use WebGUI::Test; # Must use this before any other WebGUI modules +use WebGUI::Session; +use WebGUI::Shop::Tax; +use WebGUI::Asset::Wobject::Product; +use WebGUI::VersionTag; + +#---------------------------------------------------------------------------- +# Init +my $session = WebGUI::Test->session; + +#---------------------------------------------------------------------------- +# put your tests here + +##Create products by hand + +my $tag = WebGUI::VersionTag->getWorking($session); + +my $properties1 = { + className => 'WebGUI::Asset::Wobject::Product', + url => 'one', + price => 10.00, + productNumber => '#1', + title => 'product 1', + description => 'First product', +}; + +my $root = WebGUI::Asset->getRoot($session); +my $product1 = $root->addChild($properties1); + +diag ref $product1; + +my $properties2 = { + className => 'WebGUI::Asset::Wobject::Product', + url => 'two', + price => 20.00, + productNumber => '#2', + title => 'product 2', + description => 'Second product', +}; + +my $product2 = $root->addChild($properties2); + +diag ref $product2; + +$tag->commit; + +$tag = WebGUI::VersionTag->getWorking($session); + +my $product1a = $product1->addRevision({price => 11.11}); + +$tag->commit; + +diag "Done.";