2017-12-28 20:06:16 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2019-10-02 06:45:03 +02:00
|
|
|
* BankDebitCreditTest.php
|
|
|
|
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
2017-12-28 20:06:16 +01:00
|
|
|
*
|
2019-10-02 06:45:03 +02:00
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
2017-12-28 20:06:16 +01:00
|
|
|
*
|
2019-10-02 06:45:03 +02:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
2017-12-28 20:06:16 +01:00
|
|
|
*
|
2019-10-02 06:45:03 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2017-12-28 20:06:16 +01:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-10-02 06:45:03 +02:00
|
|
|
* GNU Affero General Public License for more details.
|
2017-12-28 20:06:16 +01:00
|
|
|
*
|
2019-10-02 06:45:03 +02:00
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2017-12-28 20:06:16 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Tests\Unit\Import\Converter;
|
|
|
|
|
2019-01-27 21:23:18 +01:00
|
|
|
use FireflyIII\Import\Converter\BankDebitCredit;
|
2017-12-28 20:06:16 +01:00
|
|
|
use FireflyIII\Import\Converter\INGDebitCredit;
|
2018-09-04 09:52:19 +02:00
|
|
|
use Log;
|
2017-12-28 20:06:16 +01:00
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
/**
|
2019-01-27 21:23:18 +01:00
|
|
|
*
|
|
|
|
* Class BankDebitCreditTest
|
2019-08-17 10:48:28 +02:00
|
|
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
|
|
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
|
|
|
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
2017-12-28 20:06:16 +01:00
|
|
|
*/
|
2019-01-27 21:23:18 +01:00
|
|
|
class BankDebitCreditTest extends TestCase
|
2017-12-28 20:06:16 +01:00
|
|
|
{
|
2018-09-04 09:52:19 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
2019-04-09 20:05:20 +02:00
|
|
|
Log::info(sprintf('Now in %s.', get_class($this)));
|
2018-09-04 09:52:19 +02:00
|
|
|
}
|
|
|
|
|
2019-01-27 21:23:18 +01:00
|
|
|
/**
|
|
|
|
* @covers \FireflyIII\Import\Converter\BankDebitCredit
|
|
|
|
*/
|
|
|
|
public function testConvertA(): void
|
|
|
|
{
|
|
|
|
$converter = new BankDebitCredit;
|
|
|
|
$result = $converter->convert('A');
|
|
|
|
$this->assertEquals(-1, $result);
|
|
|
|
}
|
2018-09-04 09:52:19 +02:00
|
|
|
|
2017-12-28 20:06:16 +01:00
|
|
|
/**
|
2019-01-27 21:23:18 +01:00
|
|
|
* @covers \FireflyIII\Import\Converter\BankDebitCredit
|
2017-12-28 20:06:16 +01:00
|
|
|
*/
|
2018-05-11 19:58:10 +02:00
|
|
|
public function testConvertAf(): void
|
2017-12-28 20:06:16 +01:00
|
|
|
{
|
2019-01-27 21:23:18 +01:00
|
|
|
$converter = new BankDebitCredit;
|
2017-12-28 20:06:16 +01:00
|
|
|
$result = $converter->convert('Af');
|
|
|
|
$this->assertEquals(-1, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-01-27 21:23:18 +01:00
|
|
|
* @covers \FireflyIII\Import\Converter\BankDebitCredit
|
2017-12-28 20:06:16 +01:00
|
|
|
*/
|
2018-05-11 19:58:10 +02:00
|
|
|
public function testConvertAnything(): void
|
2017-12-28 20:06:16 +01:00
|
|
|
{
|
2019-01-27 21:23:18 +01:00
|
|
|
$converter = new BankDebitCredit;
|
2017-12-29 09:05:35 +01:00
|
|
|
$result = $converter->convert('9083jkdkj');
|
2017-12-28 20:06:16 +01:00
|
|
|
$this->assertEquals(1, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-01-27 21:23:18 +01:00
|
|
|
* @covers \FireflyIII\Import\Converter\BankDebitCredit
|
2017-12-28 20:06:16 +01:00
|
|
|
*/
|
2018-05-11 19:58:10 +02:00
|
|
|
public function testConvertBij(): void
|
2017-12-28 20:06:16 +01:00
|
|
|
{
|
2019-01-27 21:23:18 +01:00
|
|
|
$converter = new BankDebitCredit;
|
2017-12-29 09:05:35 +01:00
|
|
|
$result = $converter->convert('Bij');
|
2017-12-28 20:06:16 +01:00
|
|
|
$this->assertEquals(1, $result);
|
|
|
|
}
|
2019-01-27 21:23:18 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers \FireflyIII\Import\Converter\BankDebitCredit
|
|
|
|
*/
|
|
|
|
public function testConvertDebet(): void
|
|
|
|
{
|
|
|
|
$converter = new BankDebitCredit;
|
|
|
|
$result = $converter->convert('Debet');
|
|
|
|
$this->assertEquals(-1, $result);
|
|
|
|
}
|
2018-03-04 15:14:29 +01:00
|
|
|
}
|