2016-11-19 20:30:30 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2016-11-20 08:30:25 +01:00
|
|
|
* Generated by PHPUnit_SkeletonGenerator on 2016-11-20 at 07:15:07.
|
2016-11-19 20:30:30 +01:00
|
|
|
*/
|
|
|
|
class AccountControllerTest extends TestCase
|
|
|
|
{
|
2016-11-20 07:24:18 +01:00
|
|
|
|
2016-11-19 20:30:30 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets up the fixture, for example, opens a network connection.
|
|
|
|
* This method is called before a test is executed.
|
|
|
|
*/
|
|
|
|
public function setUp()
|
|
|
|
{
|
2016-11-20 08:30:25 +01:00
|
|
|
parent::setUp();
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers FireflyIII\Http\Controllers\AccountController::create
|
|
|
|
*/
|
|
|
|
public function testCreate()
|
|
|
|
{
|
2016-11-20 08:30:25 +01:00
|
|
|
$this->be($this->user());
|
|
|
|
$this->call('GET', route('accounts.create', ['asset']));
|
|
|
|
$this->assertResponseStatus(200);
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers FireflyIII\Http\Controllers\AccountController::delete
|
|
|
|
*/
|
|
|
|
public function testDelete()
|
|
|
|
{
|
2016-11-20 08:46:02 +01:00
|
|
|
$this->be($this->user());
|
|
|
|
$this->call('GET', route('accounts.delete', [1]));
|
|
|
|
$this->assertResponseStatus(200);
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers FireflyIII\Http\Controllers\AccountController::destroy
|
|
|
|
*/
|
|
|
|
public function testDestroy()
|
|
|
|
{
|
|
|
|
// Remove the following lines when you implement this test.
|
|
|
|
$this->markTestIncomplete(
|
|
|
|
'This test has not been implemented yet.'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers FireflyIII\Http\Controllers\AccountController::edit
|
|
|
|
*/
|
|
|
|
public function testEdit()
|
|
|
|
{
|
2016-11-20 08:46:02 +01:00
|
|
|
$this->be($this->user());
|
|
|
|
$this->call('GET', route('accounts.edit', [1]));
|
|
|
|
$this->assertResponseStatus(200);
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-11-20 08:46:02 +01:00
|
|
|
* @covers FireflyIII\Http\Controllers\AccountController::index
|
|
|
|
* @dataProvider dateRangeProvider
|
|
|
|
*
|
|
|
|
* @param string $range
|
2016-11-19 20:30:30 +01:00
|
|
|
*/
|
2016-11-20 08:46:02 +01:00
|
|
|
public function testIndex(string $range)
|
2016-11-19 20:30:30 +01:00
|
|
|
{
|
2016-11-20 08:46:02 +01:00
|
|
|
$this->be($this->user());
|
|
|
|
$this->changeDateRange($this->user(), $range);
|
|
|
|
$this->call('GET', route('accounts.index', ['asset']));
|
|
|
|
$this->assertResponseStatus(200);
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-11-20 08:54:52 +01:00
|
|
|
* @covers FireflyIII\Http\Controllers\AccountController::show
|
2016-11-20 08:46:02 +01:00
|
|
|
* @dataProvider dateRangeProvider
|
|
|
|
*
|
|
|
|
* @param string $range
|
2016-11-19 20:30:30 +01:00
|
|
|
*/
|
2016-11-20 08:46:02 +01:00
|
|
|
public function testShow(string $range)
|
2016-11-19 20:30:30 +01:00
|
|
|
{
|
2016-11-20 08:46:02 +01:00
|
|
|
|
|
|
|
$tasker = $this->mock(\FireflyIII\Repositories\Account\AccountTaskerInterface::class);
|
|
|
|
$tasker->shouldReceive('amountOutInPeriod')->withAnyArgs()->andReturn('-1');
|
|
|
|
$tasker->shouldReceive('amountInInPeriod')->withAnyArgs()->andReturn('1');
|
|
|
|
|
2016-11-20 08:54:52 +01:00
|
|
|
$this->be($this->user());
|
|
|
|
$this->changeDateRange($this->user(), $range);
|
2016-11-20 08:46:02 +01:00
|
|
|
$this->call('GET', route('accounts.show', [1]));
|
|
|
|
$this->assertResponseStatus(200);
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-11-20 08:54:52 +01:00
|
|
|
* @covers FireflyIII\Http\Controllers\AccountController::showWithDate
|
2016-11-20 08:46:02 +01:00
|
|
|
* @dataProvider dateRangeProvider
|
|
|
|
*
|
|
|
|
* @param string $range
|
2016-11-19 20:30:30 +01:00
|
|
|
*/
|
2016-11-20 08:46:02 +01:00
|
|
|
public function testShowWithDate(string $range)
|
2016-11-19 20:30:30 +01:00
|
|
|
{
|
2016-11-20 08:46:02 +01:00
|
|
|
$this->be($this->user());
|
|
|
|
$this->changeDateRange($this->user(), $range);
|
2016-11-20 08:54:52 +01:00
|
|
|
$this->call('GET', route('accounts.show.date', [1, '2016-01-01']));
|
2016-11-20 08:46:02 +01:00
|
|
|
$this->assertResponseStatus(200);
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers FireflyIII\Http\Controllers\AccountController::store
|
|
|
|
*/
|
|
|
|
public function testStore()
|
|
|
|
{
|
|
|
|
// Remove the following lines when you implement this test.
|
|
|
|
$this->markTestIncomplete(
|
|
|
|
'This test has not been implemented yet.'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers FireflyIII\Http\Controllers\AccountController::update
|
|
|
|
*/
|
|
|
|
public function testUpdate()
|
|
|
|
{
|
|
|
|
// Remove the following lines when you implement this test.
|
|
|
|
$this->markTestIncomplete(
|
|
|
|
'This test has not been implemented yet.'
|
|
|
|
);
|
|
|
|
}
|
2016-11-20 08:46:02 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Tears down the fixture, for example, closes a network connection.
|
|
|
|
* This method is called after a test is executed.
|
|
|
|
*/
|
|
|
|
protected function tearDown()
|
|
|
|
{
|
|
|
|
}
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|