Improve test coverage, mark as deprecated.

This commit is contained in:
James Cole
2018-05-05 13:53:12 +02:00
parent bc7c3bb9b3
commit 19fff681d2
22 changed files with 701 additions and 379 deletions

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace tests\Unit\Import\Specifics;
use FireflyIII\Import\Specifics\RabobankDescription;
use Tests\TestCase;
/**
@@ -31,9 +32,44 @@ use Tests\TestCase;
*/
class RabobankDescriptionTest extends TestCase
{
/**
* Default behaviour
* @covers \FireflyIII\Import\Specifics\RabobankDescription
*/
public function testRunBasic(): void
{
$this->assertTrue(true);
$row = ['','','','','','','','','','',''];
$parser = new RabobankDescription;
$result = $parser->run($row);
$this->assertEquals($row, $result);
}
/**
* No opposite name or iban
* @covers \FireflyIII\Import\Specifics\RabobankDescription
*/
public function testRunUseDescription(): void
{
$row = ['','','','','','','','','','','Hello'];
$parser = new RabobankDescription;
$result = $parser->run($row);
$this->assertEquals('Hello', $result[6]);
$this->assertEquals('', $result[10]);
}
/**
* Has opposite name or iban
* @covers \FireflyIII\Import\Specifics\RabobankDescription
*/
public function testRunUseFilledIn(): void
{
$row = ['','','','','','ABC','','','','',''];
$parser = new RabobankDescription;
$result = $parser->run($row);
$this->assertEquals($row, $result);
}
}

View File

@@ -0,0 +1,72 @@
<?php
/**
* SnsDescriptionTest.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\Import\Specifics;
use FireflyIII\Import\Specifics\SnsDescription;
use Tests\TestCase;
/**
* Class SnsDescriptionTest
*/
class SnsDescriptionTest extends TestCase
{
/**
* @covers \FireflyIII\Import\Specifics\SnsDescription
*/
public function testRunBasic(): void
{
$row = ['a', 'b', 'c'];
$parser = new SnsDescription;
$result = $parser->run($row);
$this->assertEquals($row, $result);
}
/**
* @covers \FireflyIII\Import\Specifics\SnsDescription
*/
public function testRunNoQuotes(): void
{
$row = ['a', 'b', 'c', 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'Some text'];
$parser = new SnsDescription;
$result = $parser->run($row);
$this->assertEquals($row, $result);
$this->assertEquals('Some text', $result[17]);
}
/**
* @covers \FireflyIII\Import\Specifics\SnsDescription
*/
public function testRunQuotes(): void
{
$row = ['a', 'b', 'c', 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, '\'Some text\''];
$parser = new SnsDescription;
$result = $parser->run($row);
$this->assertEquals('Some text', $result[17]);
}
}