Fix tests.

This commit is contained in:
James Cole 2017-09-25 07:01:52 +02:00
parent 1a81cd45f2
commit 0b0e0054b3
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
6 changed files with 71 additions and 55 deletions

View File

@ -232,8 +232,6 @@ class CategoryController extends Controller
$start = null;
$end = null;
$periods = new Collection;
echo '12';
// prep for "all" view.
if ($moment === 'all') {

View File

@ -17,7 +17,6 @@ namespace FireflyIII\Repositories\Tag;
use Carbon\Carbon;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Helpers\Filter\InternalTransferFilter;
use FireflyIII\Helpers\Filter\TransferFilter;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;

View File

@ -66,9 +66,9 @@ class BunqInformation implements InformationInterface
}
Log::debug('Now in getAccounts()');
$sessionToken = $this->startSession();
$id = $this->getUserInformation($sessionToken);
$userId = $this->getUserInformation($sessionToken);
// get list of Bunq accounts:
$accounts = $this->getMonetaryAccounts($sessionToken, $id);
$accounts = $this->getMonetaryAccounts($sessionToken, $userId);
$return = [];
/** @var MonetaryAccountBank $account */
foreach ($accounts as $account) {

86
composer.lock generated
View File

@ -784,16 +784,16 @@
},
{
"name": "laravel/framework",
"version": "v5.5.3",
"version": "v5.5.13",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "779a98d3b2ebed2128db1a668dcc10a65c9b01be"
"reference": "bfbe20d32ee9f98c89df852847827407a5127be4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/779a98d3b2ebed2128db1a668dcc10a65c9b01be",
"reference": "779a98d3b2ebed2128db1a668dcc10a65c9b01be",
"url": "https://api.github.com/repos/laravel/framework/zipball/bfbe20d32ee9f98c89df852847827407a5127be4",
"reference": "bfbe20d32ee9f98c89df852847827407a5127be4",
"shasum": ""
},
"require": {
@ -912,7 +912,7 @@
"framework",
"laravel"
],
"time": "2017-09-07T13:50:21+00:00"
"time": "2017-09-24T19:09:38+00:00"
},
{
"name": "laravelcollective/html",
@ -1618,16 +1618,16 @@
},
{
"name": "ramsey/uuid",
"version": "3.7.0",
"version": "3.7.1",
"source": {
"type": "git",
"url": "https://github.com/ramsey/uuid.git",
"reference": "0ef23d1b10cf1bc576e9d865a7e9c47982c5715e"
"reference": "45cffe822057a09e05f7bd09ec5fb88eeecd2334"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ramsey/uuid/zipball/0ef23d1b10cf1bc576e9d865a7e9c47982c5715e",
"reference": "0ef23d1b10cf1bc576e9d865a7e9c47982c5715e",
"url": "https://api.github.com/repos/ramsey/uuid/zipball/45cffe822057a09e05f7bd09ec5fb88eeecd2334",
"reference": "45cffe822057a09e05f7bd09ec5fb88eeecd2334",
"shasum": ""
},
"require": {
@ -1696,7 +1696,7 @@
"identifier",
"uuid"
],
"time": "2017-08-04T13:39:04+00:00"
"time": "2017-09-22T20:46:04+00:00"
},
{
"name": "rcrowe/twigbridge",
@ -1868,16 +1868,16 @@
},
{
"name": "symfony/console",
"version": "v3.3.8",
"version": "v3.3.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "d6596cb5022b6a0bd940eae54a1de78646a5fda6"
"reference": "a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/d6596cb5022b6a0bd940eae54a1de78646a5fda6",
"reference": "d6596cb5022b6a0bd940eae54a1de78646a5fda6",
"url": "https://api.github.com/repos/symfony/console/zipball/a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf",
"reference": "a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf",
"shasum": ""
},
"require": {
@ -1932,11 +1932,11 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2017-08-27T14:52:21+00:00"
"time": "2017-09-06T16:40:18+00:00"
},
{
"name": "symfony/css-selector",
"version": "v3.3.8",
"version": "v3.3.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
@ -1989,16 +1989,16 @@
},
{
"name": "symfony/debug",
"version": "v3.3.8",
"version": "v3.3.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "084d804fe35808eb2ef596ec83d85d9768aa6c9d"
"reference": "8beb24eec70b345c313640962df933499373a944"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/084d804fe35808eb2ef596ec83d85d9768aa6c9d",
"reference": "084d804fe35808eb2ef596ec83d85d9768aa6c9d",
"url": "https://api.github.com/repos/symfony/debug/zipball/8beb24eec70b345c313640962df933499373a944",
"reference": "8beb24eec70b345c313640962df933499373a944",
"shasum": ""
},
"require": {
@ -2041,11 +2041,11 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2017-08-27T14:52:21+00:00"
"time": "2017-09-01T13:23:39+00:00"
},
{
"name": "symfony/event-dispatcher",
"version": "v3.3.8",
"version": "v3.3.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
@ -2108,7 +2108,7 @@
},
{
"name": "symfony/finder",
"version": "v3.3.8",
"version": "v3.3.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
@ -2157,16 +2157,16 @@
},
{
"name": "symfony/http-foundation",
"version": "v3.3.8",
"version": "v3.3.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "14bacad23a4f075bfd3fd456755236cb261320e3"
"reference": "2cdc7de1921d1a1c805a13dc05e44a2cd58f5ad3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/14bacad23a4f075bfd3fd456755236cb261320e3",
"reference": "14bacad23a4f075bfd3fd456755236cb261320e3",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/2cdc7de1921d1a1c805a13dc05e44a2cd58f5ad3",
"reference": "2cdc7de1921d1a1c805a13dc05e44a2cd58f5ad3",
"shasum": ""
},
"require": {
@ -2206,7 +2206,7 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2017-08-10T07:07:06+00:00"
"time": "2017-09-06T17:07:39+00:00"
},
{
"name": "symfony/http-kernel",
@ -2462,7 +2462,7 @@
},
{
"name": "symfony/process",
"version": "v3.3.8",
"version": "v3.3.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
@ -2511,7 +2511,7 @@
},
{
"name": "symfony/routing",
"version": "v3.3.8",
"version": "v3.3.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
@ -2589,7 +2589,7 @@
},
{
"name": "symfony/translation",
"version": "v3.3.8",
"version": "v3.3.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
@ -2654,7 +2654,7 @@
},
{
"name": "symfony/var-dumper",
"version": "v3.3.8",
"version": "v3.3.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
@ -3583,16 +3583,16 @@
},
{
"name": "phpdocumentor/reflection-common",
"version": "1.0",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c"
"reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
"reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
"reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
"shasum": ""
},
"require": {
@ -3633,7 +3633,7 @@
"reflection",
"static analysis"
],
"time": "2015-12-27T11:43:31+00:00"
"time": "2017-09-11T18:02:19+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
@ -4042,16 +4042,16 @@
},
{
"name": "phpunit/phpunit",
"version": "6.3.0",
"version": "6.3.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "9501bab711403a1ab5b8378a8adb4ec3db3debdb"
"reference": "c0ff817b36a827e64bf5f57bc72278150cf30a77"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9501bab711403a1ab5b8378a8adb4ec3db3debdb",
"reference": "9501bab711403a1ab5b8378a8adb4ec3db3debdb",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c0ff817b36a827e64bf5f57bc72278150cf30a77",
"reference": "c0ff817b36a827e64bf5f57bc72278150cf30a77",
"shasum": ""
},
"require": {
@ -4122,7 +4122,7 @@
"testing",
"xunit"
],
"time": "2017-08-04T05:20:39+00:00"
"time": "2017-09-24T07:25:54+00:00"
},
{
"name": "phpunit/phpunit-mock-objects",
@ -4744,7 +4744,7 @@
},
{
"name": "symfony/class-loader",
"version": "v3.3.8",
"version": "v3.3.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/class-loader.git",

View File

@ -15,6 +15,7 @@ use Carbon\Carbon;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use Illuminate\Pagination\LengthAwarePaginator;
@ -119,6 +120,12 @@ class TagControllerTest extends TestCase
*/
public function testShow()
{
$amounts = [
TransactionType::WITHDRAWAL => '0',
TransactionType::TRANSFER => '0',
TransactionType::DEPOSIT => '0',
];
// mock stuff
$repository = $this->mock(TagRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
@ -128,8 +135,7 @@ class TagControllerTest extends TestCase
$repository->shouldReceive('firstUseDate')->andReturn(new Carbon)->once();
$repository->shouldReceive('lastUseDate')->andReturn(new Carbon)->once();
$repository->shouldReceive('earnedInPeriod')->andReturn('1')->once();
$repository->shouldReceive('sumOfTag')->andReturn('1')->once();
$repository->shouldReceive('resultOfTag')->andReturn('1')->once();
$repository->shouldReceive('sumsOfTag')->andReturn($amounts)->once();
$collector->shouldReceive('removeFilter')->andReturnSelf()->once();
@ -163,10 +169,7 @@ class TagControllerTest extends TestCase
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('firstUseDate')->andReturn(new Carbon)->once();
$repository->shouldReceive('resultOfTag')->andReturn('1')->once();
$collector->shouldReceive('removeFilter')->andReturnSelf()->once();
$repository->shouldReceive('sumOfTag')->andReturn('1')->once();
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once();
$collector->shouldReceive('setLimit')->andReturnSelf()->once();
$collector->shouldReceive('setPage')->andReturnSelf()->once();
@ -177,6 +180,13 @@ class TagControllerTest extends TestCase
$collector->shouldReceive('setRange')->andReturnSelf()->once();
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->once();
$amounts = [
TransactionType::WITHDRAWAL => '0',
TransactionType::TRANSFER => '0',
TransactionType::DEPOSIT => '0',
];
$repository->shouldReceive('sumsOfTag')->andReturn($amounts)->once();
$this->be($this->user());
$response = $this->get(route('tags.show', [1, 'all']));
@ -198,8 +208,6 @@ class TagControllerTest extends TestCase
$repository->shouldReceive('firstUseDate')->andReturn(new Carbon)->once();
$repository->shouldReceive('lastUseDate')->andReturn(new Carbon)->once();
$repository->shouldReceive('earnedInPeriod')->andReturn('1')->once();
$repository->shouldReceive('sumOfTag')->andReturn('1')->once();
$repository->shouldReceive('resultOfTag')->andReturn('1')->once();
$collector->shouldReceive('removeFilter')->andReturnSelf()->once();
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once();
@ -212,6 +220,13 @@ class TagControllerTest extends TestCase
$collector->shouldReceive('setRange')->andReturnSelf()->once();
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->once();
$amounts = [
TransactionType::WITHDRAWAL => '0',
TransactionType::TRANSFER => '0',
TransactionType::DEPOSIT => '0',
];
$repository->shouldReceive('sumsOfTag')->andReturn($amounts)->once();
$this->be($this->user());
$response = $this->get(route('tags.show', [1, '2016-01-01']));

View File

@ -62,6 +62,8 @@ class MetaPieChartTest extends TestCase
$collector->shouldReceive('setUser')->andReturnSelf()->once();
$collector->shouldReceive('setAccounts')->andReturnSelf()->once();
$collector->shouldReceive('setRange')->andReturnSelf()->once();
$collector->shouldReceive('setBudgets')->andReturnSelf()->once();
$collector->shouldReceive('setCategories')->andReturnSelf()->once();
$collector->shouldReceive('setTypes')->withArgs([[TransactionType::DEPOSIT, TransactionType::TRANSFER]])->andReturnSelf()->once();
$collector->shouldReceive('withOpposingAccount')->andReturnSelf()->once();
$collector->shouldReceive('getJournals')->andReturn($collection);
@ -119,6 +121,8 @@ class MetaPieChartTest extends TestCase
$collector->shouldReceive('setUser')->andReturnSelf()->twice();
$collector->shouldReceive('setAccounts')->andReturnSelf()->twice();
$collector->shouldReceive('setRange')->andReturnSelf()->twice();
$collector->shouldReceive('setBudgets')->andReturnSelf()->once();
$collector->shouldReceive('setCategories')->andReturnSelf()->once();
$collector->shouldReceive('setTypes')->withArgs([[TransactionType::DEPOSIT, TransactionType::TRANSFER]])->andReturnSelf()->once();
$collector->shouldReceive('withOpposingAccount')->andReturnSelf()->once();
$collector->shouldReceive('getJournals')->andReturn($collection)->once();