Files
cake-addresses/tests/TestCase/Controller/SubregionsControllerTest.php
2026-01-23 18:36:15 -08:00

99 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
namespace CakeAddresses\Test\TestCase\Controller;
/**
* CakeAddresses\Controller\SubregionsController Test Case
*
* @uses \CakeAddresses\Controller\SubregionsController
*/
class SubregionsControllerTest extends BaseControllerTest {
/**
* Subregions Table
*
* @var \CakeAddresses\Model\Table\SubregionsTable
*/
protected $Subregions;
/**
* Fixtures
*
* @var array<string>
*/
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->Subregions = $this->getTableLocator()->get('CakeAddresses.Subregions');
$this->enableCsrfToken();
}
/**
* tearDown method
*
* @return void
*/
protected function tearDown(): void {
unset($this->Subregions);
parent::tearDown();
}
/**
* Test index method
*
* Tests the index action with a logged in user
*
* @uses \CakeAddresses\Controller\SubregionsController::index()
* @throws \PHPUnit\Exception
*
* @return void
*/
public function testIndexGet(): void {
$url = [
'plugin' => 'CakeAddresses',
'controller' => 'Subregions',
'action' => 'index',
];
$this->get($url);
$this->assertResponseCode(200);
}
/**
* Test view method
*
* Tests the view action with a logged in user
*
* @uses \CakeAddresses\Controller\SubregionsController::view()
* @throws \PHPUnit\Exception
*
* @return void
*/
public function testViewGet(): void {
$id = 1;
$url = [
'plugin' => 'CakeAddresses',
'controller' => 'Subregions',
'action' => 'view',
$id,
];
$this->get($url);
$this->assertResponseCode(200);
}
}