Invoice test and invoice update issue solved

This commit is contained in:
Batuhan Baş 2018-11-05 20:07:40 +03:00
parent 97b353612b
commit 413b68fbe3
2 changed files with 13 additions and 10 deletions

View File

@ -240,6 +240,7 @@ class Invoices extends Controller
{ {
$taxes = []; $taxes = [];
$tax = 0;
$tax_total = 0; $tax_total = 0;
$sub_total = 0; $sub_total = 0;
$discount_total = 0; $discount_total = 0;

View File

@ -58,6 +58,7 @@ class InvoicesTest extends FeatureTestCase
->assertStatus(302); ->assertStatus(302);
$this->assertFlashLevel('success'); $this->assertFlashLevel('success');
} }
public function testItShouldDeleteInvoice() public function testItShouldDeleteInvoice()
@ -70,25 +71,24 @@ class InvoicesTest extends FeatureTestCase
->assertRedirect(url('incomes/invoices')); ->assertRedirect(url('incomes/invoices'));
$this->assertFlashLevel('success'); $this->assertFlashLevel('success');
} }
private function getInvoiceRequest($recurring = 0) private function getInvoiceRequest($recurring = 0)
{ {
$amount = $this->faker->randomFloat(2, 2); $amount = $this->faker->randomFloat(2, 2);
$items = [['name' => $this->faker->text(5), 'item_id' => null, 'quantity' => '1', 'price' => $amount, 'currency' => 'USD']];
$data = [ $data = [
'company_id' => $this->company->id,
'customer_id' => '0', 'customer_id' => '0',
'currency_code' => setting('general.default_currency'),
'currency_rate' => '1',
'invoiced_at' => $this->faker->date(), 'invoiced_at' => $this->faker->date(),
'due_at' => $this->faker->date(), 'due_at' => $this->faker->date(),
'invoice_number' => $this->faker->lexify('INV ???'), 'invoice_number' => '1',
'order_number' => $this->faker->randomDigit, 'order_number' => '1',
'item_id' => null, 'currency_code' => setting('general.default_currency'),
'item_name' => $this->faker->text(5), 'currency_rate' => '1',
'item_quantity' => '1', 'item' => $items,
'item_price' => $amount,
'item_currency' => setting('general.default_currency'),
'discount' => '0', 'discount' => '0',
'notes' => $this->faker->text(5), 'notes' => $this->faker->text(5),
'category_id' => $this->company->categories()->type('income')->first()->id, 'category_id' => $this->company->categories()->type('income')->first()->id,
@ -100,6 +100,7 @@ class InvoicesTest extends FeatureTestCase
'customer_address' => $this->faker->address, 'customer_address' => $this->faker->address,
'invoice_status_code' => 'draft', 'invoice_status_code' => 'draft',
'amount' => $amount, 'amount' => $amount,
'company_id' => $this->company->id,
]; ];
if ($recurring) { if ($recurring) {
@ -108,6 +109,7 @@ class InvoicesTest extends FeatureTestCase
$data['recurring_custom_frequency'] = $this->faker->randomElement(['monthly', 'weekly']); $data['recurring_custom_frequency'] = $this->faker->randomElement(['monthly', 'weekly']);
$data['recurring_count'] = '1'; $data['recurring_count'] = '1';
} }
return $data; return $data;
} }
} }