phpcs phpcbf
This commit is contained in:
@@ -3,347 +3,333 @@ declare(strict_types=1);
|
||||
|
||||
namespace CakeAddresses\Test\TestCase\Controller;
|
||||
|
||||
use CakeAddresses\Controller\AddressesController;
|
||||
use CakeAddresses\Model\Table\AddressesTable;
|
||||
use PHPUnit\Exception;
|
||||
|
||||
/**
|
||||
* CakeAddresses\Controller\AddressesController Test Case
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\AddressesController
|
||||
*/
|
||||
class AddressesControllerTest extends BaseControllerTest
|
||||
{
|
||||
/**
|
||||
class AddressesControllerTest extends BaseControllerTest {
|
||||
|
||||
/**
|
||||
* Addresses Table
|
||||
*
|
||||
* @var \CakeAddresses\Model\Table\AddressesTable
|
||||
*/
|
||||
protected $Addresses;
|
||||
protected $Addresses;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Addresses',
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Addresses',
|
||||
// 'plugin.CakeAddresses.Cities',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
// 'plugin.CakeAddresses.Regions',
|
||||
'plugin.CakeAddresses.States',
|
||||
'plugin.CakeAddresses.States',
|
||||
// 'plugin.CakeAddresses.Subregions',
|
||||
];
|
||||
];
|
||||
|
||||
/**
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->Addresses = $this->getTableLocator()->get('CakeAddresses.Addresses');
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->Addresses = $this->getTableLocator()->get('CakeAddresses.Addresses');
|
||||
// $this->enableCsrfToken();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
unset($this->Addresses);
|
||||
protected function tearDown(): void {
|
||||
unset($this->Addresses);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
* Tests the index action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\AddressesController::index()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testIndexGet(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
public function testIndexGet(): void {
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'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\AddressesController::view()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testViewGet(): void
|
||||
{
|
||||
$id = 1;
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
public function testViewGet(): void {
|
||||
$id = 1;
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test add method
|
||||
*
|
||||
* Tests the add action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\AddressesController::add()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddGet(): void
|
||||
{
|
||||
$cntBefore = $this->Addresses->find()->count();
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'add',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
public function testAddGet(): void {
|
||||
$cntBefore = $this->Addresses->find()->count();
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'add',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
|
||||
$cntAfter = $this->Addresses->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
$cntAfter = $this->Addresses->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test add method
|
||||
*
|
||||
* Tests a POST request to the add action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\AddressesController::add()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddPostSuccess(): void
|
||||
{
|
||||
$cntBefore = $this->Addresses->find()->count();
|
||||
public function testAddPostSuccess(): void {
|
||||
$cntBefore = $this->Addresses->find()->count();
|
||||
|
||||
$this->loginUserByRole();
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'add',
|
||||
];
|
||||
$data = [
|
||||
'address_name' => 'new address',
|
||||
'contact_name' => 'john doe',
|
||||
'address_line1' => '123 Test ST',
|
||||
'address_line2' => '',
|
||||
'city' => 'Seattle',
|
||||
'city_id' => '',
|
||||
'state_id' => 1462,
|
||||
'postal_code' => '98056',
|
||||
'country_id' => 233,
|
||||
'phone_number' => '',
|
||||
'email' => '',
|
||||
'notes' => '',
|
||||
];
|
||||
$this->post($url, $data);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('addresses');
|
||||
$this->loginUserByRole();
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'add',
|
||||
];
|
||||
$data = [
|
||||
'address_name' => 'new address',
|
||||
'contact_name' => 'john doe',
|
||||
'address_line1' => '123 Test ST',
|
||||
'address_line2' => '',
|
||||
'city' => 'Seattle',
|
||||
'city_id' => '',
|
||||
'state_id' => 1462,
|
||||
'postal_code' => '98056',
|
||||
'country_id' => 233,
|
||||
'phone_number' => '',
|
||||
'email' => '',
|
||||
'notes' => '',
|
||||
];
|
||||
$this->post($url, $data);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('addresses');
|
||||
|
||||
$cntAfter = $this->Addresses->find()->count();
|
||||
$this->assertEquals($cntBefore + 1, $cntAfter);
|
||||
}
|
||||
$cntAfter = $this->Addresses->find()->count();
|
||||
$this->assertEquals($cntBefore + 1, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test add method
|
||||
*
|
||||
* Tests a POST request to the add action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\AddressesController::add()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddPostFailure(): void
|
||||
{
|
||||
$cntBefore = $this->Addresses->find()->count();
|
||||
public function testAddPostFailure(): void {
|
||||
$cntBefore = $this->Addresses->find()->count();
|
||||
|
||||
$this->loginUserByRole();
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'add',
|
||||
];
|
||||
$data = [
|
||||
'address_name' => '',
|
||||
'contact_name' => '',
|
||||
'address_line1' => '',
|
||||
'address_line2' => '',
|
||||
'city' => 'Seattle',
|
||||
'city_id' => '',
|
||||
'state_id' => 1462,
|
||||
'postal_code' => '98056',
|
||||
'country_id' => 233,
|
||||
'phone_number' => '',
|
||||
'email' => '',
|
||||
'notes' => '',
|
||||
];
|
||||
$this->post($url, $data);
|
||||
$this->assertResponseCode(200);
|
||||
$this->loginUserByRole();
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'add',
|
||||
];
|
||||
$data = [
|
||||
'address_name' => '',
|
||||
'contact_name' => '',
|
||||
'address_line1' => '',
|
||||
'address_line2' => '',
|
||||
'city' => 'Seattle',
|
||||
'city_id' => '',
|
||||
'state_id' => 1462,
|
||||
'postal_code' => '98056',
|
||||
'country_id' => 233,
|
||||
'phone_number' => '',
|
||||
'email' => '',
|
||||
'notes' => '',
|
||||
];
|
||||
$this->post($url, $data);
|
||||
$this->assertResponseCode(200);
|
||||
|
||||
$cntAfter = $this->Addresses->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
$cntAfter = $this->Addresses->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test edit method
|
||||
*
|
||||
* Tests the edit action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\AddressesController::edit()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testEditGet(): void
|
||||
{
|
||||
$id = 1;
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'edit',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
public function testEditGet(): void {
|
||||
$id = 1;
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'edit',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test edit method
|
||||
*
|
||||
* Tests a PUT request to the edit action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\AddressesController::edit()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testEditPutSuccess(): void
|
||||
{
|
||||
$this->loginUserByRole();
|
||||
$id = 1;
|
||||
$before = $this->Addresses->get($id);
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'edit',
|
||||
$id,
|
||||
];
|
||||
$data = [
|
||||
// test new data here
|
||||
'address_name' => 'new address',
|
||||
'contact_name' => 'john doe',
|
||||
'address_line1' => '123 Test ST',
|
||||
'address_line2' => '',
|
||||
'city' => 'Seattle',
|
||||
'city_id' => '',
|
||||
'state_id' => 1462,
|
||||
'postal_code' => '98056',
|
||||
'country_id' => 233,
|
||||
'phone_number' => '',
|
||||
'email' => '',
|
||||
'notes' => '',
|
||||
];
|
||||
$this->put($url, $data);
|
||||
public function testEditPutSuccess(): void {
|
||||
$this->loginUserByRole();
|
||||
$id = 1;
|
||||
$before = $this->Addresses->get($id);
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'edit',
|
||||
$id,
|
||||
];
|
||||
$data = [
|
||||
// test new data here
|
||||
'address_name' => 'new address',
|
||||
'contact_name' => 'john doe',
|
||||
'address_line1' => '123 Test ST',
|
||||
'address_line2' => '',
|
||||
'city' => 'Seattle',
|
||||
'city_id' => '',
|
||||
'state_id' => 1462,
|
||||
'postal_code' => '98056',
|
||||
'country_id' => 233,
|
||||
'phone_number' => '',
|
||||
'email' => '',
|
||||
'notes' => '',
|
||||
];
|
||||
$this->put($url, $data);
|
||||
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('addresses');
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('addresses');
|
||||
|
||||
$after = $this->Addresses->get($id);
|
||||
// assert saved properly below
|
||||
}
|
||||
$after = $this->Addresses->get($id);
|
||||
// assert saved properly below
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test edit method
|
||||
*
|
||||
* Tests a PUT request to the edit action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\AddressesController::edit()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testEditPutFailure(): void
|
||||
{
|
||||
$id = 1;
|
||||
$before = $this->Addresses->get($id);
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'edit',
|
||||
$id,
|
||||
];
|
||||
$data = [
|
||||
'address_name' => '',
|
||||
'contact_name' => '',
|
||||
'address_line1' => '',
|
||||
'address_line2' => '',
|
||||
'city' => 'Seattle',
|
||||
'city_id' => '',
|
||||
'state_id' => 1462,
|
||||
'postal_code' => '98056',
|
||||
'country_id' => 233,
|
||||
'phone_number' => '',
|
||||
'email' => '',
|
||||
'notes' => '',
|
||||
];
|
||||
$this->put($url, $data);
|
||||
$this->assertResponseCode(200);
|
||||
$after = $this->Addresses->get($id);
|
||||
public function testEditPutFailure(): void {
|
||||
$id = 1;
|
||||
$before = $this->Addresses->get($id);
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'edit',
|
||||
$id,
|
||||
];
|
||||
$data = [
|
||||
'address_name' => '',
|
||||
'contact_name' => '',
|
||||
'address_line1' => '',
|
||||
'address_line2' => '',
|
||||
'city' => 'Seattle',
|
||||
'city_id' => '',
|
||||
'state_id' => 1462,
|
||||
'postal_code' => '98056',
|
||||
'country_id' => 233,
|
||||
'phone_number' => '',
|
||||
'email' => '',
|
||||
'notes' => '',
|
||||
];
|
||||
$this->put($url, $data);
|
||||
$this->assertResponseCode(200);
|
||||
$after = $this->Addresses->get($id);
|
||||
|
||||
// assert save failed below
|
||||
}
|
||||
// assert save failed below
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test delete method
|
||||
*
|
||||
* Tests the delete action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\AddressesController::delete()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDelete(): void
|
||||
{
|
||||
$cntBefore = $this->Addresses->find()->count();
|
||||
public function testDelete(): void {
|
||||
$cntBefore = $this->Addresses->find()->count();
|
||||
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'delete',
|
||||
1,
|
||||
];
|
||||
$this->delete($url);
|
||||
$this->assertResponseCode(302);
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'delete',
|
||||
1,
|
||||
];
|
||||
$this->delete($url);
|
||||
$this->assertResponseCode(302);
|
||||
|
||||
$cntAfter = $this->Addresses->find()->count();
|
||||
$this->assertEquals($cntBefore - 1, $cntAfter);
|
||||
}
|
||||
|
||||
$cntAfter = $this->Addresses->find()->count();
|
||||
$this->assertEquals($cntBefore - 1, $cntAfter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,21 +5,24 @@ namespace CakeAddresses\Test\TestCase\Controller;
|
||||
use Cake\TestSuite\IntegrationTestTrait;
|
||||
use Cake\TestSuite\TestCase;
|
||||
|
||||
class BaseControllerTest extends TestCase
|
||||
{
|
||||
use IntegrationTestTrait;
|
||||
class BaseControllerTest extends TestCase {
|
||||
|
||||
public function loginUserByRole(string $role = 'admin'): void
|
||||
{
|
||||
$this->session(['Auth.User.id' => 1]);
|
||||
$this->session(['Auth.id' => 1]);
|
||||
}
|
||||
use IntegrationTestTrait;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param string $role - role name - makes testing different roles easier
|
||||
* @return void
|
||||
*/
|
||||
public function testTest()
|
||||
{
|
||||
$this->assertEquals(1, 1);
|
||||
}
|
||||
public function loginUserByRole(string $role = 'admin'): void {
|
||||
$this->session(['Auth.User.id' => 1]);
|
||||
$this->session(['Auth.id' => 1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testTest() {
|
||||
$this->assertEquals(1, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,77 +3,72 @@ declare(strict_types=1);
|
||||
|
||||
namespace CakeAddresses\Test\TestCase\Controller;
|
||||
|
||||
use CakeAddresses\Controller\CitiesController;
|
||||
use PHPUnit\Exception;
|
||||
|
||||
/**
|
||||
* CakeAddresses\Controller\CitiesController Test Case
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\CitiesController
|
||||
*/
|
||||
class CitiesControllerTest extends BaseControllerTest
|
||||
{
|
||||
/**
|
||||
class CitiesControllerTest extends BaseControllerTest {
|
||||
|
||||
/**
|
||||
* Cities Table
|
||||
*
|
||||
* @var \CakeAddresses\Model\Table\CitiesTable
|
||||
*/
|
||||
protected $Cities;
|
||||
protected $Cities;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
protected array $fixtures = [
|
||||
// 'plugin.CakeAddresses.Regions',
|
||||
// 'plugin.CakeAddresses.Subregions',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
'plugin.CakeAddresses.States',
|
||||
'plugin.CakeAddresses.Cities',
|
||||
];
|
||||
'plugin.CakeAddresses.Countries',
|
||||
'plugin.CakeAddresses.States',
|
||||
'plugin.CakeAddresses.Cities',
|
||||
];
|
||||
|
||||
/**
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->Cities = $this->getTableLocator()->get('CakeAddresses.Cities');
|
||||
}
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->Cities = $this->getTableLocator()->get('CakeAddresses.Cities');
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
unset($this->Cities);
|
||||
protected function tearDown(): void {
|
||||
unset($this->Cities);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test select method
|
||||
*
|
||||
* Tests the select action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\CitiesController::select()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSelect(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Cities',
|
||||
'action' => 'select',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
public function testSelect(): void {
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Cities',
|
||||
'action' => 'select',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,100 +3,94 @@ declare(strict_types=1);
|
||||
|
||||
namespace CakeAddresses\Test\TestCase\Controller;
|
||||
|
||||
use CakeAddresses\Controller\CountriesController;
|
||||
use PHPUnit\Exception;
|
||||
|
||||
/**
|
||||
* CakeAddresses\Controller\CountriesController Test Case
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\CountriesController
|
||||
*/
|
||||
class CountriesControllerTest extends BaseControllerTest
|
||||
{
|
||||
/**
|
||||
class CountriesControllerTest extends BaseControllerTest {
|
||||
|
||||
/**
|
||||
* AnsibleGroups Table
|
||||
*
|
||||
* @var \CakeAddresses\Model\Table\CountriesTable
|
||||
*/
|
||||
protected $Countries;
|
||||
protected $Countries;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Regions',
|
||||
'plugin.CakeAddresses.Subregions',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
'plugin.CakeAddresses.States',
|
||||
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->Countries = $this->getTableLocator()->get('CakeAddresses.Countries');
|
||||
}
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->Countries = $this->getTableLocator()->get('CakeAddresses.Countries');
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
unset($this->Countries);
|
||||
protected function tearDown(): void {
|
||||
unset($this->Countries);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
* Tests the index action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\CountriesController::index()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testIndexGet(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Countries',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
public function testIndexGet(): void {
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Countries',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
* Tests the view action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\CountriesController::view()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testViewGet(): void
|
||||
{
|
||||
$id = 233;
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Countries',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
public function testViewGet(): void {
|
||||
$id = 233;
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Countries',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,103 +3,95 @@ declare(strict_types=1);
|
||||
|
||||
namespace CakeAddresses\Test\TestCase\Controller;
|
||||
|
||||
use Cake\TestSuite\IntegrationTestTrait;
|
||||
use Cake\TestSuite\TestCase;
|
||||
use CakeAddresses\Controller\RegionsController;
|
||||
use PHPUnit\Exception;
|
||||
|
||||
/**
|
||||
* CakeAddresses\Controller\RegionsController Test Case
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\RegionsController
|
||||
*/
|
||||
class RegionsControllerTest extends BaseControllerTest
|
||||
{
|
||||
/**
|
||||
class RegionsControllerTest extends BaseControllerTest {
|
||||
|
||||
/**
|
||||
* Regions Table
|
||||
*
|
||||
* @var \CakeAddresses\Model\Table\RegionsTable
|
||||
*/
|
||||
protected $Regions;
|
||||
protected $Regions;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Regions',
|
||||
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->Regions = $this->getTableLocator()->get('CakeAddresses.Regions');
|
||||
}
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->Regions = $this->getTableLocator()->get('CakeAddresses.Regions');
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
unset($this->Regions);
|
||||
protected function tearDown(): void {
|
||||
unset($this->Regions);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
* Tests the index action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\RegionsController::index()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testIndexGet(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Regions',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
public function testIndexGet(): void {
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Regions',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
* Tests the view action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\RegionsController::view()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testViewGet(): void
|
||||
{
|
||||
$id = 1;
|
||||
public function testViewGet(): void {
|
||||
$id = 1;
|
||||
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Regions',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Regions',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,99 +3,94 @@ declare(strict_types=1);
|
||||
|
||||
namespace CakeAddresses\Test\TestCase\Controller;
|
||||
|
||||
use CakeAddresses\Controller\StatesController;
|
||||
use PHPUnit\Exception;
|
||||
|
||||
/**
|
||||
* CakeAddresses\Controller\StatesController Test Case
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\StatesController
|
||||
*/
|
||||
class StatesControllerTest extends BaseControllerTest
|
||||
{
|
||||
/**
|
||||
class StatesControllerTest extends BaseControllerTest {
|
||||
|
||||
/**
|
||||
* States Table
|
||||
*
|
||||
* @var \CakeAddresses\Model\Table\StatesTable
|
||||
*/
|
||||
protected $States;
|
||||
/**
|
||||
protected $States;
|
||||
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
protected array $fixtures = [
|
||||
// 'plugin.CakeAddresses.Regions',
|
||||
// 'plugin.CakeAddresses.Subregions',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
'plugin.CakeAddresses.States',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
'plugin.CakeAddresses.States',
|
||||
// 'plugin.CakeAddresses.Cities',
|
||||
];
|
||||
];
|
||||
|
||||
/**
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->States = $this->getTableLocator()->get('CakeAddresses.States');
|
||||
}
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->States = $this->getTableLocator()->get('CakeAddresses.States');
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
unset($this->States);
|
||||
protected function tearDown(): void {
|
||||
unset($this->States);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
* Tests the index action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\StatesController::index()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testIndexGet(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'States',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
public function testIndexGet(): void {
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'States',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
* Tests the view action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\StatesController::view()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testViewGet(): void
|
||||
{
|
||||
$id = 1462;
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'States',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
public function testViewGet(): void {
|
||||
$id = 1462;
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'States',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,104 +3,96 @@ declare(strict_types=1);
|
||||
|
||||
namespace CakeAddresses\Test\TestCase\Controller;
|
||||
|
||||
use Cake\TestSuite\IntegrationTestTrait;
|
||||
use Cake\TestSuite\TestCase;
|
||||
use CakeAddresses\Controller\SubregionsController;
|
||||
use PHPUnit\Exception;
|
||||
|
||||
/**
|
||||
* CakeAddresses\Controller\SubregionsController Test Case
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\SubregionsController
|
||||
*/
|
||||
class SubregionsControllerTest extends BaseControllerTest
|
||||
{
|
||||
/**
|
||||
class SubregionsControllerTest extends BaseControllerTest {
|
||||
|
||||
/**
|
||||
* Subregions Table
|
||||
*
|
||||
* @var \CakeAddresses\Model\Table\SubregionsTable
|
||||
*/
|
||||
protected $Subregions;
|
||||
protected $Subregions;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Regions',
|
||||
'plugin.CakeAddresses.Subregions',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
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();
|
||||
}
|
||||
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);
|
||||
protected function tearDown(): void {
|
||||
unset($this->Subregions);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
* Tests the index action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\SubregionsController::index()
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testIndexGet(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Subregions',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
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 Exception
|
||||
* @throws \PHPUnit\Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testViewGet(): void
|
||||
{
|
||||
$id = 1;
|
||||
public function testViewGet(): void {
|
||||
$id = 1;
|
||||
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Subregions',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Subregions',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,103 +9,97 @@ use CakeAddresses\Model\Table\AddressesTable;
|
||||
/**
|
||||
* CakeAddresses\Model\Table\AddressesTable Test Case
|
||||
*/
|
||||
class AddressesTableTest extends TestCase
|
||||
{
|
||||
/**
|
||||
class AddressesTableTest extends TestCase {
|
||||
|
||||
/**
|
||||
* Test subject
|
||||
*
|
||||
* @var \CakeAddresses\Model\Table\AddressesTable
|
||||
*/
|
||||
protected $Addresses;
|
||||
protected $Addresses;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Addresses',
|
||||
'plugin.CakeAddresses.Cities',
|
||||
'plugin.CakeAddresses.States',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
];
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Addresses',
|
||||
'plugin.CakeAddresses.Cities',
|
||||
'plugin.CakeAddresses.States',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
];
|
||||
|
||||
/**
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$config = $this->getTableLocator()->exists('Addresses') ? [] : ['className' => AddressesTable::class];
|
||||
$this->Addresses = $this->getTableLocator()->get('Addresses', $config);
|
||||
}
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$config = $this->getTableLocator()->exists('Addresses') ? [] : ['className' => AddressesTable::class];
|
||||
$this->Addresses = $this->getTableLocator()->get('Addresses', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* TestInitialize method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\AddressesTable::initialize()
|
||||
* @return void
|
||||
*/
|
||||
public function testInitialize(): void
|
||||
{
|
||||
// verify all associations loaded
|
||||
$expectedAssociations = [
|
||||
'Cities',
|
||||
'States',
|
||||
'Countries',
|
||||
];
|
||||
$associations = $this->Addresses->associations();
|
||||
public function testInitialize(): void {
|
||||
// verify all associations loaded
|
||||
$expectedAssociations = [
|
||||
'Cities',
|
||||
'States',
|
||||
'Countries',
|
||||
];
|
||||
$associations = $this->Addresses->associations();
|
||||
|
||||
$this->assertCount(count($expectedAssociations), $associations);
|
||||
foreach ($expectedAssociations as $expectedAssociation) {
|
||||
$this->assertTrue($this->Addresses->hasAssociation($expectedAssociation), 'Failed asserting Addresses has the association: ' . $expectedAssociation);
|
||||
}
|
||||
$this->assertCount(count($expectedAssociations), $associations);
|
||||
foreach ($expectedAssociations as $expectedAssociation) {
|
||||
$this->assertTrue($this->Addresses->hasAssociation($expectedAssociation), 'Failed asserting Addresses has the association: ' . $expectedAssociation);
|
||||
}
|
||||
|
||||
// verify all behaviors loaded
|
||||
$expectedBehaviors = [
|
||||
];
|
||||
$behaviors = $this->Addresses->behaviors();
|
||||
// verify all behaviors loaded
|
||||
$expectedBehaviors = [];
|
||||
$behaviors = $this->Addresses->behaviors();
|
||||
|
||||
$this->assertCount(count($expectedBehaviors), $behaviors);
|
||||
foreach ($expectedBehaviors as $expectedBehavior) {
|
||||
$this->assertTrue($this->Addresses->hasBehavior($expectedBehavior));
|
||||
}
|
||||
}
|
||||
$this->assertCount(count($expectedBehaviors), $behaviors);
|
||||
foreach ($expectedBehaviors as $expectedBehavior) {
|
||||
$this->assertTrue($this->Addresses->hasBehavior($expectedBehavior));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
unset($this->Addresses);
|
||||
protected function tearDown(): void {
|
||||
unset($this->Addresses);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test validationDefault method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\AddressesTable::validationDefault()
|
||||
* @return void
|
||||
*/
|
||||
public function testValidationDefault(): void
|
||||
{
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
public function testValidationDefault(): void {
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test buildRules method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\AddressesTable::buildRules()
|
||||
* @return void
|
||||
*/
|
||||
public function testBuildRules(): void
|
||||
{
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
public function testBuildRules(): void {
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,103 +9,97 @@ use CakeAddresses\Model\Table\CitiesTable;
|
||||
/**
|
||||
* CakeAddresses\Model\Table\CitiesTable Test Case
|
||||
*/
|
||||
class CitiesTableTest extends TestCase
|
||||
{
|
||||
/**
|
||||
class CitiesTableTest extends TestCase {
|
||||
|
||||
/**
|
||||
* Test subject
|
||||
*
|
||||
* @var \CakeAddresses\Model\Table\CitiesTable
|
||||
*/
|
||||
protected $Cities;
|
||||
protected $Cities;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Cities',
|
||||
'plugin.CakeAddresses.States',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
'plugin.CakeAddresses.Addresses',
|
||||
];
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Cities',
|
||||
'plugin.CakeAddresses.States',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
'plugin.CakeAddresses.Addresses',
|
||||
];
|
||||
|
||||
/**
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$config = $this->getTableLocator()->exists('Cities') ? [] : ['className' => CitiesTable::class];
|
||||
$this->Cities = $this->getTableLocator()->get('Cities', $config);
|
||||
}
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$config = $this->getTableLocator()->exists('Cities') ? [] : ['className' => CitiesTable::class];
|
||||
$this->Cities = $this->getTableLocator()->get('Cities', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
unset($this->Cities);
|
||||
protected function tearDown(): void {
|
||||
unset($this->Cities);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* TestInitialize method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\CitiesTable::initialize()
|
||||
* @return void
|
||||
*/
|
||||
public function testInitialize(): void
|
||||
{
|
||||
// verify all associations loaded
|
||||
$expectedAssociations = [
|
||||
'States',
|
||||
'Countries',
|
||||
'Addresses',
|
||||
];
|
||||
$associations = $this->Cities->associations();
|
||||
public function testInitialize(): void {
|
||||
// verify all associations loaded
|
||||
$expectedAssociations = [
|
||||
'States',
|
||||
'Countries',
|
||||
'Addresses',
|
||||
];
|
||||
$associations = $this->Cities->associations();
|
||||
|
||||
$this->assertCount(count($expectedAssociations), $associations);
|
||||
foreach ($expectedAssociations as $expectedAssociation) {
|
||||
$this->assertTrue($this->Cities->hasAssociation($expectedAssociation), 'Failed asserting Cities has the association: ' . $expectedAssociation);
|
||||
}
|
||||
$this->assertCount(count($expectedAssociations), $associations);
|
||||
foreach ($expectedAssociations as $expectedAssociation) {
|
||||
$this->assertTrue($this->Cities->hasAssociation($expectedAssociation), 'Failed asserting Cities has the association: ' . $expectedAssociation);
|
||||
}
|
||||
|
||||
// verify all behaviors loaded
|
||||
$expectedBehaviors = [
|
||||
];
|
||||
$behaviors = $this->Cities->behaviors();
|
||||
// verify all behaviors loaded
|
||||
$expectedBehaviors = [];
|
||||
$behaviors = $this->Cities->behaviors();
|
||||
|
||||
$this->assertCount(count($expectedBehaviors), $behaviors);
|
||||
foreach ($expectedBehaviors as $expectedBehavior) {
|
||||
$this->assertTrue($this->Cities->hasBehavior($expectedBehavior));
|
||||
}
|
||||
}
|
||||
$this->assertCount(count($expectedBehaviors), $behaviors);
|
||||
foreach ($expectedBehaviors as $expectedBehavior) {
|
||||
$this->assertTrue($this->Cities->hasBehavior($expectedBehavior));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test validationDefault method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\CitiesTable::validationDefault()
|
||||
* @return void
|
||||
*/
|
||||
public function testValidationDefault(): void
|
||||
{
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
public function testValidationDefault(): void {
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test buildRules method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\CitiesTable::buildRules()
|
||||
* @return void
|
||||
*/
|
||||
public function testBuildRules(): void
|
||||
{
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
public function testBuildRules(): void {
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,72 +9,69 @@ use CakeAddresses\Model\Table\CountriesTable;
|
||||
/**
|
||||
* CakeAddresses\Model\Table\CountriesTable Test Case
|
||||
*/
|
||||
class CountriesTableTest extends TestCase
|
||||
{
|
||||
/**
|
||||
class CountriesTableTest extends TestCase {
|
||||
|
||||
/**
|
||||
* Test subject
|
||||
*
|
||||
* @var \CakeAddresses\Model\Table\CountriesTable
|
||||
*/
|
||||
protected $Countries;
|
||||
protected $Countries;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Countries',
|
||||
'plugin.CakeAddresses.Regions',
|
||||
'plugin.CakeAddresses.Subregions',
|
||||
'plugin.CakeAddresses.Addresses',
|
||||
'plugin.CakeAddresses.Cities',
|
||||
'plugin.CakeAddresses.States',
|
||||
];
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Countries',
|
||||
'plugin.CakeAddresses.Regions',
|
||||
'plugin.CakeAddresses.Subregions',
|
||||
'plugin.CakeAddresses.Addresses',
|
||||
'plugin.CakeAddresses.Cities',
|
||||
'plugin.CakeAddresses.States',
|
||||
];
|
||||
|
||||
/**
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$config = $this->getTableLocator()->exists('Countries') ? [] : ['className' => CountriesTable::class];
|
||||
$this->Countries = $this->getTableLocator()->get('Countries', $config);
|
||||
}
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$config = $this->getTableLocator()->exists('Countries') ? [] : ['className' => CountriesTable::class];
|
||||
$this->Countries = $this->getTableLocator()->get('Countries', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
unset($this->Countries);
|
||||
protected function tearDown(): void {
|
||||
unset($this->Countries);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test validationDefault method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\CountriesTable::validationDefault()
|
||||
* @return void
|
||||
*/
|
||||
public function testValidationDefault(): void
|
||||
{
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
public function testValidationDefault(): void {
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test buildRules method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\CountriesTable::buildRules()
|
||||
* @return void
|
||||
*/
|
||||
public function testBuildRules(): void
|
||||
{
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
public function testBuildRules(): void {
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,89 +9,86 @@ use CakeAddresses\Model\Table\RegionsTable;
|
||||
/**
|
||||
* CakeAddresses\Model\Table\RegionsTable Test Case
|
||||
*/
|
||||
class RegionsTableTest extends TestCase
|
||||
{
|
||||
/**
|
||||
class RegionsTableTest extends TestCase {
|
||||
|
||||
/**
|
||||
* Test subject
|
||||
*
|
||||
* @var \CakeAddresses\Model\Table\RegionsTable
|
||||
*/
|
||||
protected $Regions;
|
||||
protected $Regions;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Regions',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
'plugin.CakeAddresses.Subregions',
|
||||
];
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Regions',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
'plugin.CakeAddresses.Subregions',
|
||||
];
|
||||
|
||||
/**
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$config = $this->getTableLocator()->exists('Regions') ? [] : ['className' => RegionsTable::class];
|
||||
$this->Regions = $this->getTableLocator()->get('Regions', $config);
|
||||
}
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$config = $this->getTableLocator()->exists('Regions') ? [] : ['className' => RegionsTable::class];
|
||||
$this->Regions = $this->getTableLocator()->get('Regions', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
unset($this->Regions);
|
||||
protected function tearDown(): void {
|
||||
unset($this->Regions);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* TestInitialize method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\RegionsTable::initialize()
|
||||
* @return void
|
||||
*/
|
||||
public function testInitialize(): void
|
||||
{
|
||||
// verify all associations loaded
|
||||
$expectedAssociations = [
|
||||
'Countries',
|
||||
'Subregions',
|
||||
public function testInitialize(): void {
|
||||
// verify all associations loaded
|
||||
$expectedAssociations = [
|
||||
'Countries',
|
||||
'Subregions',
|
||||
// 'States',
|
||||
];
|
||||
$associations = $this->Regions->associations();
|
||||
];
|
||||
$associations = $this->Regions->associations();
|
||||
|
||||
$this->assertCount(count($expectedAssociations), $associations);
|
||||
foreach ($expectedAssociations as $expectedAssociation) {
|
||||
$this->assertTrue($this->Regions->hasAssociation($expectedAssociation));
|
||||
}
|
||||
$this->assertCount(count($expectedAssociations), $associations);
|
||||
foreach ($expectedAssociations as $expectedAssociation) {
|
||||
$this->assertTrue($this->Regions->hasAssociation($expectedAssociation));
|
||||
}
|
||||
|
||||
// verify all behaviors loaded
|
||||
$expectedBehaviors = [];
|
||||
$behaviors = $this->Regions->behaviors();
|
||||
// verify all behaviors loaded
|
||||
$expectedBehaviors = [];
|
||||
$behaviors = $this->Regions->behaviors();
|
||||
|
||||
$this->assertCount(count($expectedBehaviors), $behaviors);
|
||||
foreach ($expectedBehaviors as $expectedBehavior) {
|
||||
$this->assertTrue($this->Regions->hasBehavior($expectedBehavior));
|
||||
}
|
||||
}
|
||||
$this->assertCount(count($expectedBehaviors), $behaviors);
|
||||
foreach ($expectedBehaviors as $expectedBehavior) {
|
||||
$this->assertTrue($this->Regions->hasBehavior($expectedBehavior));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test validationDefault method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\RegionsTable::validationDefault()
|
||||
* @return void
|
||||
*/
|
||||
public function testValidationDefault(): void
|
||||
{
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
public function testValidationDefault(): void {
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,70 +9,67 @@ use CakeAddresses\Model\Table\StatesTable;
|
||||
/**
|
||||
* CakeAddresses\Model\Table\StatesTable Test Case
|
||||
*/
|
||||
class StatesTableTest extends TestCase
|
||||
{
|
||||
/**
|
||||
class StatesTableTest extends TestCase {
|
||||
|
||||
/**
|
||||
* Test subject
|
||||
*
|
||||
* @var \CakeAddresses\Model\Table\StatesTable
|
||||
*/
|
||||
protected $States;
|
||||
protected $States;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.States',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
'plugin.CakeAddresses.Addresses',
|
||||
'plugin.CakeAddresses.Cities',
|
||||
];
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.States',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
'plugin.CakeAddresses.Addresses',
|
||||
'plugin.CakeAddresses.Cities',
|
||||
];
|
||||
|
||||
/**
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$config = $this->getTableLocator()->exists('States') ? [] : ['className' => StatesTable::class];
|
||||
$this->States = $this->getTableLocator()->get('States', $config);
|
||||
}
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$config = $this->getTableLocator()->exists('States') ? [] : ['className' => StatesTable::class];
|
||||
$this->States = $this->getTableLocator()->get('States', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
unset($this->States);
|
||||
protected function tearDown(): void {
|
||||
unset($this->States);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test validationDefault method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\StatesTable::validationDefault()
|
||||
* @return void
|
||||
*/
|
||||
public function testValidationDefault(): void
|
||||
{
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
public function testValidationDefault(): void {
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test buildRules method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\StatesTable::buildRules()
|
||||
* @return void
|
||||
*/
|
||||
public function testBuildRules(): void
|
||||
{
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
public function testBuildRules(): void {
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,69 +9,66 @@ use CakeAddresses\Model\Table\SubregionsTable;
|
||||
/**
|
||||
* CakeAddresses\Model\Table\SubregionsTable Test Case
|
||||
*/
|
||||
class SubregionsTableTest extends TestCase
|
||||
{
|
||||
/**
|
||||
class SubregionsTableTest extends TestCase {
|
||||
|
||||
/**
|
||||
* Test subject
|
||||
*
|
||||
* @var \CakeAddresses\Model\Table\SubregionsTable
|
||||
*/
|
||||
protected $Subregions;
|
||||
protected $Subregions;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Subregions',
|
||||
'plugin.CakeAddresses.Regions',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
];
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Subregions',
|
||||
'plugin.CakeAddresses.Regions',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
];
|
||||
|
||||
/**
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$config = $this->getTableLocator()->exists('Subregions') ? [] : ['className' => SubregionsTable::class];
|
||||
$this->Subregions = $this->getTableLocator()->get('Subregions', $config);
|
||||
}
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$config = $this->getTableLocator()->exists('Subregions') ? [] : ['className' => SubregionsTable::class];
|
||||
$this->Subregions = $this->getTableLocator()->get('Subregions', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
unset($this->Subregions);
|
||||
protected function tearDown(): void {
|
||||
unset($this->Subregions);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test validationDefault method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\SubregionsTable::validationDefault()
|
||||
* @return void
|
||||
*/
|
||||
public function testValidationDefault(): void
|
||||
{
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
public function testValidationDefault(): void {
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Test buildRules method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\SubregionsTable::buildRules()
|
||||
* @return void
|
||||
*/
|
||||
public function testBuildRules(): void
|
||||
{
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
public function testBuildRules(): void {
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user