Expand tests.

This commit is contained in:
James Cole 2016-12-10 16:32:52 +01:00
parent 0fe0de1a7f
commit bae2161ee3
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
8 changed files with 203 additions and 117 deletions

View File

@ -43,7 +43,7 @@ class TransactionType extends Model
if (!auth()->check()) {
throw new NotFoundHttpException;
}
$transactionType = self::where('type', $type)->first();
$transactionType = self::where('type', ucfirst($type))->first();
if (!is_null($transactionType)) {
return $transactionType;
}

View File

@ -11,6 +11,7 @@
namespace Popup;
use Carbon\Carbon;
use TestCase;
/**
@ -31,21 +32,118 @@ class ReportControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\Popup\ReportController::general
* Implement testGeneral().
*/
public function testGeneral()
public function testBalanceAmount()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$arguments = [
'attributes' => [
'location' => 'balance-amount',
'startDate' => Carbon::now()->startOfMonth()->format('Ymd'),
'endDate' => Carbon::now()->endOfMonth()->format('Ymd'),
'accounts' => 1,
'accountId' => 1,
'categoryId' => 1,
'budgetId' => 1,
'role' => 1,
],
];
$uri = route('popup.general') . '?' . http_build_query($arguments);
$this->call('get', $uri);
$this->assertResponseStatus(200);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
* @covers \FireflyIII\Http\Controllers\Popup\ReportController::general
*/
protected function tearDown()
public function testBudgetSpentAmount()
{
$this->be($this->user());
$arguments = [
'attributes' => [
'location' => 'budget-spent-amount',
'startDate' => Carbon::now()->startOfMonth()->format('Ymd'),
'endDate' => Carbon::now()->endOfMonth()->format('Ymd'),
'accounts' => 1,
'accountId' => 1,
'categoryId' => 1,
'budgetId' => 1,
],
];
$uri = route('popup.general') . '?' . http_build_query($arguments);
$this->call('get', $uri);
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\Popup\ReportController::general
*/
public function testCategoryEntry()
{
$this->be($this->user());
$arguments = [
'attributes' => [
'location' => 'category-entry',
'startDate' => Carbon::now()->startOfMonth()->format('Ymd'),
'endDate' => Carbon::now()->endOfMonth()->format('Ymd'),
'accounts' => 1,
'accountId' => 1,
'categoryId' => 1,
'budgetId' => 1,
],
];
$uri = route('popup.general') . '?' . http_build_query($arguments);
$this->call('get', $uri);
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\Popup\ReportController::general
*/
public function testExpenseEntry()
{
$this->be($this->user());
$arguments = [
'attributes' => [
'location' => 'expense-entry',
'startDate' => Carbon::now()->startOfMonth()->format('Ymd'),
'endDate' => Carbon::now()->endOfMonth()->format('Ymd'),
'accounts' => 1,
'accountId' => 1,
'categoryId' => 1,
'budgetId' => 1,
],
];
$uri = route('popup.general') . '?' . http_build_query($arguments);
$this->call('get', $uri);
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\Popup\ReportController::general
*/
public function testIncomeEntry()
{
$this->be($this->user());
$arguments = [
'attributes' => [
'location' => 'income-entry',
'startDate' => Carbon::now()->startOfMonth()->format('Ymd'),
'endDate' => Carbon::now()->endOfMonth()->format('Ymd'),
'accounts' => 1,
'accountId' => 1,
'categoryId' => 1,
'budgetId' => 1,
],
];
$uri = route('popup.general') . '?' . http_build_query($arguments);
$this->call('get', $uri);
$this->assertResponseStatus(200);
}
}

View File

@ -31,21 +31,12 @@ class AccountControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\Report\AccountController::general
* Implement testGeneral().
*/
public function testGeneral()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('report-data.account.general', ['1', '20120101', '20120131']));
$this->assertResponseStatus(200);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
}

View File

@ -31,21 +31,11 @@ class BalanceControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\Report\BalanceController::general
* Implement testGeneral().
*/
public function testGeneral()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
$this->be($this->user());
$this->call('get', route('report-data.balance.general', ['1', '20120101', '20120131']));
$this->assertResponseStatus(200);
}
}

View File

@ -31,33 +31,21 @@ class BudgetControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\Report\BudgetController::general
* Implement testGeneral().
*/
public function testGeneral()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('report-data.budget.general', ['1', '20120101', '20120131']));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\Report\BudgetController::period
* Implement testPeriod().
*/
public function testPeriod()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
$this->be($this->user());
$this->call('get', route('report-data.budget.period', ['1', '20120101', '20120131']));
$this->assertResponseStatus(200);
}
}

View File

@ -31,45 +31,31 @@ class CategoryControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\Report\CategoryController::expenses
* Implement testExpenses().
*/
public function testExpenses()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('report-data.category.expenses', ['1', '20120101', '20120131']));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\Report\CategoryController::income
* Implement testIncome().
*/
public function testIncome()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('report-data.category.income', ['1', '20120101', '20120131']));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\Report\CategoryController::operations
* Implement testOperations().
*/
public function testOperations()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
$this->be($this->user());
$this->call('get', route('report-data.category.operations', ['1', '20120101', '20120131']));
$this->assertResponseStatus(200);
}
}

View File

@ -31,45 +31,32 @@ class OperationsControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\Report\OperationsController::expenses
* Implement testExpenses().
*/
public function testExpenses()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('report-data.operations.expenses', ['1', '20120101', '20120131']));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\Report\OperationsController::income
* Implement testIncome().
*/
public function testIncome()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('report-data.operations.income', ['1', '20120101', '20120131']));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\Report\OperationsController::operations
* Implement testOperations().
*/
public function testOperations()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('report-data.operations.operations', ['1', '20120101', '20120131']));
$this->assertResponseStatus(200);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
}

View File

@ -31,33 +31,79 @@ class ConvertControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::index
* Implement testIndex().
*/
public function testIndex()
public function testIndexDepositTransfer()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('transactions.convert.index', ['transfer', 683]));
$this->assertResponseStatus(200);
$this->see('Convert a deposit into a transfer');
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::index
*/
public function testIndexDepositWithdrawal()
{
$this->be($this->user());
$this->call('get', route('transactions.convert.index', ['withdrawal', 683]));
$this->assertResponseStatus(200);
$this->see('Convert a deposit into a withdrawal');
}
/**
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::index
*/
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
* Implement testPostIndex().
*/
public function testPostIndex()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
//
$this->be($this->user());
$this->call('post', route('transactions.convert.index', ['transfer', 672]));
$this->assertResponseStatus(302);
$this->assertRedirectedToRoute('transactions.show', [672]);
}
}