mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-20 19:35:16 +00:00
111 lines
3.2 KiB
PHP
111 lines
3.2 KiB
PHP
<?php
|
|
/**
|
|
* MassControllerTest.php
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
*
|
|
* This software may be modified and distributed under the terms of the
|
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
*
|
|
* See the LICENSE file for details.
|
|
*/
|
|
|
|
namespace Transaction;
|
|
|
|
use TestCase;
|
|
|
|
/**
|
|
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:44.
|
|
*/
|
|
class MassControllerTest extends TestCase
|
|
{
|
|
|
|
|
|
/**
|
|
* Sets up the fixture, for example, opens a network connection.
|
|
* This method is called before a test is executed.
|
|
*/
|
|
public function setUp()
|
|
{
|
|
parent::setUp();
|
|
}
|
|
|
|
/**
|
|
* @covers \FireflyIII\Http\Controllers\Transaction\MassController::delete
|
|
*/
|
|
public function testDelete()
|
|
{
|
|
$this->be($this->user());
|
|
$this->call('get', route('transactions.mass.delete', [561, 562]));
|
|
$this->assertResponseStatus(200);
|
|
$this->see('Delete a number of transactions');
|
|
// has bread crumb
|
|
$this->see('<ol class="breadcrumb">');
|
|
}
|
|
|
|
/**
|
|
* @covers \FireflyIII\Http\Controllers\Transaction\MassController::destroy
|
|
*/
|
|
public function testDestroy()
|
|
{
|
|
$this->session(['transactions.mass-delete.url' => 'http://localhost']);
|
|
|
|
$data = [
|
|
'confirm_mass_delete' => [56, 37],
|
|
];
|
|
$this->be($this->user());
|
|
$this->call('post', route('transactions.mass.destroy'), $data);
|
|
$this->assertSessionHas('success');
|
|
$this->assertResponseStatus(302);
|
|
|
|
// visit them should give 404.
|
|
$this->call('get', route('transactions.show', [56]));
|
|
$this->assertResponseStatus(404);
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
* @covers \FireflyIII\Http\Controllers\Transaction\MassController::edit
|
|
*/
|
|
public function testEdit()
|
|
{
|
|
$this->be($this->user());
|
|
$this->call('get', route('transactions.mass.delete', [132, 113]));
|
|
$this->assertResponseStatus(200);
|
|
$this->see('Edit a number of transactions');
|
|
// has bread crumb
|
|
$this->see('<ol class="breadcrumb">');
|
|
}
|
|
|
|
/**
|
|
* @covers \FireflyIII\Http\Controllers\Transaction\MassController::update
|
|
*/
|
|
public function testUpdate()
|
|
{
|
|
|
|
$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'],
|
|
];
|
|
|
|
$this->be($this->user());
|
|
$this->call('post', route('transactions.mass.update', [132]), $data);
|
|
$this->assertSessionHas('success');
|
|
$this->assertResponseStatus(302);
|
|
|
|
// visit them should show updated content
|
|
$this->call('get', route('transactions.show', [132]));
|
|
$this->assertResponseStatus(200);
|
|
$this->see('Updated salary thing');
|
|
}
|
|
|
|
}
|