summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-05-30 10:06:57 -0700
committerMark Wells <mark@freeside.biz>2016-05-30 10:08:32 -0700
commit1079e4e27cbb9e13e9ae4eada00ffdbc81066cd0 (patch)
tree24f2d93a0b395e4b4fff3db914170e204ce8562d
parent5f56c0b2cff75292ce5f2e557b403c45d018b8c9 (diff)
add convenience method for tests to create a new customer
-rw-r--r--FS/FS/Test.pm31
1 files changed, 31 insertions, 0 deletions
diff --git a/FS/FS/Test.pm b/FS/FS/Test.pm
index 9854b94fa..1f2b44bd6 100644
--- a/FS/FS/Test.pm
+++ b/FS/FS/Test.pm
@@ -235,4 +235,35 @@ sub qsearchs {
FS::Record::qsearchs(@_);
}
+=item new_customer FIRSTNAME
+
+Returns an L<FS::cust_main> 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',
+ payby => 'BILL',
+ bill_location => $location,
+ ship_location => $location,
+ });
+ $cust;
+}
+
1; # End of FS::Test