mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-23 04:46:44 +00:00
This fixes the broken tests.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Transaction;
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
@@ -34,8 +35,9 @@ class MassControllerTest extends TestCase
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
$withdrawals = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->take(2)->get()->pluck('id')->toArray();
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.mass.delete', [561, 562]));
|
||||
$this->call('get', route('transactions.mass.delete', $withdrawals));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('Delete a number of transactions');
|
||||
// has bread crumb
|
||||
@@ -48,9 +50,9 @@ class MassControllerTest extends TestCase
|
||||
public function testDestroy()
|
||||
{
|
||||
$this->session(['transactions.mass-delete.url' => 'http://localhost']);
|
||||
|
||||
$data = [
|
||||
'confirm_mass_delete' => [56, 37],
|
||||
$deposits = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->take(2)->get()->pluck('id')->toArray();
|
||||
$data = [
|
||||
'confirm_mass_delete' => $deposits,
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('transactions.mass.destroy'), $data);
|
||||
@@ -58,7 +60,7 @@ class MassControllerTest extends TestCase
|
||||
$this->assertResponseStatus(302);
|
||||
|
||||
// visit them should give 404.
|
||||
$this->call('get', route('transactions.show', [56]));
|
||||
$this->call('get', route('transactions.show', [$deposits[0]]));
|
||||
$this->assertResponseStatus(404);
|
||||
|
||||
|
||||
@@ -69,8 +71,9 @@ class MassControllerTest extends TestCase
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
$transfers = TransactionJournal::where('transaction_type_id', 3)->where('user_id', $this->user()->id)->take(2)->get()->pluck('id')->toArray();
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.mass.delete', [132, 113]));
|
||||
$this->call('get', route('transactions.mass.delete', $transfers));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('Edit a number of transactions');
|
||||
// has bread crumb
|
||||
@@ -82,27 +85,29 @@ class MassControllerTest extends TestCase
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
|
||||
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)
|
||||
->whereNull('deleted_at')
|
||||
->first();
|
||||
$this->session(['transactions.mass-edit.url' => 'http://localhost']);
|
||||
|
||||
$data = [
|
||||
'journals' => [132],
|
||||
'description' => [132 => 'Updated salary thing'],
|
||||
'amount' => [132 => 1600],
|
||||
'amount_currency_id_amount_132' => 1,
|
||||
'date' => [132 => '2014-07-24'],
|
||||
'source_account_name' => [132 => 'Job'],
|
||||
'destination_account_id' => [132 => 1],
|
||||
'category' => [132 => 'Salary'],
|
||||
'journals' => [$deposit->id],
|
||||
'description' => [$deposit->id => 'Updated salary thing'],
|
||||
'amount' => [$deposit->id => 1600],
|
||||
'amount_currency_id_amount_' . $deposit->id => 1,
|
||||
'date' => [$deposit->id => '2014-07-24'],
|
||||
'source_account_name' => [$deposit->id => 'Job'],
|
||||
'destination_account_id' => [$deposit->id => 1],
|
||||
'category' => [$deposit->id => 'Salary'],
|
||||
];
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('transactions.mass.update', [132]), $data);
|
||||
$this->call('post', route('transactions.mass.update', [$deposit->id]), $data);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertResponseStatus(302);
|
||||
|
||||
// visit them should show updated content
|
||||
$this->call('get', route('transactions.show', [132]));
|
||||
$this->call('get', route('transactions.show', [$deposit->id]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('Updated salary thing');
|
||||
}
|
||||
|
Reference in New Issue
Block a user