*/ protected array $fixtures = [ // 'plugin.CakeAddresses.Regions', // 'plugin.CakeAddresses.Subregions', 'plugin.CakeAddresses.Countries', 'plugin.CakeAddresses.States', // 'plugin.CakeAddresses.Cities', ]; /** * setUp method * * @return void */ protected function setUp(): void { parent::setUp(); $this->States = $this->getTableLocator()->get('States'); $this->enableCsrfToken(); } /** * tearDown method * * @return void */ protected function tearDown(): void { unset($this->States); parent::tearDown(); } /** * Test index method * * Tests the index action with an unauthenticated user (not logged in) * * @uses \CakeAddresses\Controller\StatesController::index() * @throws Exception * * @return void */ public function testIndexGetUnauthenticated(): void { $url = [ 'plugin' => 'CakeAddresses', 'controller' => 'States', 'action' => 'index', ]; $this->get($url); $this->assertResponseCode(302); $this->assertRedirectContains('login'); } /** * Test index method * * Tests the index action with a logged in user * * @uses \CakeAddresses\Controller\StatesController::index() * @throws Exception * * @return void */ public function testIndexGetLoggedIn(): void { $this->loginUserByRole(); $url = [ 'plugin' => 'CakeAddresses', 'controller' => 'States', 'action' => 'index', ]; $this->get($url); $this->assertResponseCode(200); } /** * Test view method * * Tests the view action with an unauthenticated user (not logged in) * * @uses \CakeAddresses\Controller\StatesController::view() * @throws Exception * * @return void */ public function testViewGetUnauthenticated(): void { $id = 1462; $url = [ 'plugin' => 'CakeAddresses', 'controller' => 'States', 'action' => 'view', $id, ]; $this->get($url); $this->assertResponseCode(302); $this->assertRedirectContains('login'); } /** * Test view method * * Tests the view action with a logged in user * * @uses \CakeAddresses\Controller\StatesController::view() * @throws Exception * * @return void */ public function testViewGetLoggedIn(): void { $id = 1462; $this->loginUserByRole(); $url = [ 'plugin' => 'CakeAddresses', 'controller' => 'States', 'action' => 'view', $id, ]; $this->get($url); $this->assertResponseCode(200); } }