Ignore basic methods, improving code coverage.

This commit is contained in:
James Cole
2018-06-02 06:18:07 +02:00
parent ddc1d81665
commit ba01c4bbe8
22 changed files with 104 additions and 89 deletions

View File

@@ -23,7 +23,8 @@ declare(strict_types=1);
namespace FireflyIII\Services\Github\Object;
/**
* Class SpectreObject
* @codeCoverageIgnore
* Class GithubObject
*/
class GithubObject
{

View File

@@ -27,6 +27,7 @@ use Carbon\Carbon;
/**
* @codeCoverageIgnore
* Class Release
*/
class Release extends GithubObject

View File

@@ -23,8 +23,8 @@ declare(strict_types=1);
namespace FireflyIII\Services\Internal\File;
use FireflyIII\Exceptions\FireflyException;
use Crypt;
use FireflyIII\Exceptions\FireflyException;
/**
* Class EncryptService

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Services\Internal\Update;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Transaction;
use FireflyIII\Services\Internal\Support\TransactionServiceTrait;
use FireflyIII\User;

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Services\Spectre\Exception;
/**
* @codeCoverageIgnore
* Class DuplicatedCustomerException
*/
class DuplicatedCustomerException extends SpectreException

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Services\Spectre\Exception;
use Exception;
/**
* @codeCoverageIgnore
* Class SpectreException
*/
class SpectreException extends Exception

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Services\Spectre\Exception;
/**
* @codeCoverageIgnore
* Class WrongRequestFormatException
*/
class WrongRequestFormatException extends SpectreException

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Services\Spectre\Object;
use Carbon\Carbon;
/**
* @codeCoverageIgnore
* Class Account
*/
class Account extends SpectreObject
@@ -50,11 +51,24 @@ class Account extends SpectreObject
private $updatedAt;
/**
* @return string
* Account constructor.
*
* @param array $data
*/
public function getNature(): string
public function __construct(array $data)
{
return $this->nature;
$this->id = (int)$data['id'];
$this->loginId = $data['login_id'];
$this->currencyCode = $data['currency_code'];
$this->balance = $data['balance'];
$this->name = $data['name'];
$this->nature = $data['nature'];
$this->createdAt = new Carbon($data['created_at']);
$this->updatedAt = new Carbon($data['updated_at']);
foreach ($data['extra'] as $key => $value) {
$this->extra[$key] = $value;
}
}
/**
@@ -81,29 +95,6 @@ class Account extends SpectreObject
return $this->extra;
}
/**
* Account constructor.
*
* @param array $data
*/
public function __construct(array $data)
{
$this->id = (int)$data['id'];
$this->loginId = $data['login_id'];
$this->currencyCode = $data['currency_code'];
$this->balance = $data['balance'];
$this->name = $data['name'];
$this->nature = $data['nature'];
$this->createdAt = new Carbon($data['created_at']);
$this->updatedAt = new Carbon($data['updated_at']);
foreach ($data['extra'] as $key => $value) {
$this->extra[$key] = $value;
}
}
/**
* @return int
*/
@@ -120,6 +111,14 @@ class Account extends SpectreObject
return $this->name;
}
/**
* @return string
*/
public function getNature(): string
{
return $this->nature;
}
/**
* @return array
*/

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Services\Spectre\Object;
use Carbon\Carbon;
/**
* @codeCoverageIgnore
* Class Attempt
*/
class Attempt extends SpectreObject
@@ -58,6 +59,8 @@ class Attempt extends SpectreObject
private $failErrorClass;
/** @var string */
private $failMessage;
/** @var array */
private $fetchScopes = [];
/** @var bool */
private $finished;
/** @var bool */
@@ -85,11 +88,9 @@ class Attempt extends SpectreObject
/** @var Carbon */
private $toDate;
/** @var Carbon */
private $updatedAt;
private $updatedAt; // undocumented
/** @var string */
private $userAgent; // undocumented
/** @var array */
private $fetchScopes = [];
private $userAgent;
/**
* Attempt constructor.

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Services\Spectre\Object;
/**
* @codeCoverageIgnore
* Class Customer
*/
class Customer extends SpectreObject

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Services\Spectre\Object;
/**
* @codeCoverageIgnore
* Class Holder
*/
class Holder extends SpectreObject

View File

@@ -27,6 +27,7 @@ use Carbon\Carbon;
/**
* @codeCoverageIgnore
* Class Login
*/
class Login extends SpectreObject
@@ -68,6 +69,34 @@ class Login extends SpectreObject
/** @var Carbon */
private $updatedAt;
/**
* Login constructor.
*
* @param array $data
*/
public function __construct(array $data)
{
$this->consentGivenAt = new Carbon($data['consent_given_at']);
$this->consentTypes = $data['consent_types'];
$this->countryCode = $data['country_code'];
$this->createdAt = new Carbon($data['created_at']);
$this->updatedAt = new Carbon($data['updated_at']);
$this->customerId = $data['customer_id'];
$this->dailyRefresh = $data['daily_refresh'];
$this->holderInfo = new Holder($data['holder_info']);
$this->id = (int)$data['id'];
$this->lastAttempt = new Attempt($data['last_attempt']);
$this->lastSuccessAt = new Carbon($data['last_success_at']);
$this->nextRefreshPossibleAt = new Carbon($data['next_refresh_possible_at']);
$this->providerCode = $data['provider_code'];
$this->providerId = $data['provider_id'];
$this->providerName = $data['provider_name'];
$this->showConsentConfirmation = $data['show_consent_confirmation'];
$this->status = $data['status'];
$this->storeCredentials = $data['store_credentials'];
}
/**
* @return string
*/
@@ -76,6 +105,22 @@ class Login extends SpectreObject
return $this->countryCode;
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @return Attempt
*/
public function getLastAttempt(): Attempt
{
return $this->lastAttempt;
}
/**
* @return Carbon
*/
@@ -108,53 +153,6 @@ class Login extends SpectreObject
return $this->updatedAt;
}
/**
* Login constructor.
*
* @param array $data
*/
public function __construct(array $data)
{
$this->consentGivenAt = new Carbon($data['consent_given_at']);
$this->consentTypes = $data['consent_types'];
$this->countryCode = $data['country_code'];
$this->createdAt = new Carbon($data['created_at']);
$this->updatedAt = new Carbon($data['updated_at']);
$this->customerId = $data['customer_id'];
$this->dailyRefresh = $data['daily_refresh'];
$this->holderInfo = new Holder($data['holder_info']);
$this->id = (int)$data['id'];
$this->lastAttempt = new Attempt($data['last_attempt']);
$this->lastSuccessAt = new Carbon($data['last_success_at']);
$this->nextRefreshPossibleAt = new Carbon($data['next_refresh_possible_at']);
$this->providerCode = $data['provider_code'];
$this->providerId = $data['provider_id'];
$this->providerName = $data['provider_name'];
$this->showConsentConfirmation = $data['show_consent_confirmation'];
$this->status = $data['status'];
$this->storeCredentials = $data['store_credentials'];
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @return Attempt
*/
public function getLastAttempt(): Attempt
{
return $this->lastAttempt;
}
/**
* @return array
*/

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Services\Spectre\Object;
/**
* @codeCoverageIgnore
* Class SpectreObject
*/
class SpectreObject

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Services\Spectre\Object;
use Carbon\Carbon;
/**
* @codeCoverageIgnore
* Class Token
*/
class Token extends SpectreObject

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Services\Spectre\Object;
use Carbon\Carbon;
/**
* @codeCoverageIgnore
* Class Transaction
*/
class Transaction extends SpectreObject

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Services\Spectre\Object;
use Carbon\Carbon;
/**
* @codeCoverageIgnore
* Class TransactionExtra
*/
class TransactionExtra extends SpectreObject

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Services\Spectre\Request;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Services\Spectre\Exception\SpectreException;
use FireflyIII\Services\Spectre\Object\Account;
use FireflyIII\Services\Spectre\Object\Login;
use Log;

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Services\Spectre\Request;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Services\Spectre\Exception\SpectreException;
use FireflyIII\Services\Spectre\Object\Account;
use FireflyIII\Services\Spectre\Object\Transaction;
use Log;

View File

@@ -53,6 +53,7 @@ abstract class SpectreRequest
abstract public function call(): void;
/**
* @codeCoverageIgnore
* @return string
*/
public function getAppId(): string
@@ -61,6 +62,8 @@ abstract class SpectreRequest
}
/**
* @codeCoverageIgnore
*
* @param string $appId
*/
public function setAppId(string $appId): void
@@ -69,6 +72,7 @@ abstract class SpectreRequest
}
/**
* @codeCoverageIgnore
* @return string
*/
public function getSecret(): string
@@ -77,6 +81,8 @@ abstract class SpectreRequest
}
/**
* @codeCoverageIgnore
*
* @param string $secret
*/
public function setSecret(string $secret): void
@@ -85,6 +91,7 @@ abstract class SpectreRequest
}
/**
* @codeCoverageIgnore
* @return string
*/
public function getServer(): string
@@ -93,6 +100,8 @@ abstract class SpectreRequest
}
/**
* @codeCoverageIgnore
*
* @param string $privateKey
*/
public function setPrivateKey(string $privateKey): void