Files
cake-addresses/tests/TestCase/Controller/StatesControllerTest.php

97 lines
1.8 KiB
PHP
Raw Permalink Normal View History

2025-11-18 00:43:34 -08:00
<?php
declare(strict_types=1);
namespace CakeAddresses\Test\TestCase\Controller;
/**
* CakeAddresses\Controller\StatesController Test Case
*
* @uses \CakeAddresses\Controller\StatesController
*/
2026-01-23 18:36:15 -08:00
class StatesControllerTest extends BaseControllerTest {
/**
2025-11-18 00:43:34 -08:00
* States Table
*
* @var \CakeAddresses\Model\Table\StatesTable
*/
2026-01-23 18:36:15 -08:00
protected $States;
/**
2025-11-18 00:43:34 -08:00
* Fixtures
*
* @var array<string>
*/
2026-01-23 18:36:15 -08:00
protected array $fixtures = [
2025-11-18 00:43:34 -08:00
// 'plugin.CakeAddresses.Regions',
// 'plugin.CakeAddresses.Subregions',
2026-01-23 18:36:15 -08:00
'plugin.CakeAddresses.Countries',
'plugin.CakeAddresses.States',
2025-11-18 00:43:34 -08:00
// 'plugin.CakeAddresses.Cities',
2026-01-23 18:36:15 -08:00
];
2025-11-18 00:43:34 -08:00
2026-01-23 18:36:15 -08:00
/**
2025-11-18 00:43:34 -08:00
* setUp method
*
* @return void
*/
2026-01-23 18:36:15 -08:00
protected function setUp(): void {
parent::setUp();
$this->States = $this->getTableLocator()->get('CakeAddresses.States');
}
2025-11-18 00:43:34 -08:00
2026-01-23 18:36:15 -08:00
/**
2025-11-18 00:43:34 -08:00
* tearDown method
*
* @return void
*/
2026-01-23 18:36:15 -08:00
protected function tearDown(): void {
unset($this->States);
2025-11-18 00:43:34 -08:00
2026-01-23 18:36:15 -08:00
parent::tearDown();
}
2025-11-18 00:43:34 -08:00
2026-01-23 18:36:15 -08:00
/**
2025-11-18 00:43:34 -08:00
* Test index method
*
* Tests the index action with a logged in user
*
* @uses \CakeAddresses\Controller\StatesController::index()
2026-01-23 18:36:15 -08:00
* @throws \PHPUnit\Exception
2025-11-18 00:43:34 -08:00
*
* @return void
*/
2026-01-23 18:36:15 -08:00
public function testIndexGet(): void {
$url = [
'plugin' => 'CakeAddresses',
'controller' => 'States',
'action' => 'index',
];
$this->get($url);
$this->assertResponseCode(200);
}
2025-11-18 00:43:34 -08:00
2026-01-23 18:36:15 -08:00
/**
2025-11-18 00:43:34 -08:00
* Test view method
*
* Tests the view action with a logged in user
*
* @uses \CakeAddresses\Controller\StatesController::view()
2026-01-23 18:36:15 -08:00
* @throws \PHPUnit\Exception
2025-11-18 00:43:34 -08:00
*
* @return void
*/
2026-01-23 18:36:15 -08:00
public function testViewGet(): void {
$id = 1462;
$url = [
'plugin' => 'CakeAddresses',
'controller' => 'States',
'action' => 'view',
$id,
];
$this->get($url);
$this->assertResponseCode(200);
}
2025-11-18 00:43:34 -08:00
}