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