Akaunting/tests/Feature/Incomes/RevenuesTest.php

62 lines
1.6 KiB
PHP
Raw Normal View History

2018-10-09 11:18:12 +00:00
<?php
namespace Tests\Feature\Incomes;
2019-11-17 12:06:00 +00:00
use App\Jobs\Banking\CreateTransaction;
2019-12-16 10:19:09 +00:00
use App\Models\Banking\Transaction;
2018-10-09 11:18:12 +00:00
use Tests\Feature\FeatureTestCase;
class RevenuesTest extends FeatureTestCase
{
public function testItShouldSeeRevenueListPage()
{
$this->loginAs()
->get(route('revenues.index'))
->assertStatus(200)
->assertSeeText(trans_choice('general.revenues', 2));
}
public function testItShouldSeeRevenueCreatePage()
{
$this->loginAs()
->get(route('revenues.create'))
->assertStatus(200)
->assertSeeText(trans('general.title.new', ['type' => trans_choice('general.revenues', 1)]));
}
public function testItShouldCreateRevenue()
{
$this->loginAs()
2019-12-16 10:19:09 +00:00
->post(route('revenues.store'), factory(Transaction::class)->raw())
2019-11-16 07:21:14 +00:00
->assertStatus(200);
2018-10-09 11:18:12 +00:00
$this->assertFlashLevel('success');
}
public function testItShouldUpdateRevenue()
{
2019-12-16 10:19:09 +00:00
$request = factory(Transaction::class)->raw();
2018-10-09 11:18:12 +00:00
2019-11-17 12:06:00 +00:00
$revenue = $this->dispatch(new CreateTransaction($request));
2018-10-09 11:18:12 +00:00
$request['name'] = $this->faker->text(15);
$this->loginAs()
->patch(route('revenues.update', $revenue->id), $request)
2019-11-16 07:21:14 +00:00
->assertStatus(200);
2018-10-09 11:18:12 +00:00
$this->assertFlashLevel('success');
}
public function testItShouldDeleteRevenue()
{
2019-12-16 10:19:09 +00:00
$revenue = $this->dispatch(new CreateTransaction(factory(Transaction::class)->raw()));
2018-10-09 11:18:12 +00:00
$this->loginAs()
->delete(route('revenues.destroy', $revenue->id))
2019-11-16 07:21:14 +00:00
->assertStatus(200);
2018-10-09 11:18:12 +00:00
$this->assertFlashLevel('success');
}
2019-04-02 15:51:06 +00:00
}