<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
include dirname(__FILE__) . '/../../testTools.php';
$deleteQuery = Doctrine_Query::create()->delete('Invoice i')->where('i.recurring_invoice_id IS NOT NULL');
$countQuery = RecurringInvoiceQuery::create();
$browser = new SiwappTestBrowser();
$browser->signin()->info("Recurring Invoices listing")->get('recurring')->with('request')->begin()->isParameter('module', 'recurring')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->is($countQuery->countPending(), 3, "There are 3 pending invoices.");
$browser->info("Pending invoices generation")->with('response')->begin()->checkElement('#pendingButton')->end()->click('Generate pending invoices now')->with('request')->begin()->isParameter('module', 'recurring')->isParameter('action', 'generate')->end()->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'recurring')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->is($countQuery->countPending(), 0, "No pending invoices.");
// delete generated invoices and reset recurrings status
$deleteQuery->execute();
foreach (RecurringInvoiceQuery::create()->execute() as $r) {
    $r->refresh(true);
    $r->checkStatus()->save();
}
$browser->info('Testing creating a new Invoice')->get('recurring')->with('request')->begin()->isParameter('module', 'recurring')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->end()->click('New Recurring Invoice', array())->with('request')->begin()->isParameter('module', 'recurring')->isParameter('action', 'new')->end()->with('response')->begin()->isStatusCode(200)->end()->click('Save', array('invoice' => $fake_recurring_array))->with('request')->begin()->isParameter('module', 'recurring')->isParameter('action', 'create')->end()->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'recurring')->isParameter('action', 'edit')->end()->info('Checking the created recurring exists in the db')->with('doctrine')->begin()->check('RecurringInvoice', array('customer_name' => $fake_recurring_array['customer_name']))->end();
$recurring = Doctrine::getTable('Common')->findOneBy('customer_name', $fake_recurring_array['customer_name']);
// change some value to edit:
$fake_recurring_array['period'] = '10';
$fake_recurring_array['terms'] = 'new test terms';
$browser->info('Testing the editing of a recurring invoice')->get('recurring/edit/' . $recurring->id)->with('request')->begin()->isParameter('module', 'recurring')->isParameter('action', 'edit')->end()->click('Save', array('invoice' => $fake_recurring_array))->with('request')->begin()->isParameter('module', 'recurring')->isParameter('action', 'update')->end()->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'recurring')->isParameter('action', 'edit')->end()->info('Checking the changed value in the database')->with('doctrine')->begin()->check('RecurringInvoice', array('id' => $recurring->id, 'period' => $fake_recurring_array['period']))->end();
$browser->info('Recurring Invoice Deleting')->call('/recurring/delete', 'POST', array('id' => $recurring->id))->with('request')->begin()->isParameter('module', 'recurring')->isParameter('action', 'delete')->end()->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'recurring')->isParameter('action', 'index')->end()->with('doctrine')->begin()->check('Invoice', array('id' => $recurring->id), false)->end();
Example #2
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new SiwappTestBrowser();
$browser->signin()->info("Check javascript i18n")->get('/js/i18n')->with('request')->begin()->isParameter('module', 'js')->isParameter('action', 'i18n')->end()->with('response')->begin()->isStatusCode(200)->matches('/var i18n/')->end()->info("Check javascript urls")->get('/js/url?key=invoices')->with('request')->begin()->isParameter('module', 'js')->isParameter('action', 'url')->end()->with('response')->begin()->isStatusCode(200)->matches('/var siwapp_urls/')->matches('/addPayment/')->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
include dirname(__FILE__) . '/../../testTools.php';
$browser = new SiwappTestBrowser();
$browser->signin()->info('Recurring Searching')->call('/recurring', 'POST', array('search' => array('query' => 'plow')))->with('response')->begin()->isStatusCode(200)->checkElement('table.listing tbody tr.link td:nth-child(3)', 'Plow King')->end()->call('/recurring', 'POST', array('search' => array('series_id' => 3)))->with('response')->begin()->isStatusCode(200)->checkElement('table.listing tbody tr.link td:nth-child(3)', 'Krustyco')->end()->call('/recurring', 'POST', array('search' => array('status' => 1)))->with('response')->begin()->isStatusCode(200)->matches('/No results/')->end()->call('/recurring', 'POST', array('search' => array('period_type' => 'month')))->with('response')->begin()->isStatusCode(200)->checkElement('table.listing tbody tr.link td:nth-child(3)', 'Plow King')->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new SiwappTestBrowser();
$browser->signin()->get('settings/templates')->with('request')->begin()->isParameter('module', 'printTemplates')->isParameter('action', 'index')->end()->with('response')->begin()->checkElement('td:contains("Invoice Template")')->end()->get('settings/templates/edit?id=1')->with('request')->begin()->isParameter('module', 'printTemplates')->isParameter('action', 'edit')->end()->with('response')->begin()->checkElement('input[value="Invoice Template"]')->checkElement('textarea')->end()->setField('template[name]', 'testing')->click('Save')->with('response')->begin()->isRedirected()->end()->followRedirect()->with('response')->begin()->checkElement('input[value="testing"]')->checkElement('textarea')->end()->setField('template[name]', 'Invoice Template')->click('Save');
<?php

/**
 * These tests are only for the edition of estimates
 *
 **/
include dirname(__FILE__) . '/../../bootstrap/functional.php';
include dirname(__FILE__) . '/../../testTools.php';
$browser = new SiwappTestBrowser();
//save action
$browser->signin()->get('estimates')->with('request')->begin()->isParameter('module', 'estimates')->isParameter('action', 'index')->end()->info('Testing creating a new Estimate')->with('response')->begin()->checkElement('a#new-invoice-button')->end()->click('New Estimate', array())->with('request')->begin()->isParameter('module', 'estimates')->isParameter('action', 'new')->end()->with('response')->begin()->isStatusCode(200)->end()->click('Save', array('invoice' => $fake_estimate_array))->with('request')->begin()->isParameter('module', 'estimates')->isParameter('action', 'create')->end()->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'estimates')->isParameter('action', 'edit')->end()->info('Checking the changed value')->with('doctrine')->begin()->check('Estimate', array('customer_name' => $fake_estimate_array['customer_name'], 'due_date' => $fake_estimate_array['due_date']))->check('Item', array('description' => $fake_estimate_array['Items'][0]['description'], 'unitary_cost' => $fake_estimate_array['Items'][0]['unitary_cost']))->end()->info('Checking the created Customer')->with('doctrine')->begin()->check('Customer', array('name' => $fake_estimate_array['customer_name'], 'email' => $fake_estimate_array['customer_email']))->end();
$estimate = Doctrine::getTable('Common')->findOneBy('customer_name', $fake_estimate_array['customer_name']);
// change some value to edit:
$fake_estimate_array['issue_date'] = '2011-01-01';
$fake_estimate_array['terms'] = 'new test terms';
$fake_estimate_array['customer_email'] = '*****@*****.**';
//edit action
$browser->info('Testing editing an Estimate')->get('/estimates/edit/' . $estimate->id)->with('request')->begin()->isParameter('module', 'estimates')->isParameter('action', 'edit')->end()->click('Save', array('invoice' => $fake_estimate_array))->with('request')->begin()->isParameter('module', 'estimates')->isParameter('action', 'update')->end()->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'estimates')->isParameter('action', 'edit')->end()->info('Checking the changed value in the database')->with('doctrine')->begin()->check('Estimate', array('id' => $estimate->id, 'issue_date' => $fake_estimate_array['issue_date'], 'terms' => $fake_estimate_array['terms']))->end()->info('Checking the modified customer values in the estimate doesnt affect customer')->with('doctrine')->begin()->check('Customer', array('name' => $fake_estimate_array['customer_name'], 'email' => $fake_estimate_array['customer_email']), false)->end();
//delete
$browser->info('Estimate Deleting')->call('/estimates/delete', 'POST', array('id' => $estimate->id))->with('request')->begin()->isParameter('module', 'estimates')->isParameter('action', 'delete')->end()->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'estimates')->isParameter('action', 'index')->end()->with('doctrine')->begin()->check('Estimate', array('id' => $estimate->id), false)->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
include dirname(__FILE__) . '/../../testTools.php';
$browser = new SiwappTestBrowser();
$browser->get('/login')->with('request')->begin()->isParameter('module', 'sfGuardAuth')->isParameter('action', 'signin')->end()->info('  1.1 - Testing sending the activation link email')->with('response')->begin()->checkElement('input[name="username_email"]')->end()->setHttpHeader('X_REQUESTED_WITH', 'XMLHttpRequest')->get('/password_recovery', array('username_email' => 'test'))->with('request')->begin()->isParameter('module', 'sfGuardAuth')->isParameter('action', 'passwordRecovery')->end()->info('  1.1 - Testing the received activation link email')->with('mailer')->begin()->info('Testing if the activation email has been sent')->hasSent()->checkBody('/http.*password_reset\\/\\w{32}\\b/')->end();
$logger = $browser->getContext()->getMailer()->getLogger();
if ($logger->countMessages()) {
    $messages = $logger->getMessages();
}
$message = $messages[0];
preg_match('/http.*password_reset\\/[a-z,A-Z,0-9]{32}/', $message->getBody(), $matches);
$recovery_url = $matches[0];
$browser->info('  1.1 - Testing clicking on the activation link')->get($recovery_url)->with('request')->begin()->isParameter('module', 'sfGuardAuth')->isParameter('action', 'passwordReset')->end()->info('  1.1 - Testing the received password email')->with('mailer')->begin()->info('Testing if the password email has been sent')->hasSent()->checkBody('/Password:\\s*\\S{8}\\b/')->end();
$logger = $browser->getContext()->getMailer()->getLogger();
if ($logger->countMessages()) {
    $messages = $logger->getMessages();
}
$message = $messages[0];
preg_match('/Password:\\s*(\\S{8})\\b/', $message->getBody(), $matches);
$password = $matches[1];
$browser->info('  1.1 - Signing in with the new password')->signin('test', $password)->with('request')->begin()->isParameter('module', 'dashboard')->isParameter('action', 'index')->end();
$user = Doctrine::getTable('sfGuardUser')->findOneBy('username', 'test');
$user->setPassword('test');
$user->save();
$browser->info('  1.1 - Logging out')->get('/logout');
$browser->info('  1.1 - Signing in with the old password')->signin();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
include dirname(__FILE__) . '/../../testTools.php';
$browser = new SiwappTestBrowser();
$browser->signin()->get('/products')->with('request')->begin()->isParameter('module', 'products')->isParameter('action', 'index')->end()->info('Products listing results')->with('response')->begin()->isStatusCode(200)->checkElement('body', '/Reference/')->checkElement('table#listing tr.link', 6)->end()->info('Products filtered listings: only sold products')->post('/products', array('search' => array('to' => array('month' => '5', 'day' => '1', 'year' => '2011'))))->with('response')->begin()->checkElement('table#listing tr.link', 3)->end()->info('Products filtered listings: only until 2008')->post('/products', array('search' => array('to' => array('month' => '1', 'day' => '1', 'year' => '2008'))))->with('response')->begin()->checkElement('table#listing tr.link', 2)->checkElement('table#listing tr#product-2 td:nth-child(5)', '/8/')->checkElement('table#listing tr#product-2 td:nth-child(6)', '/1,656.64/')->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
include dirname(__FILE__) . '/../../testTools.php';
$browser = new SiwappTestBrowser();
$browser->signin()->info('Invoice Searching')->call('/invoices', 'POST', array('search' => array('query' => 'initech')))->with('response')->begin()->isStatusCode(200)->checkElement('table.listing tbody tr.link td:nth-child(3)', 'Initech')->end()->call('/invoices', 'POST', array('search' => array('from' => array('year' => '2009', 'month' => '4', 'day' => '16'), 'to' => array('year' => '2009', 'month' => '6', 'day' => '16'))))->with('response')->begin()->isStatusCode(200)->checkElement('table.listing tbody tr.link td:nth-child(3)', 'Sample, inc')->end()->call('/invoices', 'POST', array('search' => array('series_id' => 2)))->with('response')->begin()->isStatusCode(200)->checkElement('table.listing tbody tr.link td:nth-child(3)', 'Big Kahuna Burger')->end()->call('/invoices', 'POST', array('search' => array('status' => 3, 'series_id' => 1)))->with('response')->begin()->isStatusCode(200)->checkElement('table.listing tbody tr.link td:nth-child(3)', 'Allied Biscuit')->end()->call('/invoices', 'POST', array('search' => array('tags' => 'do')))->with('response')->begin()->isStatusCode(200)->checkElement('table.listing tbody tr.link td:nth-child(3)', 'Tessier-Ashpool')->end();
Example #9
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
include dirname(__FILE__) . '/../../testTools.php';
$browser = new SiwappTestBrowser();
$browser->signin()->info('Test the send email action')->post('/invoices/batch', array('ids' => array(23, 21), 'batch_action' => 'email'))->with('mailer')->begin()->hasSent(2)->checkHeader('Subject', '/Invoicer LTD \\[Invoice: ASET-8\\]/')->checkBody('/\\.*Invoicer LTD/')->end()->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'invoices')->isParameter('action', 'index')->end();
// create to fake invoices to delete them
$inv1 = new Invoice();
$inv2 = new Invoice();
$inv1->fromArray($fake_invoice_array);
$inv2->fromArray($fake_invoice_array);
$inv1->save();
$inv2->save();
$browser->info('Test the batch delete action')->post('/invoices/batch', array('ids' => array($inv1->id, $inv2->id), 'batch_action' => 'delete'))->with('response')->begin()->isRedirected()->end()->followRedirect()->with('doctrine')->begin()->check('Invoice', array('id' => $inv1->id), false)->check('Invoice', array('id' => $inv2->id), false)->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new SiwappTestBrowser();
$browser->signin()->info('>> CONFIGURATION: Global')->get('configuration/settings')->with('request')->begin()->isParameter('module', 'configuration')->isParameter('action', 'settings')->end()->with('response')->begin()->checkElement('h3:contains("Company")')->end()->info('Set an invalid email and send')->setField('config[company_email]', 'this is not an email')->click('Save')->with('request')->begin()->isParameter('module', 'configuration')->isParameter('action', 'settings')->end()->with('response')->begin()->isStatusCode(200)->checkElement('ul.error_list')->info('Set a valid email and send')->setField('config[company_email]', '*****@*****.**')->click('Save')->end()->with('request')->begin()->isParameter('module', 'configuration')->isParameter('action', 'settings')->isMethod('post')->end()->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'configuration')->isParameter('action', 'settings')->end()->with('response')->begin()->isStatusCode(200)->checkElement('input[value*="*****@*****.**"]')->end()->info('>> CONFIGURATION: My settings (profile)')->get('configuration/profile')->with('request')->begin()->isParameter('module', 'configuration')->isParameter('action', 'profile')->end()->with('response')->begin()->isStatusCode(200)->checkElement('#config_first_name')->info('Set first name')->setField('config[first_name]', 'The Test')->click('Save')->end()->with('request')->begin()->isParameter('module', 'configuration')->isParameter('action', 'profile')->isMethod('post')->end()->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'configuration')->isParameter('action', 'profile')->end()->with('response')->begin()->isStatusCode(200)->checkElement('input[value*="The Test"]')->info('Trying to modify the sf_guard_user_id')->setField('config[config_sf_guard_user_id]', 3456)->click('Save')->end()->with('request')->begin()->isParameter('module', 'configuration')->isParameter('action', 'profile')->end()->with('response')->begin()->isStatusCode(200)->checkElement('ul.error_list')->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new SiwappTestBrowser();
$browser->signin()->get('dashboard')->with('request')->begin()->isParameter('module', 'dashboard')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('#dashboard-balance-total', '/262,149\\.22/')->checkElement('#dashboard-balance-net', '/247,223\\.88/')->checkElement('#dashboard-balance-taxes', '/14,925\\.33/')->checkElement('#dashboard-taxes td:nth-child(2)', '/20,268\\.28/')->checkElement('#dashboard-taxes tr:nth-child(2) td:nth-child(2)', '/1,900\\.06/')->checkElement('#dashboard-taxes tr:nth-child(3) td:nth-child(2)', '/2,621\\.06/')->checkElement('#dashboard-taxes tr:nth-child(4) td:nth-child(2)', '/9,864\\.08/')->checkElement('#receipts', '/259,335\\.25/')->checkElement('#due', '/2,813\\.97/')->checkElement('#overdue', '/637\\.47/')->end()->get('/payments/form?invoice_id=23')->with('request')->begin()->isParameter('module', 'payments')->isParameter('action', 'form')->end()->with('response')->begin()->isStatusCode(200)->checkElement('input[class="amount"][value="12566.94"]', true)->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new SiwappTestBrowser();
$browser->signin()->get('/products')->info('Product creation')->click('New Product')->click('Save', array('product' => array('reference' => 'New reference', 'description' => 'New description', 'price' => '33.3')))->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'products')->isParameter('action', 'edit')->end()->info('Checking the created product')->with('doctrine')->begin()->check('Product', array('description' => 'New description', 'reference' => 'New reference', 'price' => '33.3'))->end()->info('Product modification')->click('Save', array('product' => array('reference' => 'NEWMOD reference', 'description' => 'NEWMOD description', 'price' => '99.9')))->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'products')->isParameter('action', 'edit')->end()->info('Checking the updated product')->with('doctrine')->begin()->check('Product', array('description' => 'NEWMOD description', 'reference' => 'NEWMOD reference', 'price' => '99.9'))->end()->info('Product deleting')->click('Delete')->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'products')->isParameter('action', 'index')->end()->info('Checking product was deleted')->with('doctrine')->begin()->check('Product', array('description' => 'NEWMOD description', 'reference' => 'NEWMOD reference', 'price' => '99.9'), false)->end();
<?php

/**
 * These tests are only for the edition/batch actions of customers
 *
 **/
include dirname(__FILE__) . '/../../bootstrap/functional.php';
include dirname(__FILE__) . '/../../testTools.php';
$browser = new SiwappTestBrowser();
//save action
$browser->signin()->post('customers/batch', array('batch_action' => 'delete', 'ids' => array(6)))->with('request')->begin()->isParameter('module', 'customers')->isParameter('action', 'batch')->end()->info('Testing deleting a customer with invoices')->with('response')->begin()->isRedirected()->followRedirect()->end();
$browser->info('Trying to insert customer with same name slug')->get('customers/new')->with('request')->begin()->isParameter('module', 'customers')->isParameter('action', 'new')->end()->click('Save', array('customer' => array('name' => 'Smi th andCo!', 'email' => '*****@*****.**')))->with('request')->begin()->isParameter('module', 'customers')->isParameter('action', 'create')->end()->with('response')->begin()->matches('/Name too close/')->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new SiwappTestBrowser();
$invoice = Doctrine::getTable('Invoice')->findOneBy('CustomerName', 'Initech');
$invoice_array = $invoice->toArray();
$payment = $invoice->getPayments()->getFirst();
$payment_revert = $payment->toArray();
$browser->signin()->info('Test that form loads right')->setHttpHeader('X_REQUESTED_WITH', 'XMLHttpRequest')->get('/payments/form', array('invoice_id' => $invoice->getId()))->with('response')->begin()->checkElement('form.payments-form')->checkElement(sprintf('input[value=%d]', $invoice->getId()))->checkElement('input.notes')->checkElement('input.remove')->end()->info('Testing the post of the form')->setField(sprintf('payments[old_%s][amount]', $payment->getId()), 1)->setField(sprintf('payments[old_%s][notes]', $payment->getId()), 'this has changed')->click('Save')->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'dashboard')->isParameter('action', 'index')->end()->info('Checking the changed value')->with('doctrine')->begin()->check('Payment', array('notes' => 'this has changed', 'amount' => 1, 'invoice_id' => $invoice->getId()))->end()->info('Now check that sending the form in invoices module, we go to invoices module again')->get('invoices')->get(sprintf('/payments/form?invoice_id=%s', $invoice->getId()))->info('Testing the post of the form, and reset original values')->setField(sprintf('payments[old_%s][amount]', $payment->getId()), 8110.14)->setField(sprintf('payments[old_%s][notes]', $payment->getId()), 'Ut enim ad minim')->click('Save')->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'invoices')->isParameter('action', 'index')->end()->info('Checking the changed value')->with('doctrine')->begin()->check('Payment', array('id' => $payment->getId(), 'notes' => 'Ut enim ad minim', 'amount' => '8110.140000000000000%', 'invoice_id' => $invoice->getId()), 1)->end()->info('Checking the add payment')->setHttpHeader('X_REQUESTED_WITH', 'XMLHttpRequest')->get('/payments/add', array('invoice_id' => $invoice->getId(), 'index' => 'fakeIndex'))->with('response')->begin()->checkElement('.xit')->checkElement('input#payments_new_fakeIndex_id')->checkElement(sprintf('input[value=%d]', $invoice->getId()))->checkElement('input.notes')->end()->info('Checking the deletion')->setHttpHeader('X_REQUESTED_WITH', 'XMLHttpRequest')->get('/payments/form', array('invoice_id' => $invoice->getId()))->setField(sprintf('payments[old_%s][remove]', $payment->getId()), 1)->click('Save')->info('Checking there is no payment in the database')->with('doctrine')->begin()->check('Payment', array('invoice_id' => $invoice->getId(), 'notes' => 'Ut enim ad minim'), false)->end();
// now revert the payment
$payment = new Payment();
$payment->fromArray($payment_revert);
$payment->save();
$invoice->refresh(true);
$invoice->setAmounts()->save();
Example #15
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new SiwappTestBrowser();
$browser->signin()->info('Get the print page')->get('/invoices/print/print', array('ids' => array(23)))->with('response')->begin()->isStatusCode(200)->matches('/Company: Invoicer LTD/')->matches('/Excepteur sint occaecat/')->end()->get('/estimates/print/print', array('ids' => array(24)))->with('response')->begin()->isStatusCode(200)->matches('/Company: Invoicer LTD/')->matches('/Estimate/')->end();
Example #16
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new SiwappTestBrowser();
$browser->signin()->get('common/ajaxAddInvoiceItem', array('invoice_id' => 2))->with('request')->begin()->isParameter('module', 'common')->isParameter('action', 'ajaxAddInvoiceItem')->end()->with('response')->begin()->isStatusCode(200)->checkElement('input[value*="2"]')->checkElement('span.taxes')->end()->get('common/ajaxAddInvoiceItemTax')->with('request')->begin()->isParameter('module', 'common')->isParameter('action', 'ajaxAddInvoiceItemTax')->end()->with('response')->begin()->isStatusCode(200)->checkElement('select.tax')->end()->get('common/ajaxInvoiceItemsAutocomplete', array('q' => 'illo'))->with('request')->begin()->isParameter('module', 'common')->isParameter('action', 'ajaxInvoiceItemsAutocomplete')->end()->with('response')->begin()->isStatusCode(200)->matches('/Ab illo inventore veritatis/')->end()->get('common/ajaxTagsAutocomplete', array('q' => 'veniam', 'limit' => 2))->with('request')->begin()->isParameter('module', 'common')->isParameter('action', 'ajaxTagsAutocomplete')->end()->with('response')->begin()->isStatusCode(200)->matches('/{\\"veniam\\":\\"veniam\\"}/')->end();