mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-01 03:29:33 +00:00
FF3 will apply rules when importing from bunq #1443
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* NewBunqJobHandlerTest.php
|
||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Support\Import\JobConfiguration\Bunq;
|
||||
|
||||
|
||||
use FireflyIII\Models\ImportJob;
|
||||
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
||||
use FireflyIII\Support\Import\JobConfiguration\Bunq\NewBunqJobHandler;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
|
||||
class NewBunqJobHandlerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \FireflyIII\Support\Import\JobConfiguration\Bunq\NewBunqJobHandler
|
||||
*/
|
||||
public function testCC(): void
|
||||
{
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'cXha' . random_int(1, 1000);
|
||||
$job->status = 'new';
|
||||
$job->stage = 'new';
|
||||
$job->provider = 'bunq';
|
||||
$job->file_type = '';
|
||||
$job->configuration = [];
|
||||
$job->save();
|
||||
|
||||
// expected config:
|
||||
$expected = [
|
||||
'apply-rules' => true,
|
||||
];
|
||||
|
||||
// mock stuff
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
// mock calls
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
$repository->shouldReceive('getConfiguration')->andReturn([])->once();
|
||||
$repository->shouldReceive('setConfiguration')->withArgs([Mockery::any(), $expected])->once();
|
||||
|
||||
$handler = new NewBunqJobHandler();
|
||||
$handler->setImportJob($job);
|
||||
$this->assertTrue($handler->configurationComplete());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user