Update various tests and the composer lock file.

This commit is contained in:
James Cole
2016-12-18 10:37:59 +01:00
parent 3d8adfa7e4
commit 7716ff4e8c
16 changed files with 161 additions and 233 deletions

View File

@@ -8,7 +8,12 @@
*
* 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;
/**
@@ -114,6 +119,27 @@ class CategoryControllerTest extends TestCase
*/
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('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]));
@@ -129,6 +155,17 @@ class CategoryControllerTest extends TestCase
*/
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('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', [1, '2015-01-01']));

View File

@@ -28,165 +28,131 @@ class JsonControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\JsonController::action
* Implement testAction().
*/
public function testAction()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('json.action'));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\JsonController::boxBillsPaid
* Implement testBoxBillsPaid().
*/
public function testBoxBillsPaid()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('json.box.paid'));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\JsonController::boxBillsUnpaid
* Implement testBoxBillsUnpaid().
*/
public function testBoxBillsUnpaid()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('json.box.unpaid'));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\JsonController::boxIn
* Implement testBoxIn().
*/
public function testBoxIn()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('json.box.in'));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\JsonController::boxOut
* Implement testBoxOut().
*/
public function testBoxOut()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('json.box.out'));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\JsonController::categories
* Implement testCategories().
*/
public function testCategories()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('json.categories'));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\JsonController::endTour
* Implement testEndTour().
*/
public function testEndTour()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('post', route('json.end-tour'));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\JsonController::expenseAccounts
* Implement testExpenseAccounts().
*/
public function testExpenseAccounts()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('json.expense-accounts'));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\JsonController::revenueAccounts
* Implement testRevenueAccounts().
*/
public function testRevenueAccounts()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('json.revenue-accounts'));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\JsonController::tags
* Implement testTags().
*/
public function testTags()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('json.tags'));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\JsonController::tour
* Implement testTour().
*/
public function testTour()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('json.tour'));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\JsonController::transactionJournals
* Implement testTransactionJournals().
*/
public function testTransactionJournals()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$this->call('get', route('json.transaction-journals', ['deposit']));
$this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\JsonController::trigger
* Implement testTrigger().
*/
public function testTrigger()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
$this->be($this->user());
$this->call('get', route('json.trigger'));
$this->assertResponseStatus(200);
}
}

View File

@@ -28,7 +28,6 @@ class NewUserControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\NewUserController::index
* Implement testIndex().
*/
public function testIndex()
{
@@ -40,7 +39,6 @@ class NewUserControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\NewUserController::submit
* Implement testSubmit().
*/
public function testSubmit()
{
@@ -50,11 +48,4 @@ class NewUserControllerTest extends TestCase
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
}

View File

@@ -206,11 +206,4 @@ class PiggyBankControllerTest extends TestCase
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
}

View File

@@ -85,12 +85,4 @@ class PreferencesControllerTest extends TestCase
'This test has not been implemented yet.'
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
}

View File

@@ -85,12 +85,4 @@ class ProfileControllerTest extends TestCase
'This test has not been implemented yet.'
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
}

View File

@@ -109,12 +109,4 @@ class ReportControllerTest extends TestCase
'This test has not been implemented yet.'
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
}

View File

@@ -169,12 +169,4 @@ class RuleControllerTest extends TestCase
'This test has not been implemented yet.'
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
}

View File

@@ -145,12 +145,4 @@ class RuleGroupControllerTest extends TestCase
'This test has not been implemented yet.'
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
}

View File

@@ -37,12 +37,4 @@ class SearchControllerTest extends TestCase
'This test has not been implemented yet.'
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
}

View File

@@ -121,12 +121,4 @@ class TagControllerTest extends TestCase
'This test has not been implemented yet.'
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
}

View File

@@ -85,12 +85,4 @@ class TransactionControllerTest extends TestCase
'This test has not been implemented yet.'
);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
}