112 lines
2.8 KiB
PHP
112 lines
2.8 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace CakeAccounting\Test\TestCase\Model\Table;
|
|
|
|
use Cake\TestSuite\TestCase;
|
|
use CakeAccounting\Model\Table\DeJournalItemsTable;
|
|
|
|
/**
|
|
* CakeAccounting\Model\Table\DeJournalItemsTable Test Case
|
|
*/
|
|
class DeJournalItemsTableTest extends TestCase
|
|
{
|
|
/**
|
|
* Test subject
|
|
*
|
|
* @var \CakeAccounting\Model\Table\DeJournalItemsTable
|
|
*/
|
|
protected $DeJournalItems;
|
|
|
|
/**
|
|
* Fixtures
|
|
*
|
|
* @var array<string>
|
|
*/
|
|
protected array $fixtures = [
|
|
'plugin.CakeAccounting.DeJournalItems',
|
|
'plugin.CakeAccounting.DeJournalEntries',
|
|
];
|
|
|
|
/**
|
|
* setUp method
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
$config = $this->getTableLocator()->exists('DeJournalItems') ? [] : ['className' => DeJournalItemsTable::class];
|
|
$this->DeJournalItems = $this->getTableLocator()->get('DeJournalItems', $config);
|
|
}
|
|
|
|
/**
|
|
* tearDown method
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function tearDown(): void
|
|
{
|
|
unset($this->DeJournalItems);
|
|
|
|
parent::tearDown();
|
|
}
|
|
|
|
/**
|
|
* TestInitialize method
|
|
*
|
|
* @return void
|
|
* @uses \CakeAccounting\Model\Table\DeJournalItemsTable::initialize()
|
|
*/
|
|
public function testInitialize(): void
|
|
{
|
|
// verify all associations loaded
|
|
$expectedAssociations = [
|
|
'DeJournalEntries',
|
|
'CreditDeAccounts',
|
|
'DebitDeAccounts',
|
|
'CreditDeExternalAccounts',
|
|
'DebitDeExternalAccounts',
|
|
];
|
|
$associations = $this->DeJournalItems->associations();
|
|
|
|
$this->assertCount(count($expectedAssociations), $associations);
|
|
foreach ($expectedAssociations as $expectedAssociation) {
|
|
$this->assertTrue($this->DeJournalItems->hasAssociation($expectedAssociation));
|
|
}
|
|
|
|
// verify all behaviors loaded
|
|
$expectedBehaviors = [
|
|
'Timestamp',
|
|
];
|
|
$behaviors = $this->DeJournalItems->behaviors();
|
|
|
|
$this->assertCount(count($expectedBehaviors), $behaviors);
|
|
foreach ($expectedBehaviors as $expectedBehavior) {
|
|
$this->assertTrue($this->DeJournalItems->hasBehavior($expectedBehavior));
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Test validationDefault method
|
|
*
|
|
* @return void
|
|
* @uses \CakeAccounting\Model\Table\DeJournalItemsTable::validationDefault()
|
|
*/
|
|
public function testValidationDefault(): void
|
|
{
|
|
$this->markTestIncomplete('Not implemented yet.');
|
|
}
|
|
|
|
/**
|
|
* Test buildRules method
|
|
*
|
|
* @return void
|
|
* @uses \CakeAccounting\Model\Table\DeJournalItemsTable::buildRules()
|
|
*/
|
|
public function testBuildRules(): void
|
|
{
|
|
$this->markTestIncomplete('Not implemented yet.');
|
|
}
|
|
}
|