2016-11-19 20:30:30 +01:00
|
|
|
<?php
|
2016-12-06 09:16:36 +01:00
|
|
|
/**
|
|
|
|
* ConvertControllerTest.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.
|
|
|
|
*/
|
|
|
|
|
2016-11-19 20:30:30 +01:00
|
|
|
namespace Transaction;
|
2016-12-10 06:54:50 +01:00
|
|
|
|
2016-11-19 20:30:30 +01:00
|
|
|
use TestCase;
|
|
|
|
|
|
|
|
/**
|
2016-12-10 06:54:50 +01:00
|
|
|
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:43.
|
2016-11-19 20:30:30 +01:00
|
|
|
*/
|
|
|
|
class ConvertControllerTest extends TestCase
|
|
|
|
{
|
2016-11-20 07:24:18 +01:00
|
|
|
|
2016-11-19 20:30:30 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets up the fixture, for example, opens a network connection.
|
|
|
|
* This method is called before a test is executed.
|
|
|
|
*/
|
|
|
|
public function setUp()
|
|
|
|
{
|
2016-11-20 08:30:25 +01:00
|
|
|
parent::setUp();
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|
|
|
|
|
2016-12-07 19:53:41 +01:00
|
|
|
/**
|
|
|
|
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::index
|
2016-11-19 20:30:30 +01:00
|
|
|
*/
|
2016-12-10 16:32:52 +01:00
|
|
|
public function testIndexDepositTransfer()
|
2016-11-19 20:30:30 +01:00
|
|
|
{
|
2016-12-10 16:32:52 +01:00
|
|
|
$this->be($this->user());
|
|
|
|
$this->call('get', route('transactions.convert.index', ['transfer', 683]));
|
|
|
|
$this->assertResponseStatus(200);
|
|
|
|
$this->see('Convert a deposit into a transfer');
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-12-10 16:32:52 +01:00
|
|
|
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::index
|
2016-11-19 20:30:30 +01:00
|
|
|
*/
|
2016-12-10 16:32:52 +01:00
|
|
|
public function testIndexDepositWithdrawal()
|
2016-11-19 20:30:30 +01:00
|
|
|
{
|
2016-12-10 16:32:52 +01:00
|
|
|
$this->be($this->user());
|
|
|
|
$this->call('get', route('transactions.convert.index', ['withdrawal', 683]));
|
|
|
|
$this->assertResponseStatus(200);
|
|
|
|
$this->see('Convert a deposit into a withdrawal');
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|
2016-12-10 06:54:50 +01:00
|
|
|
|
|
|
|
/**
|
2016-12-10 16:32:52 +01:00
|
|
|
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::index
|
2016-12-10 06:54:50 +01:00
|
|
|
*/
|
2016-12-10 16:32:52 +01:00
|
|
|
public function testIndexTransferDeposit()
|
|
|
|
{
|
|
|
|
$this->be($this->user());
|
|
|
|
$this->call('get', route('transactions.convert.index', ['deposit', 684]));
|
|
|
|
$this->assertResponseStatus(200);
|
|
|
|
$this->see('Convert a transfer into a deposit');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::index
|
|
|
|
*/
|
|
|
|
public function testIndexTransferWithdrawal()
|
|
|
|
{
|
|
|
|
$this->be($this->user());
|
|
|
|
$this->call('get', route('transactions.convert.index', ['withdrawal', 684]));
|
|
|
|
$this->assertResponseStatus(200);
|
|
|
|
$this->see('Convert a transfer into a withdrawal');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::index
|
|
|
|
*/
|
|
|
|
public function testIndexWithdrawalDeposit()
|
|
|
|
{
|
|
|
|
$this->be($this->user());
|
|
|
|
$this->call('get', route('transactions.convert.index', ['deposit', 672]));
|
|
|
|
$this->assertResponseStatus(200);
|
|
|
|
$this->see('Convert a withdrawal into a deposit');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::index
|
|
|
|
*/
|
|
|
|
public function testIndexWithdrawalTransfer()
|
|
|
|
{
|
|
|
|
$this->be($this->user());
|
|
|
|
$this->call('get', route('transactions.convert.index', ['transfer', 672]));
|
|
|
|
$this->assertResponseStatus(200);
|
|
|
|
$this->see('Convert a withdrawal into a transfer');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::postIndex
|
|
|
|
*/
|
|
|
|
public function testPostIndex()
|
2016-12-10 06:54:50 +01:00
|
|
|
{
|
2016-12-10 17:46:19 +01:00
|
|
|
// convert a withdrawal to a transfer. Requires the ID of another asset account.
|
|
|
|
$data = [
|
|
|
|
'destination_account_asset' => 2,
|
|
|
|
];
|
2016-12-10 16:32:52 +01:00
|
|
|
$this->be($this->user());
|
2016-12-10 17:46:19 +01:00
|
|
|
$this->call('post', route('transactions.convert.index', ['transfer', 672]), $data);
|
2016-12-10 16:32:52 +01:00
|
|
|
$this->assertResponseStatus(302);
|
|
|
|
$this->assertRedirectedToRoute('transactions.show', [672]);
|
2016-12-10 06:54:50 +01:00
|
|
|
}
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|