3 use Test::More tests => 4;
5 use Date::Parse 'str2time';
6 my $FS = FS::Test->new;
9 $FS->post('/misc/order_pkg.html', custnum => 2);
10 my $form = $FS->form('OrderPkgForm');
12 # Customer #2 has three packages:
13 # a $30 monthly prorate, a $90 monthly prorate, and a $25 annual prorate.
14 # Next bill date on the monthly prorates is 2016-04-01.
15 # Add a new package that will start billing on 2016-03-20 (to make prorate
22 start_date => '03/20/2016',
23 package_comment0 => $0, # record the test we're executing
26 $form->find_input('start')->disabled(0); # JS
27 foreach (keys %params) {
28 $form->value($_, $params{$_});
31 ok( $FS->error eq '' , 'form posted' );
33 ok( $FS->page =~ m[location = '.*/view/cust_main.cgi.*\#cust_pkg(\d+)'],
34 'new package accepted' )
36 # on success, sends us back to cust_main view with #cust_pkg$pkgnum
37 # but with an in-page javascript redirect
38 my $pkg = $FS->qsearchs('cust_pkg', { pkgnum => $1 });
39 isa_ok( $pkg, 'FS::cust_pkg' );
40 ok($pkg->start_date == str2time('2016-03-20'), 'start date set');
42 # try to display the error message, or if not, show everything
43 $FS->post($FS->redirect);