From 062dd18e86ea441ee8b3f86ac42a35438049a1b0 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 25 Nov 2017 16:06:53 +0100 Subject: [PATCH] Implement more tests --- Models/AccountAbstract.php | 35 ++++- Models/AccountBalance.php | 198 ----------------------------- Models/AccountInterface.php | 46 ------- Models/AccountType.php | 5 +- Models/Balance.php | 89 +------------ Models/BatchPosting.php | 99 ++------------- Models/Creditor.php | 60 +-------- Models/Debitor.php | 59 +-------- Models/ImpersonalAccount.php | 57 +-------- Models/IncomeStatement.php | 60 +-------- Models/InvoicePosting.php | 59 +-------- Models/InvoicePostingSimple.php | 57 --------- Models/PersonalAccountAbstract.php | 59 +-------- Models/Posting.php | 57 --------- Models/PostingAbstract.php | 2 - Models/PostingInterface.php | 4 +- 16 files changed, 49 insertions(+), 897 deletions(-) delete mode 100644 Models/AccountBalance.php delete mode 100644 Models/AccountInterface.php diff --git a/Models/AccountAbstract.php b/Models/AccountAbstract.php index f12986a..e078244 100644 --- a/Models/AccountAbstract.php +++ b/Models/AccountAbstract.php @@ -24,7 +24,7 @@ namespace Modules\Accounting\Models; * @link http://website.orange-management.de * @since 1.0.0 */ -abstract class AccountAbstract implements AccountInterface +abstract class AccountAbstract { /** @@ -43,7 +43,9 @@ abstract class AccountAbstract implements AccountInterface */ protected $type = null; - protected $parent = null; + protected $positiveParent = null; + + protected $negativeParent = null; /** * Entry list. @@ -51,7 +53,7 @@ abstract class AccountAbstract implements AccountInterface * @var \Modules\Accounting\Models\EntryInterface[] * @since 1.0.0 */ - protected $entryList = 0; + protected $entryList = []; /** * Constructor. @@ -60,11 +62,16 @@ abstract class AccountAbstract implements AccountInterface * * @since 1.0.0 */ - public function __construct($id) + public function __construct(int $id = 0) { $this->id = $id; } + public function getId() : int + { + return $this->id; + } + /** * Get entry. * @@ -92,4 +99,24 @@ abstract class AccountAbstract implements AccountInterface public function getEntriesByDate($start, $end, $dateType = TimeRangeType::RECEIPT_DATE) { } + + public function getPositiveParent() + { + return $this->positiveParent; + } + + public function setPositiveParent($parent) + { + $this->positiveParent = $parent; + } + + public function getNegativeParent() + { + return $this->negativeParent; + } + + public function setNegativeParent($parent) + { + $this->negativeParent = $parent; + } } diff --git a/Models/AccountBalance.php b/Models/AccountBalance.php deleted file mode 100644 index 7d397d1..0000000 --- a/Models/AccountBalance.php +++ /dev/null @@ -1,198 +0,0 @@ -id = $id; - } - - /** - * @return \DateTime - * - * @since 1.0.0 - */ - public function getStart() - { - return $this->start; - } - - /** - * @param \DateTime $start - * - * @return void - * - * @since 1.0.0 - */ - public function setStart($start) - { - $this->start = $start; - } - - /** - * @return \DateTime - * - * @since 1.0.0 - */ - public function getEnd() - { - return $this->end; - } - - /** - * @param \DateTime $end - * - * @return void - * - * @since 1.0.0 - */ - public function setEnd($end) - { - $this->end = $end; - } - - /** - * @return TimeRangeType - * - * @since 1.0.0 - */ - public function getRangetype() - { - return $this->rangetype; - } - - /** - * @param TimeRangeType $rangetype - * - * @return void - * - * @since 1.0.0 - */ - public function setRangetype($rangetype) - { - $this->rangetype = $rangetype; - } - - /** - * @return AccountInterface - * - * @since 1.0.0 - */ - public function getAccount() - { - return $this->account; - } - - /** - * @param AccountInterface $account - * - * @return void - * - * @since 1.0.0 - */ - public function setAccount($account) - { - $this->account = $account; - } - - /** - * @return float - * - * @since 1.0.0 - */ - public function getBalance() - { - return $this->balance; - } - - /** - * @param float $balance - * - * @return void - * - * @since 1.0.0 - */ - public function setBalance($balance) - { - $this->balance = $balance; - } -} diff --git a/Models/AccountInterface.php b/Models/AccountInterface.php deleted file mode 100644 index 1c7e1e3..0000000 --- a/Models/AccountInterface.php +++ /dev/null @@ -1,46 +0,0 @@ - [ - 'capital' => [], - 'circulating' => [], - ], - 'debit' => [ - 'equity' => [], - 'debt' => [], - ], - ]; + private $balance = []; /** * Constructor. @@ -79,72 +62,4 @@ abstract class Balance implements ExchangeInterface { return $this->id; } - - /** - * @param int $id - * - * @return void - * - * @since 1.0.0 - */ - public function setId($id) - { - $this->id = $id; - } - - /** - * {@inheritdoc} - */ - public function exportJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function importJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function importCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function importExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportPdf($path) - { - } - - /** - * {@inheritdoc} - */ - public function importPdf($path) - { - } } diff --git a/Models/BatchPosting.php b/Models/BatchPosting.php index 8e8642c..bd12702 100644 --- a/Models/BatchPosting.php +++ b/Models/BatchPosting.php @@ -14,8 +14,6 @@ declare(strict_types = 1); namespace Modules\Accounting\Models; -use phpOMS\Utils\IO\ExchangeInterface; - /** * BatchPosting class. * @@ -25,7 +23,7 @@ use phpOMS\Utils\IO\ExchangeInterface; * @link http://website.orange-management.de * @since 1.0.0 */ -class BatchPosting implements ExchangeInterface, \Countable +class BatchPosting implements \Countable { /** @@ -42,7 +40,7 @@ class BatchPosting implements ExchangeInterface, \Countable * @var int * @since 1.0.0 */ - private $creator = null; + private $creator = 0; /** * Created. @@ -58,7 +56,7 @@ class BatchPosting implements ExchangeInterface, \Countable * @var string * @since 1.0.0 */ - private $description = null; + private $description = ''; /** * Postings. @@ -75,6 +73,7 @@ class BatchPosting implements ExchangeInterface, \Countable */ public function __construct() { + $this->created = new \DateTime('now'); } /** @@ -89,20 +88,6 @@ class BatchPosting implements ExchangeInterface, \Countable return $this->id; } - /** - * Set id. - * - * @param int $id Batch ID - * - * @return void - * - * @since 1.0.0 - */ - public function setId($id) - { - $this->id = $id; - } - /** * Get description. * @@ -110,7 +95,7 @@ class BatchPosting implements ExchangeInterface, \Countable * * @since 1.0.0 */ - public function getDescription() + public function getDescription() : string { return $this->description; } @@ -124,8 +109,9 @@ class BatchPosting implements ExchangeInterface, \Countable * * @since 1.0.0 */ - public function setDescription($desc) + public function setDescription(string $desc) { + $this->description = $desc; } /** @@ -135,25 +121,11 @@ class BatchPosting implements ExchangeInterface, \Countable * * @since 1.0.0 */ - public function getCreated() + public function getCreatedAt() : \DateTime { return $this->created; } - /** - * Set creator. - * - * @param \Datetime $created Created - * - * @return void - * - * @since 1.0.0 - */ - public function setCreated($created) - { - $this->created = $created; - } - /** * Get creator. * @@ -230,59 +202,4 @@ class BatchPosting implements ExchangeInterface, \Countable return count($this->postings); } - /** - * {@inheritdoc} - */ - public function exportJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function importJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function importCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function importExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportPdf($path) - { - } - - /** - * {@inheritdoc} - */ - public function importPdf($path) - { - } } diff --git a/Models/Creditor.php b/Models/Creditor.php index cef9b70..0fae9ba 100644 --- a/Models/Creditor.php +++ b/Models/Creditor.php @@ -14,8 +14,6 @@ declare(strict_types = 1); namespace Modules\Accounting\Models; -use phpOMS\Utils\IO\ExchangeInterface; - /** * Creditor class. * @@ -25,7 +23,7 @@ use phpOMS\Utils\IO\ExchangeInterface; * @link http://website.orange-management.de * @since 1.0.0 */ -abstract class Creditor implements ExchangeInterface +class Creditor { /** @@ -36,60 +34,4 @@ abstract class Creditor implements ExchangeInterface public function __construct() { } - - /** - * {@inheritdoc} - */ - public function exportJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function importJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function importCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function importExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportPdf($path) - { - } - - /** - * {@inheritdoc} - */ - public function importPdf($path) - { - } } diff --git a/Models/Debitor.php b/Models/Debitor.php index 48c52b5..66fde75 100644 --- a/Models/Debitor.php +++ b/Models/Debitor.php @@ -14,8 +14,6 @@ declare(strict_types = 1); namespace Modules\Accounting\Models; -use phpOMS\Utils\IO\ExchangeInterface; - /** * Debitor class. * @@ -25,7 +23,7 @@ use phpOMS\Utils\IO\ExchangeInterface; * @link http://website.orange-management.de * @since 1.0.0 */ -abstract class Debitor implements ExchangeInterface +class Debitor { /** @@ -37,59 +35,4 @@ abstract class Debitor implements ExchangeInterface { } - /** - * {@inheritdoc} - */ - public function exportJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function importJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function importCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function importExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportPdf($path) - { - } - - /** - * {@inheritdoc} - */ - public function importPdf($path) - { - } } diff --git a/Models/ImpersonalAccount.php b/Models/ImpersonalAccount.php index 30477ba..b51c43b 100644 --- a/Models/ImpersonalAccount.php +++ b/Models/ImpersonalAccount.php @@ -25,7 +25,7 @@ use phpOMS\Utils\IO\ExchangeInterface; * @link http://website.orange-management.de * @since 1.0.0 */ -abstract class ImpersonalAccount implements ExchangeInterface +class ImpersonalAccount { /** @@ -37,59 +37,4 @@ abstract class ImpersonalAccount implements ExchangeInterface { } - /** - * {@inheritdoc} - */ - public function exportJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function importJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function importCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function importExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportPdf($path) - { - } - - /** - * {@inheritdoc} - */ - public function importPdf($path) - { - } } diff --git a/Models/IncomeStatement.php b/Models/IncomeStatement.php index bc1bcab..aee1a73 100644 --- a/Models/IncomeStatement.php +++ b/Models/IncomeStatement.php @@ -14,8 +14,6 @@ declare(strict_types = 1); namespace Modules\Accounting\Models; -use phpOMS\Utils\IO\ExchangeInterface; - /** * IncomeStatement class. * @@ -25,7 +23,7 @@ use phpOMS\Utils\IO\ExchangeInterface; * @link http://website.orange-management.de * @since 1.0.0 */ -abstract class IncomeStatement implements ExchangeInterface +class IncomeStatement { private $id = 0; @@ -36,60 +34,4 @@ abstract class IncomeStatement implements ExchangeInterface public function __construct() { } - - /** - * {@inheritdoc} - */ - public function exportJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function importJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function importCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function importExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportPdf($path) - { - } - - /** - * {@inheritdoc} - */ - public function importPdf($path) - { - } } diff --git a/Models/InvoicePosting.php b/Models/InvoicePosting.php index 08f5996..4996fd3 100644 --- a/Models/InvoicePosting.php +++ b/Models/InvoicePosting.php @@ -14,8 +14,6 @@ declare(strict_types = 1); namespace Modules\Accounting\Models; - - /** * Invoice posting class. * @@ -25,7 +23,7 @@ namespace Modules\Accounting\Models; * @link http://website.orange-management.de * @since 1.0.0 */ -abstract class InvoicePosting extends PostingAbstract +class InvoicePosting extends PostingAbstract { /** @@ -37,59 +35,4 @@ abstract class InvoicePosting extends PostingAbstract { } - /** - * {@inheritdoc} - */ - public function exportJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function importJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function importCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function importExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportPdf($path) - { - } - - /** - * {@inheritdoc} - */ - public function importPdf($path) - { - } } diff --git a/Models/InvoicePostingSimple.php b/Models/InvoicePostingSimple.php index 73646f9..c78624c 100644 --- a/Models/InvoicePostingSimple.php +++ b/Models/InvoicePostingSimple.php @@ -14,8 +14,6 @@ declare(strict_types = 1); namespace Modules\Accounting\Models; - - /** * Invoice posting simple class. * @@ -37,59 +35,4 @@ abstract class InvoicePostingSimple extends PostingAbstract { } - /** - * {@inheritdoc} - */ - public function exportJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function importJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function importCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function importExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportPdf($path) - { - } - - /** - * {@inheritdoc} - */ - public function importPdf($path) - { - } } diff --git a/Models/PersonalAccountAbstract.php b/Models/PersonalAccountAbstract.php index c8737ec..9397010 100644 --- a/Models/PersonalAccountAbstract.php +++ b/Models/PersonalAccountAbstract.php @@ -14,8 +14,6 @@ declare(strict_types = 1); namespace Modules\Accounting\Models; -use phpOMS\Utils\IO\ExchangeInterface; - /** * ImpersonalAccount class. * @@ -25,7 +23,7 @@ use phpOMS\Utils\IO\ExchangeInterface; * @link http://website.orange-management.de * @since 1.0.0 */ -abstract class PersonalAccountAbstract extends AccountAbstract implements ExchangeInterface +abstract class PersonalAccountAbstract extends AccountAbstract { public function __construct(int $id) { @@ -48,59 +46,4 @@ abstract class PersonalAccountAbstract extends AccountAbstract implements Exchan { } - /** - * {@inheritdoc} - */ - public function exportJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function importJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function importCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function importExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportPdf($path) - { - } - - /** - * {@inheritdoc} - */ - public function importPdf($path) - { - } } diff --git a/Models/Posting.php b/Models/Posting.php index 9329aad..edac47d 100644 --- a/Models/Posting.php +++ b/Models/Posting.php @@ -14,8 +14,6 @@ declare(strict_types = 1); namespace Modules\Accounting\Models; - - /** * Posting class. * @@ -37,59 +35,4 @@ abstract class Posting extends PostingAbstract { } - /** - * {@inheritdoc} - */ - public function exportJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function importJson($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function importCsv($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function importExcel($path) - { - } - - /** - * {@inheritdoc} - */ - public function exportPdf($path) - { - } - - /** - * {@inheritdoc} - */ - public function importPdf($path) - { - } } diff --git a/Models/PostingAbstract.php b/Models/PostingAbstract.php index 87a91e9..24cf424 100644 --- a/Models/PostingAbstract.php +++ b/Models/PostingAbstract.php @@ -14,8 +14,6 @@ declare(strict_types = 1); namespace Modules\Accounting\Models; - - /** * Posting abstract class. * diff --git a/Models/PostingInterface.php b/Models/PostingInterface.php index a019dc7..68c42dc 100644 --- a/Models/PostingInterface.php +++ b/Models/PostingInterface.php @@ -14,8 +14,6 @@ declare(strict_types = 1); namespace Modules\Accounting\Models; -use phpOMS\Utils\IO\ExchangeInterface; - /** * Posting interface. * @@ -25,6 +23,6 @@ use phpOMS\Utils\IO\ExchangeInterface; * @link http://website.orange-management.de * @since 1.0.0 */ -interface PostingInterface extends ExchangeInterface +interface PostingInterface { }