Improve test coverage and remove deprecated code.

This commit is contained in:
James Cole
2018-05-05 11:03:10 +02:00
parent 57be7f2905
commit bc7c3bb9b3
26 changed files with 1784 additions and 1093 deletions

View File

@@ -36,6 +36,7 @@ class AbnAmroDescription implements SpecificInterface
public $row;
/**
* @codeCoverageIgnore
* @return string
*/
public static function getDescription(): string
@@ -44,6 +45,7 @@ class AbnAmroDescription implements SpecificInterface
}
/**
* @codeCoverageIgnore
* @return string
*/
public static function getName(): string
@@ -81,7 +83,7 @@ class AbnAmroDescription implements SpecificInterface
*
* @return bool true if the description is GEA/BEA-format, false otherwise
*/
protected function parseABNAMRODescription()
protected function parseABNAMRODescription(): bool
{
// See if the current description is formatted in ABN AMRO format
if (preg_match('/ABN AMRO.{24} (.*)/', $this->row[7], $matches)) {
@@ -99,7 +101,7 @@ class AbnAmroDescription implements SpecificInterface
*
* @return bool true if the description is GEA/BEAformat, false otherwise
*/
protected function parseGEABEADescription()
protected function parseGEABEADescription(): bool
{
// See if the current description is formatted in GEA/BEA format
if (preg_match('/([BG]EA) +(NR:[a-zA-Z:0-9]+) +([0-9.\/]+) +([^,]*)/', $this->row[7], $matches)) {
@@ -124,7 +126,7 @@ class AbnAmroDescription implements SpecificInterface
*
* @return bool true if the description is SEPA format, false otherwise
*/
protected function parseSepaDescription()
protected function parseSepaDescription(): bool
{
// See if the current description is formatted as a SEPA plain description
if (preg_match('/^SEPA(.{28})/', $this->row[7], $matches)) {
@@ -178,7 +180,7 @@ class AbnAmroDescription implements SpecificInterface
*
* @return bool true if the description is TRTP format, false otherwise
*/
protected function parseTRTPDescription()
protected function parseTRTPDescription(): bool
{
// See if the current description is formatted in TRTP format
if (preg_match_all('!\/([A-Z]{3,4})\/([^/]*)!', $this->row[7], $matches, PREG_SET_ORDER)) {
@@ -196,7 +198,7 @@ class AbnAmroDescription implements SpecificInterface
switch (strtoupper($key)) {
case 'NAME':
$this->row[8] = $name = $value;
$this->row[8] = $value;
break;
case 'REMI':
$newDescription = $value;

View File

@@ -38,6 +38,7 @@ class IngDescription implements SpecificInterface
public $row;
/**
* @codeCoverageIgnore
* @return string
*/
public static function getDescription(): string
@@ -46,6 +47,7 @@ class IngDescription implements SpecificInterface
}
/**
* @codeCoverageIgnore
* @return string
*/
public static function getName(): string
@@ -84,41 +86,29 @@ class IngDescription implements SpecificInterface
/**
* Add the Opposing name from cell 1 in the description for Betaalautomaten
* Otherwise the description is only: 'Pasvolgnr:<nr> <date> Transactie:<NR> Term:<nr>'.
*
* @return bool true
*/
protected function addNameIngDescription()
protected function addNameIngDescription(): void
{
$this->row[8] = $this->row[1] . ' ' . $this->row[8];
return true;
}
/**
* Remove IBAN number out of the description
* Default description of Description is: Naam: <OPPOS NAME> Omschrijving: <DESCRIPTION> IBAN: <OPPOS IBAN NR>.
*
* @return bool true
*/
protected function removeIBANIngDescription()
protected function removeIBANIngDescription(): void
{
// Try replace the iban number with nothing. The IBAN nr is found in the third row
$this->row[8] = preg_replace('/\sIBAN:\s' . $this->row[3] . '/', '', $this->row[8]);
return true;
}
/**
* Remove name from the description (Remove everything before the description incl the word 'Omschrijving' ).
*
* @return bool true
*/
protected function removeNameIngDescription()
protected function removeNameIngDescription(): void
{
// Try remove everything before the 'Omschrijving'
$this->row[8] = preg_replace('/.+Omschrijving: /', '', $this->row[8]);
return true;
}
/**
@@ -127,7 +117,7 @@ class IngDescription implements SpecificInterface
private function copyDescriptionToOpposite(): void
{
$search = ['Naar Oranje Spaarrekening ', 'Afschrijvingen'];
if (0 === \strlen($this->row[3])) {
if ('' === (string)$this->row[3]) {
$this->row[3] = trim(str_ireplace($search, '', $this->row[8]));
}
}

View File

@@ -28,6 +28,7 @@ namespace FireflyIII\Import\Specifics;
class PresidentsChoice implements SpecificInterface
{
/**
* @codeCoverageIgnore
* @return string
*/
public static function getDescription(): string
@@ -36,6 +37,7 @@ class PresidentsChoice implements SpecificInterface
}
/**
* @codeCoverageIgnore
* @return string
*/
public static function getName(): string