CakeAccounting/tests/TestCase/Controller/DeAccountStatementsControll...

106 lines
2.5 KiB
PHP
Raw Normal View History

2025-08-09 21:07:39 +00:00
<?php
declare(strict_types=1);
namespace CakeAccounting\Test\TestCase\Controller;
use Cake\ORM\Table;
use CakeAccounting\Controller\DeAccountStatementsController;
use CakeAccounting\Model\Table\DeAccountStatementsTable;
use CakeAccounting\Model\Table\DeExternalAccountsTable;
2025-08-09 21:07:39 +00:00
use PHPUnit\Exception;
/**
* CakeAccounting\Controller\DeAccountStatementsController Test Case
*
* @uses DeAccountStatementsController
*/
class DeAccountStatementsControllerTest extends BaseControllerTest
{
/**
* @var $DeAccountStatementsTable|Table
*/
protected DeAccountStatementsTable|Table $DeAccountStatements;
/**
* Fixtures
*
* @var array<string>
*/
protected array $fixtures = [
'plugin.CakeAccounting.DeAccountStatements',
];
/**
* setUp method
*
* @return void
*/
protected function setUp(): void
{
parent::setUp();
// $this->enableCsrfToken();
// $this->enableSecurityToken();
$this->disableErrorHandlerMiddleware();
$config = $this->getTableLocator()->exists('DeAccountStatements') ? [] : ['className' => DeAccountStatementsTable::class];
$this->DeAccountStatements = $this->getTableLocator()->get('DeAccountStatements', $config);
2025-08-09 21:07:39 +00:00
}
/**
* tearDown method
*
* @return void
*/
protected function tearDown(): void
{
unset($this->DeAccountStatements);
parent::tearDown();
}
/**
* Test index method
*
* Tests the index action with a logged in user
*
* @return void
* @throws Exception
*
* @uses DeAccountStatementsController::index
*/
public function testIndexGetLoggedIn(): void
{
//$this->loginUserByRole('admin');
2025-08-09 21:07:39 +00:00
$url = [
'plugin' => 'CakeAccounting',
'controller' => 'DeAccountStatements',
'action' => 'index',
];
$this->get($url);
$this->assertResponseCode(200);
}
/**
* Test view method
*
* Tests the view action with a logged in user
*
* @return void
* @throws Exception
*
* @uses DeAccountStatementsController::view
*/
public function testViewGetLoggedIn(): void
{
$id = '4614401e-fe0c-45cf-9f17-c45c7848960e';
//$this->loginUserByRole('admin');
2025-08-09 21:07:39 +00:00
$url = [
'plugin' => 'CakeAccounting',
'controller' => 'DeAccountStatements',
'action' => 'view',
$id,
];
$this->get($url);
$this->assertResponseCode(200);
}
}