*/ protected array $fixtures = [ 'plugin.CakeAccounting.DeExternalAccountStatements', ]; /** * setUp method * * @return void */ protected function setUp(): void { parent::setUp(); $this->DeExternalAccountStatements = $this->getTableLocator()->get('DeExternalAccountStatements'); } /** * tearDown method * * @return void */ protected function tearDown(): void { unset($this->DeExternalAccountStatements); parent::tearDown(); } /** * Test index method * * Tests the index action with an unauthenticated user (not logged in) * * @return void * @throws Exception * * @uses DeExternalAccountStatementsController::index */ public function testIndexGetUnauthenticated(): void { $url = [ 'plugin' => 'CakeAccounting', 'controller' => 'DeExternalAccountStatements', '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 DeExternalAccountStatementsController::index */ public function testIndexGetLoggedIn(): void { $this->loginUserByRole('admin'); $url = [ 'plugin' => 'CakeAccounting', 'controller' => 'DeExternalAccountStatements', '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 DeExternalAccountStatementsController::view */ public function testViewGetUnauthenticated(): void { $id = '2f83162b-2bec-4826-8853-fbda2fac3a95'; $url = [ 'plugin' => 'CakeAccounting', 'controller' => 'DeExternalAccountStatements', '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 DeExternalAccountStatementsController::view */ public function testViewGetLoggedIn(): void { $id = '2f83162b-2bec-4826-8853-fbda2fac3a95'; $this->loginUserByRole('admin'); $url = [ 'plugin' => 'CakeAccounting', 'controller' => 'DeExternalAccountStatements', 'action' => 'view', $id, ]; $this->get($url); $this->assertResponseCode(200); } }