*/ protected array $fixtures = [ 'plugin.CakeAccounting.DeJournals', 'plugin.CakeAccounting.DeJournalEntries', 'plugin.CakeAccounting.DeJournalItems', ]; /** * setUp method * * @return void */ protected function setUp(): void { parent::setUp(); $this->DeJournalItems = $this->getTableLocator()->get('DeJournalItems'); $this->DeAccounts = $this->getTableLocator()->get('DeAccounts'); } /** * tearDown method * * @return void */ protected function tearDown(): void { unset($this->DeJournalItems); parent::tearDown(); } /** * Test index method * * Tests the index action with an unauthenticated user (not logged in) * * @return void * @throws Exception * * @uses DeJournalItemsController::index */ public function testIndexGetUnauthenticated(): void { $url = [ 'plugin' => 'CakeAccounting', 'controller' => 'DeJournalItems', 'action' => 'index', ]; $this->get($url); $this->assertResponseCode(302); $this->assertRedirectContains('login'); } /** * Test index method * * Tests the index action with a logged in user * * @return void * @throws Exception * * @uses DeJournalItemsController::index */ public function testIndexGetLoggedIn(): void { $this->loginUserByRole('admin'); $url = [ 'plugin' => 'CakeAccounting', 'controller' => 'DeJournalItems', 'action' => 'index', ]; $this->get($url); $this->assertResponseCode(200); } /** * Test view method * * Tests the view action with an unauthenticated user (not logged in) * * @return void * @throws Exception * * @uses DeJournalItemsController::view */ public function testViewGetUnauthenticated(): void { $id = 1; $url = [ 'plugin' => 'CakeAccounting', 'controller' => 'DeJournalItems', 'action' => 'view', $id, ]; $this->get($url); $this->assertResponseCode(302); $this->assertRedirectContains('login'); } /** * Test view method * * Tests the view action with a logged in user * * @return void * @throws Exception * * @uses DeJournalItemsController::view */ public function testViewGetLoggedIn(): void { $id = 1; $this->loginUserByRole('admin'); $url = [ 'plugin' => 'CakeAccounting', 'controller' => 'DeJournalItems', 'action' => 'view', $id, ]; $this->get($url); $this->assertResponseCode(200); } }