Files
firefly-iii/tests/Unit/Support/Import/JobConfiguration/Bunq/NewBunqJobHandlerTest.php
2018-08-09 20:17:15 +02:00

66 lines
2.0 KiB
PHP

<?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 Tests\TestCase;
/**
* Class NewBunqJobHandlerTest
*/
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, 10000);
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'bunq';
$job->file_type = '';
$job->configuration = [];
$job->save();
// expected config:
//$expected = [];
// mock stuff
$repository = $this->mock(ImportJobRepositoryInterface::class);
// mock calls
$repository->shouldReceive('setUser')->once();
$handler = new NewBunqJobHandler();
$handler->setImportJob($job);
$this->assertTrue($handler->configurationComplete());
}
}