mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 20:16:22 +00:00
Remove tests since they’ve been changed in Laravel 5.4.
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ExampleTest.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class ExampleTest
|
||||
*/
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic functional test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBasicExample()
|
||||
{
|
||||
$this->visit('/')
|
||||
->see('Firefly');
|
||||
}
|
||||
}
|
@@ -1,224 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* AccountControllerTest.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.
|
||||
*/
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Account\AccountTaskerInterface;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-11-20 at 07:15:07.
|
||||
*/
|
||||
class AccountControllerTest 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\AccountController::create
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('accounts.create', ['asset']));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\AccountController::delete
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('accounts.delete', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\AccountController::destroy
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
$this->session(['accounts.delete.url' => 'http://localhost/accounts/show/1']);
|
||||
|
||||
$repository = $this->mock(AccountRepositoryInterface::class);
|
||||
$repository->shouldReceive('find')->withArgs([0])->once()->andReturn(new Account);
|
||||
$repository->shouldReceive('destroy')->andReturn(true);
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('accounts.destroy', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\AccountController::edit
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('accounts.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\AccountController::index
|
||||
* @covers FireflyIII\Http\Controllers\AccountController::isInArray
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testIndex(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('accounts.index', ['asset']));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\AccountController::show
|
||||
* @covers FireflyIII\Http\Controllers\AccountController::periodEntries
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testShow(string $range)
|
||||
{
|
||||
$date = new Carbon;
|
||||
$this->session(['start' => $date, 'end' => clone $date]);
|
||||
|
||||
$tasker = $this->mock(AccountTaskerInterface::class);
|
||||
$tasker->shouldReceive('amountOutInPeriod')->withAnyArgs()->andReturn('-1');
|
||||
$tasker->shouldReceive('amountInInPeriod')->withAnyArgs()->andReturn('1');
|
||||
|
||||
// mock repository:
|
||||
$repository = $this->mock(AccountRepositoryInterface::class);
|
||||
$repository->shouldReceive('oldestJournalDate')->andReturn(clone $date);
|
||||
$repository->shouldReceive('getAccountsByType')->andReturn(new Collection);
|
||||
|
||||
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
$collector->shouldReceive('setAccounts')->andReturnSelf();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf();
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf();
|
||||
$collector->shouldReceive('setPage')->andReturnSelf();
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('accounts.show', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\AccountController::showAll
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testShowAll(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('accounts.show.all', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\AccountController::showByDate
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testShowByDate(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('accounts.show.date', [1, '2016-01-01']));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\AccountController::store
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
$this->session(['accounts.create.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
$data = [
|
||||
'name' => 'new account ' . rand(1000, 9999),
|
||||
'what' => 'asset',
|
||||
];
|
||||
|
||||
$this->call('post', route('accounts.store', ['asset']), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
|
||||
// list should have this new account.
|
||||
$this->call('GET', route('accounts.index', ['asset']));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
$this->see($data['name']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\AccountController::update
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
$this->session(['accounts.edit.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
$data = [
|
||||
'name' => 'updated account ' . rand(1000, 9999),
|
||||
'active' => 1,
|
||||
'what' => 'asset',
|
||||
];
|
||||
|
||||
$this->call('post', route('accounts.update', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
|
||||
// list should have this new account.
|
||||
$this->call('GET', route('accounts.index', ['asset']));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
$this->see($data['name']);
|
||||
}
|
||||
}
|
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ConfigurationControllerTest.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 Admin;
|
||||
|
||||
use FireflyIII\Models\Configuration;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-07 at 18:50:31.
|
||||
*/
|
||||
class ConfigurationControllerTest 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\Admin\ConfigurationController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
|
||||
$falseConfig = new Configuration;
|
||||
$falseConfig->data = false;
|
||||
|
||||
$trueConfig = new Configuration;
|
||||
$trueConfig->data = true;
|
||||
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['single_user_mode', true])->once()->andReturn($trueConfig);
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['is_demo_site', false])->times(2)->andReturn($falseConfig);
|
||||
|
||||
$this->call('GET', route('admin.configuration.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::postIndex
|
||||
*/
|
||||
public function testPostIndex()
|
||||
{
|
||||
$falseConfig = new Configuration;
|
||||
$falseConfig->data = false;
|
||||
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['is_demo_site', false])->once()->andReturn($falseConfig);
|
||||
FireflyConfig::shouldReceive('set')->withArgs(['single_user_mode', false])->once();
|
||||
FireflyConfig::shouldReceive('set')->withArgs(['is_demo_site', false])->once();
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('POST', route('admin.configuration.index.post'));
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
}
|
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* HomeControllerTest.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 Admin;
|
||||
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-07 at 18:50:31.
|
||||
*/
|
||||
class HomeControllerTest 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\Admin\HomeController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('admin.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
}
|
@@ -1,68 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* UserControllerTest.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 Admin;
|
||||
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-07 at 18:50:31.
|
||||
*/
|
||||
class UserControllerTest 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\Admin\UserController::edit
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('admin.users.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Admin\UserController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('admin.users'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Admin\UserController::show
|
||||
*/
|
||||
public function testShow()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('admin.users.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
}
|
@@ -1,121 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* AttachmentControllerTest.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.
|
||||
*/
|
||||
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:38.
|
||||
*/
|
||||
class AttachmentControllerTest 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\AttachmentController::delete
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('attachments.delete', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\AttachmentController::destroy
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
$this->session(['attachments.delete.url' => 'http://localhost']);
|
||||
|
||||
$repository = $this->mock(AttachmentRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy')->andReturn(true);
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('attachments.destroy', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\AttachmentController::download
|
||||
*/
|
||||
public function testDownload()
|
||||
{
|
||||
$repository = $this->mock(AttachmentRepositoryInterface::class);
|
||||
$repository->shouldReceive('exists')->once()->andReturn(true);
|
||||
$repository->shouldReceive('getContent')->once()->andReturn('This is attachment number one.');
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('attachments.download', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('This is attachment number one.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\AttachmentController::edit
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('attachments.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\AttachmentController::preview
|
||||
*/
|
||||
public function testPreview()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('attachments.preview', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\AttachmentController::update
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
$this->session(['attachments.edit.url' => 'http://localhost']);
|
||||
$data = [
|
||||
'title' => 'Some updated title ' . rand(1000, 9999),
|
||||
'notes' => '',
|
||||
'description' => '',
|
||||
];
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('attachments.update', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
|
||||
// view should be updated
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('attachments.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
$this->see($data['title']);
|
||||
}
|
||||
|
||||
}
|
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* LoginControllerTest.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 Auth;
|
||||
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-07 at 18:50:32.
|
||||
*/
|
||||
class LoginControllerTest 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\Auth\LoginController::login
|
||||
*/
|
||||
public function testLogin()
|
||||
{
|
||||
$this->visit('/login')
|
||||
->type('thegrumpydictator@gmail.com', 'email')
|
||||
->type('james', 'password')
|
||||
->press('Sign In')
|
||||
->seePageIs('/')
|
||||
->see('thegrumpydictator@gmail.com');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Auth\LoginController::logout
|
||||
*/
|
||||
public function testLogout()
|
||||
{
|
||||
$this->visit('/logout')
|
||||
->seePageIs('/login')
|
||||
->see('Sign in to start your session');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Auth\LoginController::showLoginForm
|
||||
*/
|
||||
public function testShowLoginForm()
|
||||
{
|
||||
$this->visit('/')
|
||||
->seePageIs('/login')
|
||||
->see('Sign in to start your session');
|
||||
}
|
||||
}
|
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* TwoFactorControllerTest.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 Auth;
|
||||
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-07 at 18:50:32.
|
||||
*/
|
||||
class TwoFactorControllerTest 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\Auth\TwoFactorController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
|
||||
$falsePreference = new Preference;
|
||||
$falsePreference->data = true;
|
||||
$secretPreference = new Preference;
|
||||
$secretPreference->data = 'BlablaSeecret';
|
||||
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($falsePreference);
|
||||
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference);
|
||||
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference);
|
||||
$this->call('get', route('two-factor.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Auth\TwoFactorController::lostTwoFactor
|
||||
*/
|
||||
public function testLostTwoFactor()
|
||||
{
|
||||
$this->be($this->user());
|
||||
|
||||
$truePreference = new Preference;
|
||||
$truePreference->data = true;
|
||||
$secretPreference = new Preference;
|
||||
$secretPreference->data = 'BlablaSeecret';
|
||||
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePreference);
|
||||
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference);
|
||||
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference);
|
||||
$this->call('get', route('two-factor.lost'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
}
|
@@ -1,179 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* BillControllerTest.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.
|
||||
*/
|
||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:40.
|
||||
*/
|
||||
class BillControllerTest 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\BillController::create
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('bills.create'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::delete
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('bills.delete', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::destroy
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy')->andReturn(true);
|
||||
|
||||
$this->session(['bills.delete.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('bills.destroy', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::edit
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('bills.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('bills.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::rescan
|
||||
*/
|
||||
public function testRescan()
|
||||
{
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
$repository->shouldReceive('getPossiblyRelatedJournals')->once()->andReturn(new Collection);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('bills.rescan', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::show
|
||||
*/
|
||||
public function testShow()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('bills.show', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::store
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
$data = [
|
||||
'name' => 'New Bill ' . rand(1000, 9999),
|
||||
'match' => 'some words',
|
||||
'amount_min' => '100',
|
||||
'amount_currency_id_amount_min' => 1,
|
||||
'amount_currency_id_amount_max' => 1,
|
||||
'skip' => 0,
|
||||
'amount_max' => '100',
|
||||
'date' => '2016-01-01',
|
||||
'repeat_freq' => 'monthly',
|
||||
];
|
||||
$this->session(['bills.create.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('bills.store'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
|
||||
// list must be updated
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('bills.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
$this->see($data['name']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::update
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
$data = [
|
||||
'name' => 'Updated Bill ' . rand(1000, 9999),
|
||||
'match' => 'some more words',
|
||||
'amount_min' => '100',
|
||||
'amount_currency_id_amount_min' => 1,
|
||||
'amount_currency_id_amount_max' => 1,
|
||||
'skip' => 0,
|
||||
'amount_max' => '100',
|
||||
'date' => '2016-01-01',
|
||||
'repeat_freq' => 'monthly',
|
||||
];
|
||||
$this->session(['bills.edit.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('bills.update', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
|
||||
// list must be updated
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('bills.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
$this->see($data['name']);
|
||||
}
|
||||
|
||||
}
|
@@ -1,283 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* BudgetControllerTest.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.
|
||||
*/
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:40.
|
||||
*/
|
||||
class BudgetControllerTest 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\BudgetController::amount
|
||||
*/
|
||||
public function testAmount()
|
||||
{
|
||||
$data = [
|
||||
'amount' => 200,
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('budgets.amount', [1]), $data);
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::create
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('budgets.create'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::delete
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('budgets.delete', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::destroy
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
$this->session(['budgets.delete.url' => 'http://localhost']);
|
||||
|
||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy')->andReturn(true);
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('budgets.destroy', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::edit
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('budgets.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::index
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testIndex(string $range)
|
||||
{
|
||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$repository->shouldReceive('cleanupBudgets');
|
||||
$repository->shouldReceive('getActiveBudgets')->andReturn(new Collection);
|
||||
$repository->shouldReceive('getInactiveBudgets')->andReturn(new Collection);
|
||||
$repository->shouldReceive('getAvailableBudget')->andReturn('100.123');
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('budgets.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::noBudget
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testNoBudget(string $range)
|
||||
{
|
||||
$date = new Carbon();
|
||||
$this->session(['start' => $date, 'end' => clone $date]);
|
||||
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf();
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf();
|
||||
$collector->shouldReceive('setPage')->andReturnSelf();
|
||||
$collector->shouldReceive('withoutBudget')->andReturnSelf();
|
||||
$collector->shouldReceive('withCategoryInformation')->andReturnSelf();
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('budgets.no-budget'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::postUpdateIncome
|
||||
*/
|
||||
public function testPostUpdateIncome()
|
||||
{
|
||||
$data = [
|
||||
'amount' => '200',
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('budgets.income.post'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::show
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testShow(string $range)
|
||||
{
|
||||
$date = new Carbon();
|
||||
$date->subDay();
|
||||
$this->session(['first' => $date]);
|
||||
|
||||
// mock account repository
|
||||
$accountRepository = $this->mock(AccountRepositoryInterface::class);
|
||||
$accountRepository->shouldReceive('getAccountsByType')->andReturn(new Collection);
|
||||
|
||||
|
||||
// mock budget repository
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$budgetRepository->shouldReceive('getBudgetLimits')->andReturn(new Collection);
|
||||
$budgetRepository->shouldReceive('spentInPeriod')->andReturn('1');
|
||||
// mock journal collector:
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf();
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf();
|
||||
$collector->shouldReceive('setPage')->andReturnSelf();
|
||||
$collector->shouldReceive('setBudget')->andReturnSelf();
|
||||
$collector->shouldReceive('withCategoryInformation')->andReturnSelf();
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('budgets.show', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::showByBudgetLimit()
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testShowByBudgetLimit(string $range)
|
||||
{
|
||||
// mock account repository
|
||||
$accountRepository = $this->mock(AccountRepositoryInterface::class);
|
||||
$accountRepository->shouldReceive('getAccountsByType')->andReturn(new Collection);
|
||||
|
||||
// mock budget repository
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$budgetRepository->shouldReceive('spentInPeriod')->andReturn('1');
|
||||
$budgetRepository->shouldReceive('getBudgetLimits')->andReturn(new Collection);
|
||||
|
||||
// mock journal collector:
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf();
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf();
|
||||
$collector->shouldReceive('setPage')->andReturnSelf();
|
||||
$collector->shouldReceive('setBudget')->andReturnSelf();
|
||||
$collector->shouldReceive('withCategoryInformation')->andReturnSelf();
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('budgets.show.limit', [1, 1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::store
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
$this->session(['budgets.create.url' => 'http://localhost']);
|
||||
|
||||
$data = [
|
||||
'name' => 'New Budget ' . rand(1000, 9999),
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('budgets.store'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::update
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
$this->session(['budgets.edit.url' => 'http://localhost']);
|
||||
|
||||
$data = [
|
||||
'name' => 'Updated Budget ' . rand(1000, 9999),
|
||||
'active' => 1,
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('budgets.update', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::updateIncome
|
||||
*/
|
||||
public function testUpdateIncome()
|
||||
{
|
||||
// must be in list
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('budgets.income', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
}
|
@@ -1,257 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CategoryControllerTest.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.
|
||||
*/
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:40.
|
||||
*/
|
||||
class CategoryControllerTest 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\CategoryController::create
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('categories.create'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::delete
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('categories.delete', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::destroy
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
$this->session(['categories.delete.url' => 'http://localhost']);
|
||||
$repository = $this->mock(CategoryRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy')->andReturn(true);
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('categories.destroy', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::edit
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('categories.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('categories.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::noCategory
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testNoCategory(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('categories.no-category'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::show
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testShow(string $range)
|
||||
{
|
||||
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
$accRepository = $this->mock(AccountRepositoryInterface::class);
|
||||
$catRepository = $this->mock(CategoryRepositoryInterface::class);
|
||||
|
||||
$accRepository->shouldReceive('getAccountsByType')->once()->andReturn(new Collection);
|
||||
$catRepository->shouldReceive('firstUseDate')->once()->andReturn(new Carbon);
|
||||
|
||||
// collector stuff:
|
||||
$collector->shouldReceive('setPage')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('withBudgetInformation')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setCategory')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->once();
|
||||
|
||||
// more repos stuff:
|
||||
$catRepository->shouldReceive('spentInPeriod')->andReturn('0');
|
||||
$catRepository->shouldReceive('earnedInPeriod')->andReturn('0');
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('categories.show', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::showAll
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testShowAll(string $range)
|
||||
{
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
|
||||
// collector stuff:
|
||||
$collector->shouldReceive('setPage')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('withBudgetInformation')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setCategory')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->once();
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('categories.show.all', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::showByDate
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testShowByDate(string $range)
|
||||
{
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
|
||||
// collector stuff:
|
||||
$collector->shouldReceive('setPage')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('withBudgetInformation')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setCategory')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->once();
|
||||
|
||||
// mock category repository
|
||||
$repository = $this->mock(CategoryRepositoryInterface::class);
|
||||
$repository->shouldReceive('firstUseDate')->once()->andReturn(new Carbon);
|
||||
$repository->shouldReceive('spentInPeriod')->andReturn('-1');
|
||||
$repository->shouldReceive('earnedInPeriod')->andReturn('1');
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('categories.show.date', [1, '2015-01-01']));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::store
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
$this->session(['categories.create.url' => 'http://localhost']);
|
||||
|
||||
$data = [
|
||||
'name' => 'New Category ' . rand(1000, 9999),
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('categories.store'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
|
||||
// must be in list
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('categories.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
$this->see($data['name']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::update
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
$this->session(['categories.edit.url' => 'http://localhost']);
|
||||
|
||||
$data = [
|
||||
'name' => 'Updated Category ' . rand(1000, 9999),
|
||||
'active' => 1,
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('categories.update', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
|
||||
// must be in list
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('categories.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
$this->see($data['name']);
|
||||
}
|
||||
|
||||
}
|
@@ -1,154 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* AccountControllerTest.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 Chart;
|
||||
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-07 at 18:50:33.
|
||||
*/
|
||||
class AccountControllerTest 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\Chart\AccountController::expenseAccounts
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testExpenseAccounts(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.account.expense'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::expenseBudget
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testExpenseBudget(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.account.expense-budget', [1, '20120101', '20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::expenseCategory
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testExpenseCategory(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.account.expense-category', [1, '20120101', '20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::frontpage
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testFrontpage(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.account.frontpage'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::incomeCategory
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testIncomeCategory(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.account.income-category', [1, '20120101', '20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::period
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testPeriod(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.account.period', [1, '2012-01-01']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::report
|
||||
*/
|
||||
public function testReport()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('chart.account.report', ['1', '20120101', '20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::revenueAccounts
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testRevenueAccounts(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.account.revenue'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::single
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testSingle(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.account.single', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
}
|
@@ -1,56 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* BillControllerTest.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 Chart;
|
||||
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:40.
|
||||
*/
|
||||
class BillControllerTest 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\Chart\BillController::frontpage
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testFrontpage(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.bill.frontpage'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\BillController::single
|
||||
*/
|
||||
public function testSingle()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('chart.bill.single', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
}
|
@@ -1,103 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* BudgetControllerTest.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 Chart;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:40.
|
||||
*/
|
||||
class BudgetControllerTest 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\Chart\BudgetController::budget
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testBudget(string $range)
|
||||
{
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$budgetRepository->shouldReceive('firstUseDate')->andReturn(new Carbon('2015-01-01'));
|
||||
$budgetRepository->shouldReceive('spentInPeriod')->andReturn('-100');
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.budget.budget', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::budgetLimit
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testBudgetLimit(string $range)
|
||||
{
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$budgetRepository->shouldReceive('spentInPeriod')->andReturn('-100');
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.budget.budget-limit', [1,1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::frontpage
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testFrontpage(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.budget.frontpage'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::period
|
||||
*/
|
||||
public function testPeriod()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('chart.budget.period', [1,'1','20120101','20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::periodNoBudget
|
||||
*/
|
||||
public function testPeriodNoBudget()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('chart.budget.period.no-budget', ['1','20120101','20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
}
|
@@ -1,148 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CategoryControllerTest.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 Chart;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:40.
|
||||
*/
|
||||
class CategoryControllerTest 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\Chart\CategoryController::all
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testAll(string $range)
|
||||
{
|
||||
$catRepository = $this->mock(CategoryRepositoryInterface::class);
|
||||
|
||||
$catRepository->shouldReceive('spentInPeriod')->andReturn('0');
|
||||
$catRepository->shouldReceive('earnedInPeriod')->andReturn('0');
|
||||
$catRepository->shouldReceive('firstUseDate')->andReturn(new Carbon);
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.category.all', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::currentPeriod
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::makePeriodChart
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testCurrentPeriod(string $range)
|
||||
{
|
||||
// this is actually for makePeriodChart
|
||||
$accountRepository = $this->mock(AccountRepositoryInterface::class);
|
||||
$categoryRepository = $this->mock(CategoryRepositoryInterface::class);
|
||||
$account = $this->user()->accounts()->where('account_type_id', 5)->first();
|
||||
$accountRepository->shouldReceive('getAccountsByType')->andReturn(new Collection([$account]));
|
||||
$categoryRepository->shouldReceive('spentInPeriod')->andReturn('0');
|
||||
$categoryRepository->shouldReceive('earnedInPeriod')->andReturn('0');
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.category.current', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::frontpage
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testFrontpage(string $range)
|
||||
{
|
||||
$accountRepository = $this->mock(AccountRepositoryInterface::class);
|
||||
$categoryRepository = $this->mock(CategoryRepositoryInterface::class);
|
||||
$category = $this->user()->categories()->first();
|
||||
$account = $this->user()->accounts()->where('account_type_id', 5)->first();
|
||||
// get one category
|
||||
$categoryRepository->shouldReceive('getCategories')->andReturn(new Collection([$category]));
|
||||
// get one account
|
||||
$accountRepository->shouldReceive('getAccountsByType')->andReturn(new Collection([$account]));
|
||||
// always return zero
|
||||
$categoryRepository->shouldReceive('spentInPeriod')->andReturn('0');
|
||||
$categoryRepository->shouldReceive('spentInPeriodWithoutCategory')->andReturn('0');
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.category.frontpage', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::reportPeriod
|
||||
*/
|
||||
public function testReportPeriod()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('chart.category.period', [1, '1', '20120101', '20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::reportPeriodNoCategory
|
||||
*/
|
||||
public function testReportPeriodNoCategory()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('chart.category.period.no-category', ['1', '20120101', '20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::specificPeriod
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::makePeriodChart
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testSpecificPeriod(string $range)
|
||||
{
|
||||
$accountRepository = $this->mock(AccountRepositoryInterface::class);
|
||||
$categoryRepository = $this->mock(CategoryRepositoryInterface::class);
|
||||
$account = $this->user()->accounts()->where('account_type_id', 5)->first();
|
||||
$accountRepository->shouldReceive('getAccountsByType')->andReturn(new Collection([$account]));
|
||||
$categoryRepository->shouldReceive('spentInPeriod')->andReturn('0');
|
||||
$categoryRepository->shouldReceive('earnedInPeriod')->andReturn('0');
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('get', route('chart.category.specific', ['1', '2012-01-01']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
}
|
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CategoryReportControllerTest.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 Chart;
|
||||
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:40.
|
||||
*/
|
||||
class CategoryReportControllerTest 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\Chart\CategoryReportController::accountExpense
|
||||
*/
|
||||
public function testAccountExpense()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('chart.category.account-expense', ['1', '1', '20120101', '20120131', 0]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::accountIncome
|
||||
*/
|
||||
public function testAccountIncome()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('chart.category.account-income', ['1', '1', '20120101', '20120131', 0]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::categoryExpense
|
||||
*/
|
||||
public function testCategoryExpense()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('chart.category.category-expense', ['1', '1', '20120101', '20120131', 0]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::categoryIncome
|
||||
*/
|
||||
public function testCategoryIncome()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('chart.category.category-income', ['1', '1', '20120101', '20120131', 0]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::mainChart
|
||||
*/
|
||||
public function testMainChart()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('chart.category.main', ['1', '1', '20120101', '20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
}
|
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* PiggyBankControllerTest.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 Chart;
|
||||
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:41.
|
||||
*/
|
||||
class PiggyBankControllerTest 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\Chart\PiggyBankController::history
|
||||
*/
|
||||
public function testHistory()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('chart.piggy-bank.history', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
}
|
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ReportControllerTest.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 Chart;
|
||||
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:41.
|
||||
*/
|
||||
class ReportControllerTest 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\Chart\ReportController::netWorth
|
||||
*/
|
||||
public function testNetWorth()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('chart.report.net-worth', [1, '20120101', '20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\ReportController::operations
|
||||
*/
|
||||
public function testOperations()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('chart.report.operations', [1, '20120101', '20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Chart\ReportController::sum
|
||||
*/
|
||||
public function testSum()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('chart.report.sum', [1, '20120101', '20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
}
|
@@ -1,140 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CurrencyControllerTest.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.
|
||||
*/
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:41.
|
||||
*/
|
||||
class CurrencyControllerTest 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\CurrencyController::create
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('currencies.create'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::defaultCurrency
|
||||
*/
|
||||
public function testDefaultCurrency()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('currencies.default', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::delete
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('currencies.delete', [2]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::destroy
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
$this->session(['currencies.delete.url' => 'http://localhost']);
|
||||
$repository = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$repository->shouldReceive('canDeleteCurrency')->andReturn(true);
|
||||
$repository->shouldReceive('destroy')->andReturn(true);
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('currencies.destroy', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::edit
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('currencies.edit', [2]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('currencies.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::store
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
$this->session(['currencies.create.url' => 'http://localhost']);
|
||||
$data = [
|
||||
'name' => 'XX',
|
||||
'code' => 'XXX',
|
||||
'symbol' => 'x',
|
||||
'decimal_places' => 2,
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('currencies.store'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CurrencyController::update
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
$this->session(['currencies.edit.url' => 'http://localhost']);
|
||||
$data = [
|
||||
'name' => 'XA',
|
||||
'code' => 'XAX',
|
||||
'symbol' => 'a',
|
||||
'decimal_places' => 2,
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('currencies.update', [2]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
}
|
@@ -1,111 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ExportControllerTest.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.
|
||||
*/
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Export\Processor;
|
||||
use FireflyIII\Export\ProcessorInterface;
|
||||
use FireflyIII\Models\ExportJob;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:41.
|
||||
*/
|
||||
class ExportControllerTest 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\ExportController::download
|
||||
*/
|
||||
public function testDownload()
|
||||
{
|
||||
$repository = $this->mock(ExportJobRepositoryInterface::class);
|
||||
$repository->shouldReceive('exists')->once()->andReturn(true);
|
||||
$repository->shouldReceive('getContent')->once()->andReturn('Some content beep boop');
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('export.download', ['testExport']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ExportController::getStatus
|
||||
*/
|
||||
public function testGetStatus()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('export.status', ['testExport']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ExportController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('export.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ExportController::postIndex
|
||||
*/
|
||||
public function testPostIndex()
|
||||
{
|
||||
$this->session(
|
||||
['first' => new Carbon('2014-01-01')]
|
||||
);
|
||||
|
||||
|
||||
$data = [
|
||||
|
||||
'export_start_range' => '2015-01-01',
|
||||
'export_end_range' => '2015-01-21',
|
||||
'exportFormat' => 'csv',
|
||||
'accounts' => [1],
|
||||
'job' => 'testExport',
|
||||
];
|
||||
|
||||
$accountRepository = $this->mock(AccountRepositoryInterface::class);
|
||||
$accountRepository->shouldReceive('getAccountsById')->withArgs([$data['accounts']])->andReturn(new Collection);
|
||||
|
||||
$processor = $this->mock(ProcessorInterface::class);
|
||||
$processor->shouldReceive('collectJournals')->once();
|
||||
$processor->shouldReceive('convertJournals')->once();
|
||||
$processor->shouldReceive('exportJournals')->once();
|
||||
$processor->shouldReceive('createZipFile')->once();
|
||||
|
||||
$repository = $this->mock(ExportJobRepositoryInterface::class);
|
||||
$repository->shouldReceive('changeStatus')->andReturn(true);
|
||||
$repository->shouldReceive('findByKey')->andReturn(new ExportJob);
|
||||
|
||||
$this->be($this->user());
|
||||
|
||||
$this->call('post', route('export.export'), $data);
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('ok');
|
||||
}
|
||||
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* HelpControllerTest.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.
|
||||
*/
|
||||
use FireflyIII\Helpers\Help\HelpInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:41.
|
||||
*/
|
||||
class HelpControllerTest 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\HelpController::show
|
||||
*/
|
||||
public function testShow()
|
||||
{
|
||||
$help = $this->mock(HelpInterface::class);
|
||||
$help->shouldReceive('hasRoute')->andReturn(true)->once();
|
||||
$help->shouldReceive('inCache')->andReturn(false)->once();
|
||||
$help->shouldReceive('getFromGithub')->andReturn('Help content here.')->once();
|
||||
$help->shouldReceive('putInCache')->once();
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('help.show', ['index']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
}
|
@@ -1,96 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* HomeControllerTest.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.
|
||||
*/
|
||||
class HomeControllerTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\HomeController::dateRange
|
||||
* @covers FireflyIII\Http\Controllers\HomeController::__construct
|
||||
*/
|
||||
public function testDateRange()
|
||||
{
|
||||
|
||||
$this->be($this->user());
|
||||
|
||||
$args = [
|
||||
'start' => '2012-01-01',
|
||||
'end' => '2012-04-01',
|
||||
];
|
||||
|
||||
$this->call('POST', route('daterange'), $args);
|
||||
$this->assertResponseStatus(200);
|
||||
$this->assertSessionHas('warning', '91 days of data may take a while to load.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\HomeController::displayError
|
||||
*/
|
||||
public function testDisplayError()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('error'));
|
||||
$this->assertResponseStatus(500);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\HomeController::flush
|
||||
*/
|
||||
public function testFlush()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('flush'));
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\HomeController::index
|
||||
* @covers FireflyIII\Http\Controllers\Controller::__construct
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param $range
|
||||
*/
|
||||
public function testIndex(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('index'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\HomeController::routes
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testRoutes(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('all-routes'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\HomeController::testFlash
|
||||
*/
|
||||
public function testTestFlash()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('test-flash'));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertSessionHas('info');
|
||||
$this->assertSessionHas('warning');
|
||||
$this->assertSessionHas('error');
|
||||
}
|
||||
}
|
@@ -1,177 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ImportControllerTest.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.
|
||||
*/
|
||||
use FireflyIII\Import\Setup\CsvSetup;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use FireflyIII\Import\ImportProcedureInterface;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:41.
|
||||
*/
|
||||
class ImportControllerTest 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\ImportController::complete
|
||||
*/
|
||||
public function testComplete()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('import.complete', ['complete']));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::configure
|
||||
*/
|
||||
public function testConfigure()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('import.configure', ['configure']));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::download
|
||||
*/
|
||||
public function testDownload()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('import.download', ['configure']));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('[]');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::finished
|
||||
*/
|
||||
public function testFinished()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('import.finished', ['finished']));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('import.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::json
|
||||
*/
|
||||
public function testJson()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('import.json', ['configure']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::postConfigure
|
||||
*/
|
||||
public function testPostConfigure()
|
||||
{
|
||||
$importer = $this->mock(CsvSetup::class);
|
||||
$importer->shouldReceive('setJob')->once();
|
||||
$importer->shouldReceive('saveImportConfiguration')->once();
|
||||
|
||||
$data = [];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('import.process-configuration', ['p-configure']), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertRedirectedToRoute('import.settings', ['p-configure']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::postSettings
|
||||
*/
|
||||
public function testPostSettings()
|
||||
{
|
||||
$importer = $this->mock(CsvSetup::class);
|
||||
$importer->shouldReceive('setJob')->once();
|
||||
$importer->shouldReceive('storeSettings')->once();
|
||||
$data = [];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('import.post-settings', ['p-settings']), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertRedirectedToRoute('import.settings', ['p-settings']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::settings
|
||||
*/
|
||||
public function testSettings()
|
||||
{
|
||||
$importer = $this->mock(CsvSetup::class);
|
||||
$importer->shouldReceive('setJob')->once();
|
||||
$importer->shouldReceive('requireUserSettings')->once()->andReturn(false);
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('import.settings', ['settings']));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertRedirectedToRoute('import.complete', ['settings']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::start
|
||||
*/
|
||||
public function testStart()
|
||||
{
|
||||
/** @var ImportProcedureInterface $procedure */
|
||||
$procedure = $this->mock(ImportProcedureInterface::class);
|
||||
|
||||
$procedure->shouldReceive('runImport');
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('import.start', ['complete']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::status
|
||||
* Implement testStatus().
|
||||
*/
|
||||
public function testStatus()
|
||||
{
|
||||
// complete
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('import.status', ['complete']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ImportController::upload
|
||||
*/
|
||||
public function testUpload()
|
||||
{
|
||||
$path = resource_path('stubs/csv.csv');
|
||||
$file = new UploadedFile($path, 'upload.csv', filesize($path), 'text/csv', null, true);
|
||||
$this->call('POST', route('import.upload'), [], [], ['import_file' => $file], ['Accept' => 'application/json']);
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
}
|
@@ -1,158 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* JsonControllerTest.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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:42.
|
||||
*/
|
||||
class JsonControllerTest 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\JsonController::action
|
||||
*/
|
||||
public function testAction()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('json.action'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::boxBillsPaid
|
||||
*/
|
||||
public function testBoxBillsPaid()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('json.box.paid'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::boxBillsUnpaid
|
||||
*/
|
||||
public function testBoxBillsUnpaid()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('json.box.unpaid'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::boxIn
|
||||
*/
|
||||
public function testBoxIn()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('json.box.in'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::boxOut
|
||||
*/
|
||||
public function testBoxOut()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('json.box.out'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::categories
|
||||
*/
|
||||
public function testCategories()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('json.categories'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::endTour
|
||||
*/
|
||||
public function testEndTour()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('json.end-tour'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::expenseAccounts
|
||||
*/
|
||||
public function testExpenseAccounts()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('json.expense-accounts'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::revenueAccounts
|
||||
*/
|
||||
public function testRevenueAccounts()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('json.revenue-accounts'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::tags
|
||||
*/
|
||||
public function testTags()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('json.tags'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::tour
|
||||
*/
|
||||
public function testTour()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('json.tour'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::transactionJournals
|
||||
*/
|
||||
public function testTransactionJournals()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('json.transaction-journals', ['deposit']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\JsonController::trigger
|
||||
*/
|
||||
public function testTrigger()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('json.trigger'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
}
|
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NewUserControllerTest.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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:42.
|
||||
*/
|
||||
class NewUserControllerTest 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\NewUserController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->emptyUser());
|
||||
$this->call('get', route('new-user.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\NewUserController::submit
|
||||
*/
|
||||
public function testSubmit()
|
||||
{
|
||||
$data = [
|
||||
'bank_name' => 'New bank',
|
||||
'bank_balance' => 100,
|
||||
];
|
||||
$this->be($this->emptyUser());
|
||||
$this->call('post', route('new-user.submit'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
}
|
@@ -1,241 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* PiggyBankControllerTest.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.
|
||||
*/
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:42.
|
||||
*/
|
||||
class PiggyBankControllerTest 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\PiggyBankController::add
|
||||
*/
|
||||
public function testAdd()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.add', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::addMobile
|
||||
*/
|
||||
public function testAddMobile()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.add-money-mobile', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::create
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.create'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::delete
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.delete', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::destroy
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
$repository = $this->mock(PiggyBankRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy')->andReturn(true);
|
||||
|
||||
$this->session(['piggy-banks.delete.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('piggy-banks.destroy', [2]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertRedirectedToRoute('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::edit
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::order
|
||||
*/
|
||||
public function testOrder()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('piggy-banks.order', [1, 2]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::postAdd
|
||||
*/
|
||||
public function testPostAdd()
|
||||
{
|
||||
$data = ['amount' => '1.123'];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('piggy-banks.add', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertRedirectedToRoute('piggy-banks.index');
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the exact amount to fill a piggy bank
|
||||
*
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::postAdd
|
||||
*/
|
||||
public function testPostAddExact()
|
||||
{
|
||||
// find a piggy with current amount = 0.
|
||||
$piggy = PiggyBank::leftJoin('piggy_bank_repetitions', 'piggy_bank_repetitions.piggy_bank_id', '=', 'piggy_banks.id')
|
||||
->where('currentamount', 0)
|
||||
->first(['piggy_banks.id', 'targetamount']);
|
||||
|
||||
|
||||
$data = ['amount' => strval($piggy->targetamount)];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('piggy-banks.add', [$piggy->id]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertRedirectedToRoute('piggy-banks.index');
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::postRemove
|
||||
*/
|
||||
public function testPostRemove()
|
||||
{
|
||||
$data = ['amount' => '1.123'];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('piggy-banks.remove', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertRedirectedToRoute('piggy-banks.index');
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::remove
|
||||
*/
|
||||
public function testRemove()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.remove', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::removeMobile
|
||||
*/
|
||||
public function testRemoveMobile()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.remove-money-mobile', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::show
|
||||
*/
|
||||
public function testShow()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('piggy-banks.show', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::store
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
$this->session(['piggy-banks.create.url' => 'http://localhost']);
|
||||
$data = [
|
||||
'name' => 'Piggy ' . rand(999, 10000),
|
||||
'targetamount' => '100.123',
|
||||
'account_id' => 2,
|
||||
'amount_currency_id_targetamount' => 1,
|
||||
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('piggy-banks.store'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertRedirectedToRoute('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PiggyBankController::update
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
$this->session(['piggy-banks.edit.url' => 'http://localhost']);
|
||||
$data = [
|
||||
'name' => 'Updated Piggy ' . rand(999, 10000),
|
||||
'targetamount' => '100.123',
|
||||
'account_id' => 2,
|
||||
'amount_currency_id_targetamount' => 1,
|
||||
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('piggy-banks.update', [3]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertRedirectedToRoute('index');
|
||||
}
|
||||
|
||||
}
|
@@ -1,149 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ReportControllerTest.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 Popup;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:42.
|
||||
*/
|
||||
class ReportControllerTest 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\Popup\ReportController::general
|
||||
*/
|
||||
public function testBalanceAmount()
|
||||
{
|
||||
|
||||
$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' => 3, // diff role, is complicated.
|
||||
],
|
||||
];
|
||||
$uri = route('popup.general') . '?' . http_build_query($arguments);
|
||||
$this->call('get', $uri);
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Popup\ReportController::general
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@@ -1,87 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* PreferencesControllerTest.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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:42.
|
||||
*/
|
||||
class PreferencesControllerTest 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\PreferencesController::code
|
||||
*/
|
||||
public function testCode()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('preferences.code'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PreferencesController::deleteCode
|
||||
*/
|
||||
public function testDeleteCode()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('preferences.delete-code'));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertSessionHas('info');
|
||||
$this->assertRedirectedToRoute('preferences.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PreferencesController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('preferences.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PreferencesController::postIndex
|
||||
*/
|
||||
public function testPostIndex()
|
||||
{
|
||||
$data = [
|
||||
'fiscalYearStart' => '2016-01-01',
|
||||
'frontPageAccounts' => [],
|
||||
'viewRange' => '1M',
|
||||
'customFiscalYear' => 0,
|
||||
'showDepositsFrontpage' => 0,
|
||||
'transactionPageSize' => 100,
|
||||
'twoFactorAuthEnabled' => 0,
|
||||
'language' => 'en_US',
|
||||
'tj' => [],
|
||||
];
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('preferences.update'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertRedirectedToRoute('preferences.index');
|
||||
}
|
||||
}
|
@@ -1,97 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ProfileControllerTest.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.
|
||||
*/
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:42.
|
||||
*/
|
||||
class ProfileControllerTest 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\ProfileController::changePassword
|
||||
*/
|
||||
public function testChangePassword()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('profile.change-password'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ProfileController::deleteAccount
|
||||
*/
|
||||
public function testDeleteAccount()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('profile.delete-account'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ProfileController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('profile.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ProfileController::postChangePassword
|
||||
*/
|
||||
public function testPostChangePassword()
|
||||
{
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('changePassword');
|
||||
|
||||
$data = [
|
||||
'current_password' => 'james',
|
||||
'new_password' => 'james2',
|
||||
'new_password_confirmation' => 'james2',
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('profile.change-password.post'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ProfileController::postDeleteAccount
|
||||
*/
|
||||
public function testPostDeleteAccount()
|
||||
{
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy');
|
||||
$data = [
|
||||
'password' => 'james',
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('profile.delete-account.post'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertRedirectedToRoute('index');
|
||||
}
|
||||
}
|
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* AccountControllerTest.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 Report;
|
||||
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:42.
|
||||
*/
|
||||
class AccountControllerTest 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\Report\AccountController::general
|
||||
*/
|
||||
public function testGeneral()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('report-data.account.general', ['1', '20120101', '20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
}
|
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* BalanceControllerTest.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 Report;
|
||||
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:42.
|
||||
*/
|
||||
class BalanceControllerTest 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\Report\BalanceController::general
|
||||
*/
|
||||
public function testGeneral()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('report-data.balance.general', ['1', '20120101', '20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* BudgetControllerTest.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 Report;
|
||||
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:43.
|
||||
*/
|
||||
class BudgetControllerTest 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\Report\BudgetController::general
|
||||
*/
|
||||
public function testGeneral()
|
||||
{
|
||||
$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
|
||||
*/
|
||||
public function testPeriod()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('report-data.budget.period', ['1', '20120101', '20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
}
|
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CategoryControllerTest.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 Report;
|
||||
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:43.
|
||||
*/
|
||||
class CategoryControllerTest 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\Report\CategoryController::expenses
|
||||
*/
|
||||
public function testExpenses()
|
||||
{
|
||||
$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
|
||||
*/
|
||||
public function testIncome()
|
||||
{
|
||||
$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
|
||||
*/
|
||||
public function testOperations()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('report-data.category.operations', ['1', '20120101', '20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
}
|
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* OperationsControllerTest.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 Report;
|
||||
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:43.
|
||||
*/
|
||||
class OperationsControllerTest 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\Report\OperationsController::expenses
|
||||
*/
|
||||
public function testExpenses()
|
||||
{
|
||||
$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
|
||||
*/
|
||||
public function testIncome()
|
||||
{
|
||||
$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
|
||||
*/
|
||||
public function testOperations()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('report-data.operations.operations', ['1', '20120101', '20120131']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
}
|
@@ -1,105 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ReportControllerTest.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.
|
||||
*/
|
||||
use FireflyIII\Generator\Report\Audit\MonthReportGenerator as AuditGenerator;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:43.
|
||||
*/
|
||||
class ReportControllerTest 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\ReportController::auditReport
|
||||
*/
|
||||
public function testAuditReport()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('reports.report.audit', [1, '20160101', '20160131']));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ReportController::budgetReport
|
||||
*/
|
||||
public function testBudgetReport()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('reports.report.budget', [1, 1, '20160101', '20160131']));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ReportController::categoryReport
|
||||
*/
|
||||
public function testCategoryReport()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('reports.report.category', [1, 1, '20160101', '20160131']));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ReportController::defaultReport
|
||||
*/
|
||||
public function testDefaultReport()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('reports.report.default', [1, '20160101', '20160131']));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ReportController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('reports.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ReportController::options
|
||||
*/
|
||||
public function testOptions()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('reports.options', ['default']));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\ReportController::postIndex
|
||||
*/
|
||||
public function testPostIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('reports.index.post'));
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
}
|
@@ -1,228 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* RuleControllerTest.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.
|
||||
*/
|
||||
use FireflyIII\Models\Rule;
|
||||
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:43.
|
||||
*/
|
||||
class RuleControllerTest 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\RuleController::create
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('rules.create', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::delete
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('rules.delete', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::destroy
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy');
|
||||
|
||||
$this->session(['rules.delete.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('rules.destroy', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertRedirectedToRoute('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::down
|
||||
*/
|
||||
public function testDown()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('rules.down', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertRedirectedToRoute('rules.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::edit
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('rules.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('rules.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::reorderRuleActions
|
||||
*/
|
||||
public function testReorderRuleActions()
|
||||
{
|
||||
$data = [
|
||||
'triggers' => [1, 2, 3],
|
||||
];
|
||||
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$repository->shouldReceive('reorderRuleActions');
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('rules.reorder-actions', [1]), $data);
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::reorderRuleTriggers
|
||||
*/
|
||||
public function testReorderRuleTriggers()
|
||||
{
|
||||
$data = [
|
||||
'triggers' => [1, 2, 3],
|
||||
];
|
||||
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$repository->shouldReceive('reorderRuleTriggers');
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('rules.reorder-triggers', [1]), $data);
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::store
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
$this->session(['rules.create.url' => 'http://localhost']);
|
||||
$data = [
|
||||
'rule_group_id' => 1,
|
||||
'active' => 1,
|
||||
'title' => 'A',
|
||||
'trigger' => 'store-journal',
|
||||
'description' => 'D',
|
||||
'rule-trigger' => [
|
||||
1 => 'from_account_starts',
|
||||
],
|
||||
'rule-trigger-value' => [
|
||||
1 => 'B',
|
||||
],
|
||||
'rule-action' => [
|
||||
1 => 'set_category',
|
||||
],
|
||||
'rule-action-value' => [
|
||||
1 => 'C',
|
||||
],
|
||||
];
|
||||
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$repository->shouldReceive('store')->andReturn(new Rule);
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('rules.store', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* This actually hits an error and not the actually code but OK.
|
||||
*
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::testTriggers
|
||||
*/
|
||||
public function testTestTriggers()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('rules.test-triggers', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::up
|
||||
*/
|
||||
public function testUp()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('rules.up', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertRedirectedToRoute('rules.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleController::update
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
$data = [
|
||||
'rule_group_id' => 1,
|
||||
'title' => 'Your first default rule',
|
||||
'trigger' => 'store-journal',
|
||||
'active' => 1,
|
||||
'description' => 'This rule is an example. You can safely delete it.',
|
||||
'rule-trigger' => [
|
||||
1 => 'description_is',
|
||||
],
|
||||
'rule-trigger-value' => [
|
||||
1 => 'something',
|
||||
],
|
||||
'rule-action' => [
|
||||
1 => 'prepend_description',
|
||||
],
|
||||
'rule-action-value' => [
|
||||
1 => 'Bla bla',
|
||||
],
|
||||
];
|
||||
$this->session(['rules.edit.url' => 'http://localhost']);
|
||||
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$repository->shouldReceive('update');
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('rules.update', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
}
|
@@ -1,173 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* RuleGroupControllerTest.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.
|
||||
*/
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\RuleGroup;
|
||||
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:43.
|
||||
*/
|
||||
class RuleGroupControllerTest 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\RuleGroupController::create
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('rule-groups.create'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleGroupController::delete
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('rule-groups.delete', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleGroupController::destroy
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
$repository = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy');
|
||||
|
||||
$this->session(['rule-groups.delete.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('rule-groups.destroy', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertRedirectedToRoute('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleGroupController::down
|
||||
*/
|
||||
public function testDown()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('rule-groups.down', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertRedirectedToRoute('rules.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleGroupController::edit
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('rule-groups.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleGroupController::execute
|
||||
*/
|
||||
public function testExecute()
|
||||
{
|
||||
$this->session(['first' => new Carbon('2010-01-01')]);
|
||||
$data = [
|
||||
'accounts' => [1],
|
||||
'start_date' => '2010-01-02',
|
||||
'end_date' => '2010-01-02',
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('rule-groups.execute', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertRedirectedToRoute('rules.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleGroupController::selectTransactions
|
||||
*/
|
||||
public function testSelectTransactions()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('rule-groups.select-transactions', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleGroupController::store
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
$this->session(['rule-groups.create.url' => 'http://localhost']);
|
||||
$data = [
|
||||
'title' => 'A',
|
||||
'description' => '',
|
||||
];
|
||||
|
||||
$repository = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$repository->shouldReceive('store')->andReturn(new RuleGroup);
|
||||
$repository->shouldReceive('find')->andReturn(new RuleGroup);
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('rule-groups.store', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleGroupController::up
|
||||
*/
|
||||
public function testUp()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('rule-groups.up', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertRedirectedToRoute('rules.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\RuleGroupController::update
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
$data = [
|
||||
'title' => 'C',
|
||||
'description' => 'XX',
|
||||
];
|
||||
$this->session(['rule-groups.edit.url' => 'http://localhost']);
|
||||
|
||||
$repository = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$repository->shouldReceive('update');
|
||||
$repository->shouldReceive('find')->andReturn(new RuleGroup);
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('rule-groups.update', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* SearchControllerTest.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.
|
||||
*/
|
||||
use FireflyIII\Support\Search\SearchInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:43.
|
||||
*/
|
||||
class SearchControllerTest 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\SearchController::index
|
||||
* Implement testIndex().
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$search = $this->mock(SearchInterface::class);
|
||||
$search->shouldReceive('setLimit')->once();
|
||||
$search->shouldReceive('searchTransactions')->andReturn(new Collection)->withArgs([['test']])->once();
|
||||
$search->shouldReceive('searchBudgets')->andReturn(new Collection)->withArgs([['test']])->once();
|
||||
$search->shouldReceive('searchTags')->andReturn(new Collection)->withArgs([['test']])->once();
|
||||
$search->shouldReceive('searchCategories')->andReturn(new Collection)->withArgs([['test']])->once();
|
||||
$search->shouldReceive('searchAccounts')->andReturn(new Collection)->withArgs([['test']])->once();
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('search.index') . '?q=test');
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
}
|
@@ -1,135 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* TagControllerTest.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.
|
||||
*/
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:43.
|
||||
*/
|
||||
class TagControllerTest 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\TagController::create
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('tags.create'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\TagController::delete
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('tags.delete', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\TagController::destroy
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
$repository = $this->mock(TagRepositoryInterface::class);
|
||||
$repository->shouldReceive('destroy');
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('tags.destroy', [1]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\TagController::edit
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('tags.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\TagController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('tags.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\TagController::show
|
||||
*/
|
||||
public function testShow()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('tags.show', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\TagController::store
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
$this->session(['tags.create.url' => 'http://localhost']);
|
||||
$data = [
|
||||
'tag' => 'Hello new tag' . rand(999, 10000),
|
||||
'tagMode' => 'nothing',
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('tags.store'), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\TagController::update
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
$this->session(['tags.edit.url' => 'http://localhost']);
|
||||
$data = [
|
||||
'tag' => 'Hello updated tag' . rand(999, 10000),
|
||||
'tagMode' => 'nothing',
|
||||
];
|
||||
$repository = $this->mock(TagRepositoryInterface::class);
|
||||
$repository->shouldReceive('update');
|
||||
$repository->shouldReceive('find')->andReturn(new Tag);
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('tags.update', [1]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
}
|
@@ -1,121 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Transaction;
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:43.
|
||||
*/
|
||||
class ConvertControllerTest 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\ConvertController::index
|
||||
*/
|
||||
public function testIndexDepositTransfer()
|
||||
{
|
||||
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.convert.index', ['transfer', $deposit->id]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('Convert a deposit into a transfer');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::index
|
||||
*/
|
||||
public function testIndexDepositWithdrawal()
|
||||
{
|
||||
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.convert.index', ['withdrawal', $deposit->id]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('Convert a deposit into a withdrawal');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::index
|
||||
*/
|
||||
public function testIndexTransferDeposit()
|
||||
{
|
||||
$transfer = TransactionJournal::where('transaction_type_id', 3)->where('user_id', $this->user()->id)->first();
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.convert.index', ['deposit', $transfer->id]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('Convert a transfer into a deposit');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::index
|
||||
*/
|
||||
public function testIndexTransferWithdrawal()
|
||||
{
|
||||
$transfer = TransactionJournal::where('transaction_type_id', 3)->where('user_id', $this->user()->id)->first();
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.convert.index', ['withdrawal', $transfer->id]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('Convert a transfer into a withdrawal');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::index
|
||||
*/
|
||||
public function testIndexWithdrawalDeposit()
|
||||
{
|
||||
$withdrawal= TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.convert.index', ['deposit', $withdrawal->id]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('Convert a withdrawal into a deposit');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::index
|
||||
*/
|
||||
public function testIndexWithdrawalTransfer()
|
||||
{
|
||||
$withdrawal= TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.convert.index', ['transfer', $withdrawal->id]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('Convert a withdrawal into a transfer');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\ConvertController::postIndex
|
||||
*/
|
||||
public function testPostIndex()
|
||||
{
|
||||
$withdrawal= TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();
|
||||
// convert a withdrawal to a transfer. Requires the ID of another asset account.
|
||||
$data = [
|
||||
'destination_account_asset' => 2,
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('transactions.convert.index', ['transfer', $withdrawal->id]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertRedirectedToRoute('transactions.show', [$withdrawal->id]);
|
||||
}
|
||||
}
|
@@ -1,115 +0,0 @@
|
||||
<?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 FireflyIII\Models\TransactionJournal;
|
||||
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()
|
||||
{
|
||||
$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', $withdrawals));
|
||||
$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']);
|
||||
$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);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertResponseStatus(302);
|
||||
|
||||
// visit them should give 404.
|
||||
$this->call('get', route('transactions.show', [$deposits[0]]));
|
||||
$this->assertResponseStatus(404);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\MassController::edit
|
||||
*/
|
||||
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', $transfers));
|
||||
$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()
|
||||
{
|
||||
$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' => [$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', [$deposit->id]), $data);
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertResponseStatus(302);
|
||||
|
||||
// visit them should show updated content
|
||||
$this->call('get', route('transactions.show', [$deposit->id]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('Updated salary thing');
|
||||
}
|
||||
|
||||
}
|
@@ -1,141 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* SingleControllerTest.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 FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:44.
|
||||
*/
|
||||
class SingleControllerTest 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\SingleController::create
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.create', ['withdrawal']));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::delete
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.delete', [12]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::destroy
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
$this->session(['transactions.delete.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('delete')->once();
|
||||
|
||||
$this->call('post', route('transactions.destroy', [13]));
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::edit
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.edit', [13]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::store
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
$this->session(['transactions.create.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
|
||||
$data = [
|
||||
'what' => 'withdrawal',
|
||||
'amount' => '10',
|
||||
'amount_currency_id_amount' => 1,
|
||||
'source_account_id' => 1,
|
||||
'destination_account_name' => 'Some destination',
|
||||
'date' => '2016-01-01',
|
||||
'description' => 'Test descr',
|
||||
];
|
||||
$this->call('post', route('transactions.store', ['withdrawal']), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::update
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
$this->session(['transactions.edit.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
$data = [
|
||||
'id' => 123,
|
||||
'what' => 'withdrawal',
|
||||
'description' => 'Updated groceries',
|
||||
'source_account_id' => 1,
|
||||
'destination_account_name' => 'PLUS',
|
||||
'amount' => '123',
|
||||
'amount_currency_id_amount' => 1,
|
||||
'budget_id' => 1,
|
||||
'category' => 'Daily groceries',
|
||||
'tags' => '',
|
||||
'date' => '2016-01-01',
|
||||
];
|
||||
|
||||
$this->call('post', route('transactions.update', [123]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
|
||||
$this->call('get', route('transactions.show', [123]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('Updated groceries');
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
|
||||
}
|
||||
}
|
@@ -1,86 +0,0 @@
|
||||
<?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 FireflyIII\Models\TransactionJournal;
|
||||
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()
|
||||
{
|
||||
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.split.edit', [$deposit->id]));
|
||||
$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']);
|
||||
$deposit = TransactionJournal::where('transaction_type_id', 2)->where('user_id', $this->user()->id)->first();
|
||||
$data = [
|
||||
'id' => $deposit->id,
|
||||
'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', [$deposit->id]), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
|
||||
// journal is updated?
|
||||
$this->call('get', route('transactions.show', [$deposit->id]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('Updated salary');
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
}
|
@@ -1,89 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* TransactionControllerTest.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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:44.
|
||||
*/
|
||||
class TransactionControllerTest 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\TransactionController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.index', ['transfer']));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\TransactionController::indexAll
|
||||
*/
|
||||
public function testIndexAll()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.index.all', ['transfer']));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\TransactionController::indexByDate
|
||||
*/
|
||||
public function testIndexByDate()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.index.date', ['transfer', '2016-01-01']));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\TransactionController::reorder
|
||||
*/
|
||||
public function testReorder()
|
||||
{
|
||||
$data = [
|
||||
'items' => [],
|
||||
];
|
||||
$this->be($this->user());
|
||||
$this->call('post', route('transactions.reorder'), $data);
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\TransactionController::show
|
||||
*/
|
||||
public function testShow()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('transactions.show', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
}
|
@@ -1,83 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* AccountTest.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.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
use FireflyIII\Models\Account;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class AccountTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Models\Account::firstOrCreateEncrypted
|
||||
*/
|
||||
public function testEncrypted()
|
||||
{
|
||||
$data = [
|
||||
'user_id' => 1,
|
||||
'name' => 'Test account #' . rand(1000, 9999),
|
||||
];
|
||||
$account = Account::firstOrCreateEncrypted($data);
|
||||
|
||||
$this->assertEquals($account->user_id, $data['user_id']);
|
||||
$this->assertEquals($account->name, $data['name']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Models\Account::firstOrCreateEncrypted
|
||||
*/
|
||||
public function testEncryptedIban()
|
||||
{
|
||||
$data = [
|
||||
'user_id' => 1,
|
||||
'iban' => 'NL64RABO0133183395',
|
||||
];
|
||||
$account = Account::firstOrCreateEncrypted($data);
|
||||
|
||||
$this->assertEquals($account->user_id, $data['user_id']);
|
||||
$this->assertEquals($account->name, $data['iban']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Models\Account::firstOrCreateEncrypted
|
||||
* @expectedException \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function testEncryptedNoId()
|
||||
{
|
||||
$data = [
|
||||
'name' => 'Test account',
|
||||
];
|
||||
$account = Account::firstOrCreateEncrypted($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Models\Account::routeBinder
|
||||
*/
|
||||
public function testRouteBinder()
|
||||
{
|
||||
// not logged in?
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('accounts.show', [1]));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* One that belongs to another user.
|
||||
*
|
||||
* @covers \FireflyIII\Models\Account::routeBinder
|
||||
*/
|
||||
public function testRouteBinderError()
|
||||
{
|
||||
$account = Account::whereUserId(3)->first();
|
||||
$this->be($this->user());
|
||||
$this->call('get', route('accounts.show', [$account->id]));
|
||||
$this->assertResponseStatus(404);
|
||||
}
|
||||
}
|
@@ -1,56 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* TransactionTypeTest.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.
|
||||
*/
|
||||
|
||||
use FireflyIII\Models\TransactionType;
|
||||
|
||||
|
||||
/**
|
||||
* Class TransactionTypeTest
|
||||
*/
|
||||
class TransactionTypeTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \FireflyIII\Models\TransactionType::isDeposit
|
||||
*/
|
||||
public function testIsDeposit()
|
||||
{
|
||||
|
||||
$transactionType = TransactionType::whereType(TransactionType::DEPOSIT)->first();
|
||||
$this->assertTrue($transactionType->isDeposit());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Models\TransactionType::isOpeningBalance
|
||||
*/
|
||||
public function testIsOpeningBalance()
|
||||
{
|
||||
$transactionType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first();
|
||||
$this->assertTrue($transactionType->isOpeningBalance());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Models\TransactionType::isTransfer
|
||||
*/
|
||||
public function testIsTransfer()
|
||||
{
|
||||
$transactionType = TransactionType::whereType(TransactionType::TRANSFER)->first();
|
||||
$this->assertTrue($transactionType->isTransfer());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Models\TransactionType::isWithdrawal
|
||||
*/
|
||||
public function testIsWithdrawal()
|
||||
{
|
||||
$transactionType = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
|
||||
$this->assertTrue($transactionType->isWithdrawal());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user