X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FTest.pm;h=3b1c0921c00554123d7adf32254b8c799de2db00;hp=9854b94fa2706b4a8123ce1d9b2fc26a1243901f;hb=f822e27a1e00594332ffa487a1c284234c5580a6;hpb=cb6214a6c0b0ecc8c3a5c264ee98ff3f301c33a6 diff --git a/FS/FS/Test.pm b/FS/FS/Test.pm index 9854b94fa..3b1c0921c 100644 --- a/FS/FS/Test.pm +++ b/FS/FS/Test.pm @@ -211,7 +211,7 @@ and then pass the form object to L to submit it. sub form { my $self = shift; my $name = shift; - my ($form) = grep { $_->attr('name') eq $name } $self->forms; + my ($form) = grep { ($_->attr('name') || '') eq $name } $self->forms; $form; } @@ -235,4 +235,34 @@ sub qsearchs { FS::Record::qsearchs(@_); } +=item new_customer FIRSTNAME + +Returns an L object full of default test data, ready to be inserted. +This doesn't insert the customer, because you might want to change some things first. +FIRSTNAME is recommended so you know which test the customer was used for. + +=cut + +sub new_customer { + my $self = shift; + my $first = shift || 'No Name'; + my $location = FS::cust_location->new({ + address1 => '123 Example Street', + city => 'Sacramento', + state => 'CA', + country => 'US', + zip => '94901', + }); + my $cust = FS::cust_main->new({ + agentnum => 1, + refnum => 1, + last => 'Customer', + first => $first, + invoice_email => 'newcustomer@fake.freeside.biz', + bill_location => $location, + ship_location => $location, + }); + $cust; +} + 1; # End of FS::Test