Files
firefly-iii/tests/acceptance/Controllers/Transaction/SplitControllerTest.php
2016-12-11 11:04:53 +01:00

85 lines
2.5 KiB
PHP

<?php
/**
* SplitControllerTest.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 SplitControllerTest 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\SplitController::edit
* Implement testEdit().
*/
public function testEdit()
{
$this->be($this->user());
$this->call('get', route('transactions.split.edit', [18]));
$this->assertResponseStatus(200);
// has bread crumb
$this->see('<ol class="breadcrumb">');
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\SplitController::update
* Implement testUpdate().
*/
public function testUpdate()
{
$this->session(['transactions.edit-split.url' => 'http://localhost']);
$data = [
'id' => 18,
'what' => 'deposit',
'journal_description' => 'Updated salary',
'currency_id' => 1,
'journal_destination_account_id' => 1,
'journal_amount' => 1591,
'date' => '2014-01-24',
'tags' => '',
'transactions' => [
[
'description' => 'Split #1',
'source_account_name' => 'Job',
'amount' => 1591,
'category' => '',
],
],
];
$this->be($this->user());
$this->call('post', route('transactions.split.update', [18]), $data);
$this->assertResponseStatus(302);
$this->assertSessionHas('success');
// journal is updated?
$this->call('get', route('transactions.show', [18]));
$this->assertResponseStatus(200);
$this->see('Updated salary');
// has bread crumb
$this->see('<ol class="breadcrumb">');
}
}