phpcs phpcbf
This commit is contained in:
21
phpcs.xml
Normal file
21
phpcs.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset name="plugin">
|
||||||
|
<arg value="nps"/>
|
||||||
|
|
||||||
|
<file>src/</file>
|
||||||
|
<file>config/</file>
|
||||||
|
<file>tests/</file>
|
||||||
|
|
||||||
|
<exclude-pattern>/tests/test_files/</exclude-pattern>
|
||||||
|
<exclude-pattern>/tests/test_app/</exclude-pattern>
|
||||||
|
|
||||||
|
<rule ref="PSR2R"/>
|
||||||
|
|
||||||
|
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
|
||||||
|
<exclude-pattern>*/config/Migrations/*</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PhpCollective.Classes.ClassFileName.NoMatch">
|
||||||
|
<exclude-pattern>*/config/Migrations/*</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
</ruleset>
|
||||||
@@ -13,9 +13,9 @@ use Cake\Routing\RouteBuilder;
|
|||||||
/**
|
/**
|
||||||
* Plugin for CakeAddresses
|
* Plugin for CakeAddresses
|
||||||
*/
|
*/
|
||||||
class CakeAddressesPlugin extends BasePlugin
|
class CakeAddressesPlugin extends BasePlugin {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Load all the plugin configuration and bootstrap logic.
|
* Load all the plugin configuration and bootstrap logic.
|
||||||
*
|
*
|
||||||
* The host application is provided as an argument. This allows you to load
|
* The host application is provided as an argument. This allows you to load
|
||||||
@@ -24,11 +24,10 @@ class CakeAddressesPlugin extends BasePlugin
|
|||||||
* @param \Cake\Core\PluginApplicationInterface $app The host application
|
* @param \Cake\Core\PluginApplicationInterface $app The host application
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function bootstrap(PluginApplicationInterface $app): void
|
public function bootstrap(PluginApplicationInterface $app): void {
|
||||||
{
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add routes for the plugin.
|
* Add routes for the plugin.
|
||||||
*
|
*
|
||||||
* If your plugin has many routes and you would like to isolate them into a separate file,
|
* If your plugin has many routes and you would like to isolate them into a separate file,
|
||||||
@@ -37,57 +36,54 @@ class CakeAddressesPlugin extends BasePlugin
|
|||||||
* @param \Cake\Routing\RouteBuilder $routes The route builder to update.
|
* @param \Cake\Routing\RouteBuilder $routes The route builder to update.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function routes(RouteBuilder $routes): void
|
public function routes(RouteBuilder $routes): void {
|
||||||
{
|
$routes->plugin(
|
||||||
$routes->plugin(
|
'CakeAddresses',
|
||||||
'CakeAddresses',
|
['path' => '/cake-addresses'],
|
||||||
['path' => '/cake-addresses'],
|
function (RouteBuilder $builder) {
|
||||||
function (RouteBuilder $builder) {
|
// Add custom routes here
|
||||||
// Add custom routes here
|
|
||||||
|
|
||||||
$builder->fallbacks();
|
$builder->fallbacks();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
parent::routes($routes);
|
parent::routes($routes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add middleware for the plugin.
|
* Add middleware for the plugin.
|
||||||
*
|
*
|
||||||
* @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to update.
|
* @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to update.
|
||||||
* @return \Cake\Http\MiddlewareQueue
|
* @return \Cake\Http\MiddlewareQueue
|
||||||
*/
|
*/
|
||||||
public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
|
public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue {
|
||||||
{
|
// Add your middlewares here
|
||||||
// Add your middlewares here
|
|
||||||
|
|
||||||
return $middlewareQueue;
|
return $middlewareQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add commands for the plugin.
|
* Add commands for the plugin.
|
||||||
*
|
*
|
||||||
* @param \Cake\Console\CommandCollection $commands The command collection to update.
|
* @param \Cake\Console\CommandCollection $commands The command collection to update.
|
||||||
* @return \Cake\Console\CommandCollection
|
* @return \Cake\Console\CommandCollection
|
||||||
*/
|
*/
|
||||||
public function console(CommandCollection $commands): CommandCollection
|
public function console(CommandCollection $commands): CommandCollection {
|
||||||
{
|
// Add your commands here
|
||||||
// Add your commands here
|
|
||||||
|
|
||||||
$commands = parent::console($commands);
|
$commands = parent::console($commands);
|
||||||
|
|
||||||
return $commands;
|
return $commands;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register application container services.
|
* Register application container services.
|
||||||
*
|
*
|
||||||
|
* @link https://book.cakephp.org/4/en/development/dependency-injection.html#dependency-injection
|
||||||
* @param \Cake\Core\ContainerInterface $container The Container to update.
|
* @param \Cake\Core\ContainerInterface $container The Container to update.
|
||||||
* @return void
|
* @return void
|
||||||
* @link https://book.cakephp.org/4/en/development/dependency-injection.html#dependency-injection
|
|
||||||
*/
|
*/
|
||||||
public function services(ContainerInterface $container): void
|
public function services(ContainerInterface $container): void {
|
||||||
{
|
// Add your services here
|
||||||
// Add your services here
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,106 +3,99 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace CakeAddresses\Controller;
|
namespace CakeAddresses\Controller;
|
||||||
|
|
||||||
use Cake\Log\Log;
|
|
||||||
use CakeAddresses\Controller\AppController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Addresses Controller
|
* Addresses Controller
|
||||||
*
|
*
|
||||||
* @property \CakeAddresses\Model\Table\AddressesTable $Addresses
|
* @property \CakeAddresses\Model\Table\AddressesTable $Addresses
|
||||||
*/
|
*/
|
||||||
class AddressesController extends AppController
|
class AddressesController extends AppController {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Index method
|
* Index method
|
||||||
*
|
*
|
||||||
* @return \Cake\Http\Response|null|void Renders view
|
* @return \Cake\Http\Response|null|void Renders view
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index() {
|
||||||
{
|
$query = $this->Addresses->find()
|
||||||
$query = $this->Addresses->find()
|
->contain(['Cities', 'States', 'Countries']);
|
||||||
->contain(['Cities', 'States', 'Countries']);
|
$addresses = $this->paginate($query);
|
||||||
$addresses = $this->paginate($query);
|
|
||||||
|
|
||||||
$this->set(compact('addresses'));
|
$this->set(compact('addresses'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View method
|
* View method
|
||||||
*
|
*
|
||||||
* @param string|null $id Address id.
|
* @param string|null $id Address id.
|
||||||
* @return \Cake\Http\Response|null|void Renders view
|
|
||||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
* @return \Cake\Http\Response|null|void Renders view
|
||||||
*/
|
*/
|
||||||
public function view($id = null)
|
public function view($id = null) {
|
||||||
{
|
$address = $this->Addresses->get($id, contain: ['Cities', 'States', 'Countries']);
|
||||||
$address = $this->Addresses->get($id, contain: ['Cities', 'States', 'Countries']);
|
$this->set(compact('address'));
|
||||||
$this->set(compact('address'));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add method
|
* Add method
|
||||||
*
|
*
|
||||||
* @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise.
|
* @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise.
|
||||||
*/
|
*/
|
||||||
public function add()
|
public function add() {
|
||||||
{
|
$address = $this->Addresses->newEmptyEntity();
|
||||||
$address = $this->Addresses->newEmptyEntity();
|
if ($this->request->is('post')) {
|
||||||
if ($this->request->is('post')) {
|
$data = $this->request->getData();
|
||||||
$data = $this->request->getData();
|
$address = $this->Addresses->patchEntity($address, $data);
|
||||||
$address = $this->Addresses->patchEntity($address, $data);
|
if ($this->Addresses->save($address)) {
|
||||||
if ($this->Addresses->save($address)) {
|
$this->Flash->success(__('The address has been saved.'));
|
||||||
$this->Flash->success(__('The address has been saved.'));
|
|
||||||
|
|
||||||
return $this->redirect(['action' => 'index']);
|
return $this->redirect(['action' => 'index']);
|
||||||
}
|
}
|
||||||
$this->Flash->error(__('The address could not be saved. Please, try again.'));
|
$this->Flash->error(__('The address could not be saved. Please, try again.'));
|
||||||
}
|
}
|
||||||
$countries = $this->Addresses->Countries->find('list')->all();
|
$countries = $this->Addresses->Countries->find('list')->all();
|
||||||
$this->set(compact('address', 'countries'));
|
$this->set(compact('address', 'countries'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit method
|
* Edit method
|
||||||
*
|
*
|
||||||
* @param string|null $id Address id.
|
* @param string|null $id Address id.
|
||||||
* @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise.
|
|
||||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
* @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise.
|
||||||
*/
|
*/
|
||||||
public function edit($id = null)
|
public function edit($id = null) {
|
||||||
{
|
$address = $this->Addresses->get($id, contain: []);
|
||||||
$address = $this->Addresses->get($id, contain: []);
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
$address = $this->Addresses->patchEntity($address, $this->request->getData());
|
||||||
$address = $this->Addresses->patchEntity($address, $this->request->getData());
|
if ($this->Addresses->save($address)) {
|
||||||
if ($this->Addresses->save($address)) {
|
$this->Flash->success(__('The address has been saved.'));
|
||||||
$this->Flash->success(__('The address has been saved.'));
|
|
||||||
|
|
||||||
return $this->redirect(['action' => 'index']);
|
return $this->redirect(['action' => 'index']);
|
||||||
}
|
}
|
||||||
$this->Flash->error(__('The address could not be saved. Please, try again.'));
|
$this->Flash->error(__('The address could not be saved. Please, try again.'));
|
||||||
}
|
}
|
||||||
$countries = $this->Addresses->Countries->find('list')->all();
|
$countries = $this->Addresses->Countries->find('list')->all();
|
||||||
$states = $this->Addresses->States->find('list')->where(['country_id' => $address->country_id])->all();
|
$states = $this->Addresses->States->find('list')->where(['country_id' => $address->country_id])->all();
|
||||||
$this->set(compact('address', 'countries', 'states'));
|
$this->set(compact('address', 'countries', 'states'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete method
|
* Delete method
|
||||||
*
|
*
|
||||||
* @param string|null $id Address id.
|
* @param string|null $id Address id.
|
||||||
* @return \Cake\Http\Response|null Redirects to index.
|
|
||||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
* @return \Cake\Http\Response|null Redirects to index.
|
||||||
*/
|
*/
|
||||||
public function delete($id = null)
|
public function delete($id = null) {
|
||||||
{
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
$this->request->allowMethod(['post', 'delete']);
|
$address = $this->Addresses->get($id);
|
||||||
$address = $this->Addresses->get($id);
|
if ($this->Addresses->delete($address)) {
|
||||||
if ($this->Addresses->delete($address)) {
|
$this->Flash->success(__('The address has been deleted.'));
|
||||||
$this->Flash->success(__('The address has been deleted.'));
|
} else {
|
||||||
} else {
|
$this->Flash->error(__('The address could not be deleted. Please, try again.'));
|
||||||
$this->Flash->error(__('The address could not be deleted. Please, try again.'));
|
}
|
||||||
}
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->redirect(['action' => 'index']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,5 @@ namespace CakeAddresses\Controller;
|
|||||||
|
|
||||||
use App\Controller\AppController as BaseController;
|
use App\Controller\AppController as BaseController;
|
||||||
|
|
||||||
class AppController extends BaseController
|
class AppController extends BaseController {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,26 +3,24 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace CakeAddresses\Controller;
|
namespace CakeAddresses\Controller;
|
||||||
|
|
||||||
use CakeAddresses\Controller\AppController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cities Controller
|
* Cities Controller
|
||||||
*
|
*
|
||||||
* @property \CakeAddresses\Model\Table\CitiesTable $Cities
|
* @property \CakeAddresses\Model\Table\CitiesTable $Cities
|
||||||
*/
|
*/
|
||||||
class CitiesController extends AppController
|
class CitiesController extends AppController {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* @return \Cake\Http\Response|null|void Renders view
|
* @return \Cake\Http\Response|null|void Renders view
|
||||||
*/
|
*/
|
||||||
public function select()
|
public function select() {
|
||||||
{
|
$query = $this->Cities
|
||||||
$query = $this->Cities
|
|
||||||
// ->find('search', $this->request->getQueryParams())
|
// ->find('search', $this->request->getQueryParams())
|
||||||
->find('list')
|
->find('list')
|
||||||
->orderBy(['name']);
|
->orderBy(['name']);
|
||||||
$cities = $this->paginate($query);
|
$cities = $this->paginate($query);
|
||||||
|
|
||||||
|
$this->set(compact('cities'));
|
||||||
|
}
|
||||||
|
|
||||||
$this->set(compact('cities'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,39 +3,36 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace CakeAddresses\Controller;
|
namespace CakeAddresses\Controller;
|
||||||
|
|
||||||
use CakeAddresses\Controller\AppController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Countries Controller
|
* Countries Controller
|
||||||
*
|
*
|
||||||
* @property \CakeAddresses\Model\Table\CountriesTable $Countries
|
* @property \CakeAddresses\Model\Table\CountriesTable $Countries
|
||||||
*/
|
*/
|
||||||
class CountriesController extends AppController
|
class CountriesController extends AppController {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Index method
|
* Index method
|
||||||
*
|
*
|
||||||
* @return \Cake\Http\Response|null|void Renders view
|
* @return \Cake\Http\Response|null|void Renders view
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index() {
|
||||||
{
|
$query = $this->Countries->find()
|
||||||
$query = $this->Countries->find()
|
->contain(['Regions', 'Subregions']);
|
||||||
->contain(['Regions', 'Subregions']);
|
$countries = $this->paginate($query);
|
||||||
$countries = $this->paginate($query);
|
|
||||||
|
|
||||||
$this->set(compact('countries'));
|
$this->set(compact('countries'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View method
|
* View method
|
||||||
*
|
*
|
||||||
* @param string|null $id Country id.
|
* @param string|null $id Country id.
|
||||||
* @return \Cake\Http\Response|null|void Renders view
|
|
||||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
* @return \Cake\Http\Response|null|void Renders view
|
||||||
*/
|
*/
|
||||||
public function view($id = null)
|
public function view($id = null) {
|
||||||
{
|
$country = $this->Countries->get($id, contain: ['Regions', 'Subregions', 'States']);
|
||||||
$country = $this->Countries->get($id, contain: ['Regions', 'Subregions', 'States']);
|
$this->set(compact('country'));
|
||||||
$this->set(compact('country'));
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,38 +3,35 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace CakeAddresses\Controller;
|
namespace CakeAddresses\Controller;
|
||||||
|
|
||||||
use CakeAddresses\Controller\AppController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Regions Controller
|
* Regions Controller
|
||||||
*
|
*
|
||||||
* @property \CakeAddresses\Model\Table\RegionsTable $Regions
|
* @property \CakeAddresses\Model\Table\RegionsTable $Regions
|
||||||
*/
|
*/
|
||||||
class RegionsController extends AppController
|
class RegionsController extends AppController {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Index method
|
* Index method
|
||||||
*
|
*
|
||||||
* @return \Cake\Http\Response|null|void Renders view
|
* @return \Cake\Http\Response|null|void Renders view
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index() {
|
||||||
{
|
$query = $this->Regions->find();
|
||||||
$query = $this->Regions->find();
|
$regions = $this->paginate($query);
|
||||||
$regions = $this->paginate($query);
|
|
||||||
|
|
||||||
$this->set(compact('regions'));
|
$this->set(compact('regions'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View method
|
* View method
|
||||||
*
|
*
|
||||||
* @param string|null $id Region id.
|
* @param string|null $id Region id.
|
||||||
* @return \Cake\Http\Response|null|void Renders view
|
|
||||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
* @return \Cake\Http\Response|null|void Renders view
|
||||||
*/
|
*/
|
||||||
public function view($id = null)
|
public function view($id = null) {
|
||||||
{
|
$region = $this->Regions->get($id, contain: ['Countries', 'Subregions']);
|
||||||
$region = $this->Regions->get($id, contain: ['Countries', 'Subregions']);
|
$this->set(compact('region'));
|
||||||
$this->set(compact('region'));
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,53 +3,49 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace CakeAddresses\Controller;
|
namespace CakeAddresses\Controller;
|
||||||
|
|
||||||
use CakeAddresses\Controller\AppController;
|
|
||||||
use Cake\Log\Log;
|
|
||||||
/**
|
/**
|
||||||
* States Controller
|
* States Controller
|
||||||
*
|
*
|
||||||
* @property \CakeAddresses\Model\Table\StatesTable $States
|
* @property \CakeAddresses\Model\Table\StatesTable $States
|
||||||
*/
|
*/
|
||||||
class StatesController extends AppController
|
class StatesController extends AppController {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Index method
|
* Index method
|
||||||
*
|
*
|
||||||
* @return \Cake\Http\Response|null|void Renders view
|
* @return \Cake\Http\Response|null|void Renders view
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index() {
|
||||||
{
|
$query = $this->States->find()
|
||||||
$query = $this->States->find()
|
->contain(['Countries']);
|
||||||
->contain(['Countries']);
|
$states = $this->paginate($query);
|
||||||
$states = $this->paginate($query);
|
|
||||||
|
|
||||||
$this->set(compact('states'));
|
$this->set(compact('states'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View method
|
* View method
|
||||||
*
|
*
|
||||||
* @param string|null $id State id.
|
* @param string|null $id State id.
|
||||||
* @return \Cake\Http\Response|null|void Renders view
|
|
||||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
*/
|
|
||||||
public function view($id = null)
|
|
||||||
{
|
|
||||||
$state = $this->States->get($id, contain: ['Countries', 'Addresses', 'Cities']);
|
|
||||||
$this->set(compact('state'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Cake\Http\Response|null|void Renders view
|
* @return \Cake\Http\Response|null|void Renders view
|
||||||
*/
|
*/
|
||||||
public function select()
|
public function view($id = null) {
|
||||||
{
|
$state = $this->States->get($id, contain: ['Countries', 'Addresses', 'Cities']);
|
||||||
$states = $this->States
|
$this->set(compact('state'));
|
||||||
->find('list')
|
}
|
||||||
->where(['country_id' => $this->request->getQuery('country_id', -1)])
|
|
||||||
->orderBy(['States.name'])
|
/**
|
||||||
->toArray();
|
* @return \Cake\Http\Response|null|void Renders view
|
||||||
|
*/
|
||||||
|
public function select() {
|
||||||
|
$states = $this->States
|
||||||
|
->find('list')
|
||||||
|
->where(['country_id' => $this->request->getQuery('country_id', -1)])
|
||||||
|
->orderBy(['States.name'])
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$this->set(compact('states'));
|
||||||
|
}
|
||||||
|
|
||||||
$this->set(compact('states'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,39 +3,36 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace CakeAddresses\Controller;
|
namespace CakeAddresses\Controller;
|
||||||
|
|
||||||
use CakeAddresses\Controller\AppController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subregions Controller
|
* Subregions Controller
|
||||||
*
|
*
|
||||||
* @property \CakeAddresses\Model\Table\SubregionsTable $Subregions
|
* @property \CakeAddresses\Model\Table\SubregionsTable $Subregions
|
||||||
*/
|
*/
|
||||||
class SubregionsController extends AppController
|
class SubregionsController extends AppController {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Index method
|
* Index method
|
||||||
*
|
*
|
||||||
* @return \Cake\Http\Response|null|void Renders view
|
* @return \Cake\Http\Response|null|void Renders view
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index() {
|
||||||
{
|
$query = $this->Subregions->find()
|
||||||
$query = $this->Subregions->find()
|
->contain(['Regions']);
|
||||||
->contain(['Regions']);
|
$subregions = $this->paginate($query);
|
||||||
$subregions = $this->paginate($query);
|
|
||||||
|
|
||||||
$this->set(compact('subregions'));
|
$this->set(compact('subregions'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View method
|
* View method
|
||||||
*
|
*
|
||||||
* @param string|null $id Subregion id.
|
* @param string|null $id Subregion id.
|
||||||
* @return \Cake\Http\Response|null|void Renders view
|
|
||||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
* @return \Cake\Http\Response|null|void Renders view
|
||||||
*/
|
*/
|
||||||
public function view($id = null)
|
public function view($id = null) {
|
||||||
{
|
$subregion = $this->Subregions->get($id, contain: ['Regions', 'Countries']);
|
||||||
$subregion = $this->Subregions->get($id, contain: ['Regions', 'Countries']);
|
$this->set(compact('subregion'));
|
||||||
$this->set(compact('subregion'));
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ use Cake\ORM\Entity;
|
|||||||
* @property State $state
|
* @property State $state
|
||||||
* @property Country $country
|
* @property Country $country
|
||||||
*/
|
*/
|
||||||
class Address extends Entity
|
class Address extends Entity {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Fields that can be mass assigned using newEntity() or patchEntity().
|
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||||
*
|
*
|
||||||
* Note that when '*' is set to true, this allows all unspecified fields to
|
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||||
@@ -38,22 +38,23 @@ class Address extends Entity
|
|||||||
*
|
*
|
||||||
* @var array<string, bool>
|
* @var array<string, bool>
|
||||||
*/
|
*/
|
||||||
protected array $_accessible = [
|
protected array $_accessible = [
|
||||||
'address_name' => true,
|
'address_name' => true,
|
||||||
'contact_name' => true,
|
'contact_name' => true,
|
||||||
'address_line1' => true,
|
'address_line1' => true,
|
||||||
'address_line2' => true,
|
'address_line2' => true,
|
||||||
'city' => true,
|
'city' => true,
|
||||||
'city_id' => true,
|
'city_id' => true,
|
||||||
'state' => true,
|
'state' => true,
|
||||||
'state_id' => true,
|
'state_id' => true,
|
||||||
'postal_code' => true,
|
'postal_code' => true,
|
||||||
'country' => true,
|
'country' => true,
|
||||||
'country_id' => true,
|
'country_id' => true,
|
||||||
'phone_number' => true,
|
'phone_number' => true,
|
||||||
'email' => true,
|
'email' => true,
|
||||||
'notes' => true,
|
'notes' => true,
|
||||||
'foreign_key' => true,
|
'foreign_key' => true,
|
||||||
'model' => true,
|
'model' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ use Cake\ORM\Entity;
|
|||||||
* @property \CakeAddresses\Model\Entity\Country $country
|
* @property \CakeAddresses\Model\Entity\Country $country
|
||||||
* @property \CakeAddresses\Model\Entity\Address[] $addresses
|
* @property \CakeAddresses\Model\Entity\Address[] $addresses
|
||||||
*/
|
*/
|
||||||
class City extends Entity
|
class City extends Entity {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Fields that can be mass assigned using newEntity() or patchEntity().
|
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||||
*
|
*
|
||||||
* Note that when '*' is set to true, this allows all unspecified fields to
|
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||||
@@ -36,20 +36,21 @@ class City extends Entity
|
|||||||
*
|
*
|
||||||
* @var array<string, bool>
|
* @var array<string, bool>
|
||||||
*/
|
*/
|
||||||
protected array $_accessible = [
|
protected array $_accessible = [
|
||||||
'name' => true,
|
'name' => true,
|
||||||
'state_id' => true,
|
'state_id' => true,
|
||||||
'state_code' => true,
|
'state_code' => true,
|
||||||
'country_id' => true,
|
'country_id' => true,
|
||||||
'country_code' => true,
|
'country_code' => true,
|
||||||
'latitude' => true,
|
'latitude' => true,
|
||||||
'longitude' => true,
|
'longitude' => true,
|
||||||
'created_at' => true,
|
'created_at' => true,
|
||||||
'updated_at' => true,
|
'updated_at' => true,
|
||||||
'flag' => true,
|
'flag' => true,
|
||||||
'wikiDataId' => true,
|
'wikiDataId' => true,
|
||||||
'state' => true,
|
'state' => true,
|
||||||
'country' => true,
|
'country' => true,
|
||||||
'addresses' => true,
|
'addresses' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ use Cake\ORM\Entity;
|
|||||||
* @property \CakeAddresses\Model\Entity\City[] $cities
|
* @property \CakeAddresses\Model\Entity\City[] $cities
|
||||||
* @property \CakeAddresses\Model\Entity\State[] $states
|
* @property \CakeAddresses\Model\Entity\State[] $states
|
||||||
*/
|
*/
|
||||||
class Country extends Entity
|
class Country extends Entity {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Fields that can be mass assigned using newEntity() or patchEntity().
|
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||||
*
|
*
|
||||||
* Note that when '*' is set to true, this allows all unspecified fields to
|
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||||
@@ -51,35 +51,36 @@ class Country extends Entity
|
|||||||
*
|
*
|
||||||
* @var array<string, bool>
|
* @var array<string, bool>
|
||||||
*/
|
*/
|
||||||
protected array $_accessible = [
|
protected array $_accessible = [
|
||||||
'name' => true,
|
'name' => true,
|
||||||
'iso3' => true,
|
'iso3' => true,
|
||||||
'numeric_code' => true,
|
'numeric_code' => true,
|
||||||
'iso2' => true,
|
'iso2' => true,
|
||||||
'phonecode' => true,
|
'phonecode' => true,
|
||||||
'capital' => true,
|
'capital' => true,
|
||||||
'currency' => true,
|
'currency' => true,
|
||||||
'currency_name' => true,
|
'currency_name' => true,
|
||||||
'currency_symbol' => true,
|
'currency_symbol' => true,
|
||||||
'tld' => true,
|
'tld' => true,
|
||||||
'native' => true,
|
'native' => true,
|
||||||
'region' => true,
|
'region' => true,
|
||||||
'region_id' => true,
|
'region_id' => true,
|
||||||
'subregion' => true,
|
'subregion' => true,
|
||||||
'subregion_id' => true,
|
'subregion_id' => true,
|
||||||
'nationality' => true,
|
'nationality' => true,
|
||||||
'timezones' => true,
|
'timezones' => true,
|
||||||
'translations' => true,
|
'translations' => true,
|
||||||
'latitude' => true,
|
'latitude' => true,
|
||||||
'longitude' => true,
|
'longitude' => true,
|
||||||
'emoji' => true,
|
'emoji' => true,
|
||||||
'emojiU' => true,
|
'emojiU' => true,
|
||||||
'created_at' => true,
|
'created_at' => true,
|
||||||
'updated_at' => true,
|
'updated_at' => true,
|
||||||
'flag' => true,
|
'flag' => true,
|
||||||
'wikiDataId' => true,
|
'wikiDataId' => true,
|
||||||
'addresses' => true,
|
'addresses' => true,
|
||||||
'cities' => true,
|
'cities' => true,
|
||||||
'states' => true,
|
'states' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ use Cake\ORM\Entity;
|
|||||||
* @property \CakeAddresses\Model\Entity\Country[] $countries
|
* @property \CakeAddresses\Model\Entity\Country[] $countries
|
||||||
* @property \CakeAddresses\Model\Entity\Subregion[] $subregions
|
* @property \CakeAddresses\Model\Entity\Subregion[] $subregions
|
||||||
*/
|
*/
|
||||||
class Region extends Entity
|
class Region extends Entity {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Fields that can be mass assigned using newEntity() or patchEntity().
|
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||||
*
|
*
|
||||||
* Note that when '*' is set to true, this allows all unspecified fields to
|
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||||
@@ -30,14 +30,15 @@ class Region extends Entity
|
|||||||
*
|
*
|
||||||
* @var array<string, bool>
|
* @var array<string, bool>
|
||||||
*/
|
*/
|
||||||
protected array $_accessible = [
|
protected array $_accessible = [
|
||||||
'name' => true,
|
'name' => true,
|
||||||
'translations' => true,
|
'translations' => true,
|
||||||
'created_at' => true,
|
'created_at' => true,
|
||||||
'updated_at' => true,
|
'updated_at' => true,
|
||||||
'flag' => true,
|
'flag' => true,
|
||||||
'wikiDataId' => true,
|
'wikiDataId' => true,
|
||||||
'countries' => true,
|
'countries' => true,
|
||||||
'subregions' => true,
|
'subregions' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ use Cake\ORM\Entity;
|
|||||||
* @property \CakeAddresses\Model\Entity\Address[] $addresses
|
* @property \CakeAddresses\Model\Entity\Address[] $addresses
|
||||||
* @property \CakeAddresses\Model\Entity\City[] $cities
|
* @property \CakeAddresses\Model\Entity\City[] $cities
|
||||||
*/
|
*/
|
||||||
class State extends Entity
|
class State extends Entity {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Fields that can be mass assigned using newEntity() or patchEntity().
|
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||||
*
|
*
|
||||||
* Note that when '*' is set to true, this allows all unspecified fields to
|
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||||
@@ -37,21 +37,22 @@ class State extends Entity
|
|||||||
*
|
*
|
||||||
* @var array<string, bool>
|
* @var array<string, bool>
|
||||||
*/
|
*/
|
||||||
protected array $_accessible = [
|
protected array $_accessible = [
|
||||||
'name' => true,
|
'name' => true,
|
||||||
'country_id' => true,
|
'country_id' => true,
|
||||||
'country_code' => true,
|
'country_code' => true,
|
||||||
'fips_code' => true,
|
'fips_code' => true,
|
||||||
'iso2' => true,
|
'iso2' => true,
|
||||||
'type' => true,
|
'type' => true,
|
||||||
'latitude' => true,
|
'latitude' => true,
|
||||||
'longitude' => true,
|
'longitude' => true,
|
||||||
'created_at' => true,
|
'created_at' => true,
|
||||||
'updated_at' => true,
|
'updated_at' => true,
|
||||||
'flag' => true,
|
'flag' => true,
|
||||||
'wikiDataId' => true,
|
'wikiDataId' => true,
|
||||||
'country' => true,
|
'country' => true,
|
||||||
'addresses' => true,
|
'addresses' => true,
|
||||||
'cities' => true,
|
'cities' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ use Cake\ORM\Entity;
|
|||||||
* @property \CakeAddresses\Model\Entity\Region $region
|
* @property \CakeAddresses\Model\Entity\Region $region
|
||||||
* @property \CakeAddresses\Model\Entity\Country[] $countries
|
* @property \CakeAddresses\Model\Entity\Country[] $countries
|
||||||
*/
|
*/
|
||||||
class Subregion extends Entity
|
class Subregion extends Entity {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Fields that can be mass assigned using newEntity() or patchEntity().
|
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||||
*
|
*
|
||||||
* Note that when '*' is set to true, this allows all unspecified fields to
|
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||||
@@ -31,15 +31,16 @@ class Subregion extends Entity
|
|||||||
*
|
*
|
||||||
* @var array<string, bool>
|
* @var array<string, bool>
|
||||||
*/
|
*/
|
||||||
protected array $_accessible = [
|
protected array $_accessible = [
|
||||||
'name' => true,
|
'name' => true,
|
||||||
'translations' => true,
|
'translations' => true,
|
||||||
'region_id' => true,
|
'region_id' => true,
|
||||||
'created_at' => true,
|
'created_at' => true,
|
||||||
'updated_at' => true,
|
'updated_at' => true,
|
||||||
'flag' => true,
|
'flag' => true,
|
||||||
'wikiDataId' => true,
|
'wikiDataId' => true,
|
||||||
'region' => true,
|
'region' => true,
|
||||||
'countries' => true,
|
'countries' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,19 +4,10 @@ declare(strict_types=1);
|
|||||||
namespace CakeAddresses\Model\Table;
|
namespace CakeAddresses\Model\Table;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use Cake\Datasource\EntityInterface;
|
|
||||||
use Cake\Datasource\ResultSetInterface;
|
|
||||||
use Cake\Event\EventInterface;
|
use Cake\Event\EventInterface;
|
||||||
use Cake\Log\Log;
|
|
||||||
use Cake\ORM\Association\BelongsTo;
|
|
||||||
use Cake\ORM\Query\SelectQuery;
|
|
||||||
use Cake\ORM\RulesChecker;
|
use Cake\ORM\RulesChecker;
|
||||||
use Cake\ORM\Table;
|
use Cake\ORM\Table;
|
||||||
use Cake\Validation\Validator;
|
use Cake\Validation\Validator;
|
||||||
use CakeAddresses\Model\Entity\Address;
|
|
||||||
use CakeAddresses\Model\Entity\State;
|
|
||||||
use Closure;
|
|
||||||
use Psr\SimpleCache\CacheInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Addresses Model
|
* Addresses Model
|
||||||
@@ -25,176 +16,173 @@ use Psr\SimpleCache\CacheInterface;
|
|||||||
* @property StatesTable&BelongsTo $States
|
* @property StatesTable&BelongsTo $States
|
||||||
* @property CountriesTable&BelongsTo $Countries
|
* @property CountriesTable&BelongsTo $Countries
|
||||||
*
|
*
|
||||||
* @method Address newEmptyEntity()
|
* @method \CakeAddresses\Model\Entity\Address newEmptyEntity()
|
||||||
* @method Address newEntity(array $data, array $options = [])
|
* @method \CakeAddresses\Model\Entity\Address newEntity()
|
||||||
* @method array<Address> newEntities(array $data, array $options = [])
|
* @method array<Address> newEntities(array $data, array $options = [])
|
||||||
* @method Address get(mixed $primaryKey, array|string $finder = 'all', CacheInterface|string|null $cache = null, Closure|string|null $cacheKey = null, mixed ...$args)
|
* @method \CakeAddresses\Model\Entity\Address get()
|
||||||
* @method Address findOrCreate($search, ?callable $callback = null, array $options = [])
|
* @method \CakeAddresses\Model\Entity\Address findOrCreate()
|
||||||
* @method Address patchEntity(EntityInterface $entity, array $data, array $options = [])
|
* @method \CakeAddresses\Model\Entity\Address patchEntity()
|
||||||
* @method array<Address> patchEntities(iterable $entities, array $data, array $options = [])
|
* @method array<Address> patchEntities(iterable $entities, array $data, array $options = [])
|
||||||
* @method Address|false save(EntityInterface $entity, array $options = [])
|
* @method Address|false save(EntityInterface $entity, array $options = [])
|
||||||
* @method Address saveOrFail(EntityInterface $entity, array $options = [])
|
* @method \CakeAddresses\Model\Entity\Address saveOrFail()
|
||||||
* @method iterable<Address>|ResultSetInterface<Address>|false saveMany(iterable $entities, array $options = [])
|
* @method iterable<Address>|ResultSetInterface<Address>|false saveMany(iterable $entities, array $options = [])
|
||||||
* @method iterable<Address>|ResultSetInterface<Address> saveManyOrFail(iterable $entities, array $options = [])
|
* @method iterable<Address>|ResultSetInterface<Address> saveManyOrFail(iterable $entities, array $options = [])
|
||||||
* @method iterable<Address>|ResultSetInterface<Address>|false deleteMany(iterable $entities, array $options = [])
|
* @method iterable<Address>|ResultSetInterface<Address>|false deleteMany(iterable $entities, array $options = [])
|
||||||
* @method iterable<Address>|ResultSetInterface<Address> deleteManyOrFail(iterable $entities, array $options = [])
|
* @method iterable<Address>|ResultSetInterface<Address> deleteManyOrFail(iterable $entities, array $options = [])
|
||||||
*/
|
*/
|
||||||
class AddressesTable extends Table
|
class AddressesTable extends Table {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Initialize method
|
* Initialize method
|
||||||
*
|
*
|
||||||
* @param array<string, mixed> $config The configuration for the Table.
|
* @param array<string, mixed> $config The configuration for the Table.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initialize(array $config): void
|
public function initialize(array $config): void {
|
||||||
{
|
parent::initialize($config);
|
||||||
parent::initialize($config);
|
|
||||||
|
|
||||||
$this->setTable('addresses');
|
$this->setTable('addresses');
|
||||||
$this->setDisplayField('address_line1');
|
$this->setDisplayField('address_line1');
|
||||||
$this->setPrimaryKey('id');
|
$this->setPrimaryKey('id');
|
||||||
|
|
||||||
$this->belongsTo('Cities', [
|
$this->belongsTo('Cities', [
|
||||||
'foreignKey' => 'city_id',
|
'foreignKey' => 'city_id',
|
||||||
'className' => 'CakeAddresses.Cities',
|
'className' => 'CakeAddresses.Cities',
|
||||||
'propertyName' => 'city_entity',
|
'propertyName' => 'city_entity',
|
||||||
]);
|
]);
|
||||||
$this->belongsTo('States', [
|
$this->belongsTo('States', [
|
||||||
'foreignKey' => 'state_id',
|
'foreignKey' => 'state_id',
|
||||||
'className' => 'CakeAddresses.States',
|
'className' => 'CakeAddresses.States',
|
||||||
'propertyName' => 'state_entity',
|
'propertyName' => 'state_entity',
|
||||||
]);
|
]);
|
||||||
$this->belongsTo('Countries', [
|
$this->belongsTo('Countries', [
|
||||||
'foreignKey' => 'country_id',
|
'foreignKey' => 'country_id',
|
||||||
'className' => 'CakeAddresses.Countries',
|
'className' => 'CakeAddresses.Countries',
|
||||||
'propertyName' => 'country_entity',
|
'propertyName' => 'country_entity',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default validation rules.
|
* Default validation rules.
|
||||||
*
|
*
|
||||||
* @param Validator $validator Validator instance.
|
* @param \Cake\Validation\Validator $validator Validator instance.
|
||||||
* @return Validator
|
* @return \Cake\Validation\Validator
|
||||||
*/
|
*/
|
||||||
public function validationDefault(Validator $validator): Validator
|
public function validationDefault(Validator $validator): Validator {
|
||||||
{
|
$validator
|
||||||
$validator
|
->scalar('address_name')
|
||||||
->scalar('address_name')
|
->maxLength('address_name', 255)
|
||||||
->maxLength('address_name', 255)
|
->allowEmptyString('address_name');
|
||||||
->allowEmptyString('address_name');
|
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('contact_name')
|
->scalar('contact_name')
|
||||||
->maxLength('contact_name', 255)
|
->maxLength('contact_name', 255)
|
||||||
->allowEmptyString('contact_name');
|
->allowEmptyString('contact_name');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('address_line1')
|
->scalar('address_line1')
|
||||||
->maxLength('address_line1', 255)
|
->maxLength('address_line1', 255)
|
||||||
->requirePresence('address_line1', 'create')
|
->requirePresence('address_line1', 'create')
|
||||||
->notEmptyString('address_line1');
|
->notEmptyString('address_line1');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('address_line2')
|
->scalar('address_line2')
|
||||||
->maxLength('address_line2', 255)
|
->maxLength('address_line2', 255)
|
||||||
->allowEmptyString('address_line2');
|
->allowEmptyString('address_line2');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('city')
|
->scalar('city')
|
||||||
->maxLength('city', 255)
|
->maxLength('city', 255)
|
||||||
->requirePresence('city', 'create')
|
->requirePresence('city', 'create')
|
||||||
->notEmptyString('city');
|
->notEmptyString('city');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->integer('city_id')
|
->integer('city_id')
|
||||||
->allowEmptyString('city_id');
|
->allowEmptyString('city_id');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('state')
|
->scalar('state')
|
||||||
->maxLength('state', 255)
|
->maxLength('state', 255)
|
||||||
->requirePresence('state', 'create')
|
->requirePresence('state', 'create')
|
||||||
->notEmptyString('state');
|
->notEmptyString('state');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->integer('state_id')
|
->integer('state_id')
|
||||||
->allowEmptyString('state_id');
|
->allowEmptyString('state_id');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('postal_code')
|
->scalar('postal_code')
|
||||||
->maxLength('postal_code', 25)
|
->maxLength('postal_code', 25)
|
||||||
->requirePresence('postal_code', 'create')
|
->requirePresence('postal_code', 'create')
|
||||||
->notEmptyString('postal_code');
|
->notEmptyString('postal_code');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('country')
|
->scalar('country')
|
||||||
->maxLength('country', 255)
|
->maxLength('country', 255)
|
||||||
->requirePresence('country', 'create')
|
->requirePresence('country', 'create')
|
||||||
->notEmptyString('country');
|
->notEmptyString('country');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->integer('country_id')
|
->integer('country_id')
|
||||||
->allowEmptyString('country_id');
|
->allowEmptyString('country_id');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('phone_number')
|
->scalar('phone_number')
|
||||||
->maxLength('phone_number', 25)
|
->maxLength('phone_number', 25)
|
||||||
->allowEmptyString('phone_number');
|
->allowEmptyString('phone_number');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->email('email')
|
->email('email')
|
||||||
->allowEmptyString('email');
|
->allowEmptyString('email');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('notes')
|
->scalar('notes')
|
||||||
->allowEmptyString('notes');
|
->allowEmptyString('notes');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('foreign_key')
|
->scalar('foreign_key')
|
||||||
->maxLength('foreign_key', 45)
|
->maxLength('foreign_key', 45)
|
||||||
->allowEmptyString('foreign_key');
|
->allowEmptyString('foreign_key');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('model')
|
->scalar('model')
|
||||||
->maxLength('model', 255)
|
->maxLength('model', 255)
|
||||||
->allowEmptyString('model');
|
->allowEmptyString('model');
|
||||||
|
|
||||||
return $validator;
|
return $validator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a rules checker object that will be used for validating
|
* Returns a rules checker object that will be used for validating
|
||||||
* application integrity.
|
* application integrity.
|
||||||
*
|
*
|
||||||
* @param RulesChecker $rules The rules object to be modified.
|
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
|
||||||
* @return RulesChecker
|
* @return \Cake\ORM\RulesChecker
|
||||||
*/
|
*/
|
||||||
public function buildRules(RulesChecker $rules): RulesChecker
|
public function buildRules(RulesChecker $rules): RulesChecker {
|
||||||
{
|
$rules->add($rules->existsIn('city_id', 'Cities'), ['errorField' => 'city_id']);
|
||||||
$rules->add($rules->existsIn('city_id', 'Cities'), ['errorField' => 'city_id']);
|
$rules->add($rules->existsIn('state_id', 'States'), ['errorField' => 'state_id']);
|
||||||
$rules->add($rules->existsIn('state_id', 'States'), ['errorField' => 'state_id']);
|
$rules->add($rules->existsIn('country_id', 'Countries'), ['errorField' => 'country_id']);
|
||||||
$rules->add($rules->existsIn('country_id', 'Countries'), ['errorField' => 'country_id']);
|
|
||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param EventInterface $event
|
* @param \Cake\Event\EventInterface $event
|
||||||
* @param ArrayObject $data
|
* @param \ArrayObject $data
|
||||||
* @param ArrayObject $options
|
* @param \ArrayObject $options
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function beforeMarshal(EventInterface $event, ArrayObject $data, ArrayObject $options): void
|
public function beforeMarshal(EventInterface $event, ArrayObject $data, ArrayObject $options): void {
|
||||||
{
|
if ($data['state_id'] && !isset($data['state'])) {
|
||||||
if ($data['state_id'] && !isset($data['state'])) {
|
$state = $this->States->find()->where(['id' => $data['state_id']])->first();
|
||||||
$state = $this->States->find()->where(['id' => $data['state_id']])->first();
|
$data['state'] = $state->name ?? null;
|
||||||
$data['state'] = $state->name ?? null;
|
}
|
||||||
}
|
if ($data['country_id'] && !isset($data['country'])) {
|
||||||
if ($data['country_id'] && !isset($data['country'])) {
|
$country = $this->Countries->find()->where(['id' => $data['country_id']])->first();
|
||||||
$country = $this->Countries->find()->where(['id' => $data['country_id']])->first();
|
$data['country'] = $country->name ?? null;
|
||||||
$data['country'] = $country->name ?? null;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace CakeAddresses\Model\Table;
|
namespace CakeAddresses\Model\Table;
|
||||||
|
|
||||||
use Cake\ORM\Query\SelectQuery;
|
|
||||||
use Cake\ORM\RulesChecker;
|
use Cake\ORM\RulesChecker;
|
||||||
use Cake\ORM\Table;
|
use Cake\ORM\Table;
|
||||||
use Cake\Validation\Validator;
|
use Cake\Validation\Validator;
|
||||||
@@ -29,114 +28,112 @@ use Cake\Validation\Validator;
|
|||||||
* @method iterable<\CakeAddresses\Model\Entity\City>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\City>|false deleteMany(iterable $entities, array $options = [])
|
* @method iterable<\CakeAddresses\Model\Entity\City>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\City>|false deleteMany(iterable $entities, array $options = [])
|
||||||
* @method iterable<\CakeAddresses\Model\Entity\City>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\City> deleteManyOrFail(iterable $entities, array $options = [])
|
* @method iterable<\CakeAddresses\Model\Entity\City>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\City> deleteManyOrFail(iterable $entities, array $options = [])
|
||||||
*/
|
*/
|
||||||
class CitiesTable extends Table
|
class CitiesTable extends Table {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Initialize method
|
* Initialize method
|
||||||
*
|
*
|
||||||
* @param array<string, mixed> $config The configuration for the Table.
|
* @param array<string, mixed> $config The configuration for the Table.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initialize(array $config): void
|
public function initialize(array $config): void {
|
||||||
{
|
parent::initialize($config);
|
||||||
parent::initialize($config);
|
|
||||||
|
|
||||||
$this->setTable('cities');
|
$this->setTable('cities');
|
||||||
$this->setDisplayField('name');
|
$this->setDisplayField('name');
|
||||||
$this->setPrimaryKey('id');
|
$this->setPrimaryKey('id');
|
||||||
|
|
||||||
$this->belongsTo('States', [
|
$this->belongsTo('States', [
|
||||||
'foreignKey' => 'state_id',
|
'foreignKey' => 'state_id',
|
||||||
'joinType' => 'INNER',
|
'joinType' => 'INNER',
|
||||||
'className' => 'CakeAddresses.States',
|
'className' => 'CakeAddresses.States',
|
||||||
]);
|
]);
|
||||||
$this->belongsTo('Countries', [
|
$this->belongsTo('Countries', [
|
||||||
'foreignKey' => 'country_id',
|
'foreignKey' => 'country_id',
|
||||||
'joinType' => 'INNER',
|
'joinType' => 'INNER',
|
||||||
'className' => 'CakeAddresses.Countries',
|
'className' => 'CakeAddresses.Countries',
|
||||||
]);
|
]);
|
||||||
$this->hasMany('Addresses', [
|
$this->hasMany('Addresses', [
|
||||||
'foreignKey' => 'city_id',
|
'foreignKey' => 'city_id',
|
||||||
'className' => 'CakeAddresses.Addresses',
|
'className' => 'CakeAddresses.Addresses',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default validation rules.
|
* Default validation rules.
|
||||||
*
|
*
|
||||||
* @param \Cake\Validation\Validator $validator Validator instance.
|
* @param \Cake\Validation\Validator $validator Validator instance.
|
||||||
* @return \Cake\Validation\Validator
|
* @return \Cake\Validation\Validator
|
||||||
*/
|
*/
|
||||||
public function validationDefault(Validator $validator): Validator
|
public function validationDefault(Validator $validator): Validator {
|
||||||
{
|
$validator
|
||||||
$validator
|
->scalar('name')
|
||||||
->scalar('name')
|
->maxLength('name', 255)
|
||||||
->maxLength('name', 255)
|
->requirePresence('name', 'create')
|
||||||
->requirePresence('name', 'create')
|
->notEmptyString('name');
|
||||||
->notEmptyString('name');
|
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->nonNegativeInteger('state_id')
|
->nonNegativeInteger('state_id')
|
||||||
->notEmptyString('state_id');
|
->notEmptyString('state_id');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('state_code')
|
->scalar('state_code')
|
||||||
->maxLength('state_code', 255)
|
->maxLength('state_code', 255)
|
||||||
->requirePresence('state_code', 'create')
|
->requirePresence('state_code', 'create')
|
||||||
->notEmptyString('state_code');
|
->notEmptyString('state_code');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->nonNegativeInteger('country_id')
|
->nonNegativeInteger('country_id')
|
||||||
->notEmptyString('country_id');
|
->notEmptyString('country_id');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('country_code')
|
->scalar('country_code')
|
||||||
->maxLength('country_code', 2)
|
->maxLength('country_code', 2)
|
||||||
->requirePresence('country_code', 'create')
|
->requirePresence('country_code', 'create')
|
||||||
->notEmptyString('country_code');
|
->notEmptyString('country_code');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->decimal('latitude')
|
->decimal('latitude')
|
||||||
->requirePresence('latitude', 'create')
|
->requirePresence('latitude', 'create')
|
||||||
->notEmptyString('latitude');
|
->notEmptyString('latitude');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->decimal('longitude')
|
->decimal('longitude')
|
||||||
->requirePresence('longitude', 'create')
|
->requirePresence('longitude', 'create')
|
||||||
->notEmptyString('longitude');
|
->notEmptyString('longitude');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->dateTime('created_at')
|
->dateTime('created_at')
|
||||||
->notEmptyDateTime('created_at');
|
->notEmptyDateTime('created_at');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->dateTime('updated_at')
|
->dateTime('updated_at')
|
||||||
->notEmptyDateTime('updated_at');
|
->notEmptyDateTime('updated_at');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->boolean('flag')
|
->boolean('flag')
|
||||||
->notEmptyString('flag');
|
->notEmptyString('flag');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('wikiDataId')
|
->scalar('wikiDataId')
|
||||||
->maxLength('wikiDataId', 255)
|
->maxLength('wikiDataId', 255)
|
||||||
->allowEmptyString('wikiDataId');
|
->allowEmptyString('wikiDataId');
|
||||||
|
|
||||||
return $validator;
|
return $validator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a rules checker object that will be used for validating
|
* Returns a rules checker object that will be used for validating
|
||||||
* application integrity.
|
* application integrity.
|
||||||
*
|
*
|
||||||
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
|
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
|
||||||
* @return \Cake\ORM\RulesChecker
|
* @return \Cake\ORM\RulesChecker
|
||||||
*/
|
*/
|
||||||
public function buildRules(RulesChecker $rules): RulesChecker
|
public function buildRules(RulesChecker $rules): RulesChecker {
|
||||||
{
|
$rules->add($rules->existsIn('state_id', 'States'), ['errorField' => 'state_id']);
|
||||||
$rules->add($rules->existsIn('state_id', 'States'), ['errorField' => 'state_id']);
|
$rules->add($rules->existsIn('country_id', 'Countries'), ['errorField' => 'country_id']);
|
||||||
$rules->add($rules->existsIn('country_id', 'Countries'), ['errorField' => 'country_id']);
|
|
||||||
|
return $rules;
|
||||||
|
}
|
||||||
|
|
||||||
return $rules;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace CakeAddresses\Model\Table;
|
namespace CakeAddresses\Model\Table;
|
||||||
|
|
||||||
use Cake\ORM\Query\SelectQuery;
|
|
||||||
use Cake\ORM\RulesChecker;
|
use Cake\ORM\RulesChecker;
|
||||||
use Cake\ORM\Table;
|
use Cake\ORM\Table;
|
||||||
use Cake\Validation\Validator;
|
use Cake\Validation\Validator;
|
||||||
@@ -31,191 +30,189 @@ use Cake\Validation\Validator;
|
|||||||
* @method iterable<\CakeAddresses\Model\Entity\Country>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\Country>|false deleteMany(iterable $entities, array $options = [])
|
* @method iterable<\CakeAddresses\Model\Entity\Country>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\Country>|false deleteMany(iterable $entities, array $options = [])
|
||||||
* @method iterable<\CakeAddresses\Model\Entity\Country>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\Country> deleteManyOrFail(iterable $entities, array $options = [])
|
* @method iterable<\CakeAddresses\Model\Entity\Country>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\Country> deleteManyOrFail(iterable $entities, array $options = [])
|
||||||
*/
|
*/
|
||||||
class CountriesTable extends Table
|
class CountriesTable extends Table {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Initialize method
|
* Initialize method
|
||||||
*
|
*
|
||||||
* @param array<string, mixed> $config The configuration for the Table.
|
* @param array<string, mixed> $config The configuration for the Table.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initialize(array $config): void
|
public function initialize(array $config): void {
|
||||||
{
|
parent::initialize($config);
|
||||||
parent::initialize($config);
|
|
||||||
|
|
||||||
$this->setTable('countries');
|
$this->setTable('countries');
|
||||||
$this->setDisplayField('name');
|
$this->setDisplayField('name');
|
||||||
$this->setPrimaryKey('id');
|
$this->setPrimaryKey('id');
|
||||||
|
|
||||||
$this->belongsTo('Regions', [
|
$this->belongsTo('Regions', [
|
||||||
'foreignKey' => 'region_id',
|
'foreignKey' => 'region_id',
|
||||||
'className' => 'CakeAddresses.Regions',
|
'className' => 'CakeAddresses.Regions',
|
||||||
'propertyName' => 'region_entity',
|
'propertyName' => 'region_entity',
|
||||||
]);
|
]);
|
||||||
$this->belongsTo('Subregions', [
|
$this->belongsTo('Subregions', [
|
||||||
'foreignKey' => 'subregion_id',
|
'foreignKey' => 'subregion_id',
|
||||||
'className' => 'CakeAddresses.Subregions',
|
'className' => 'CakeAddresses.Subregions',
|
||||||
'propertyName' => 'subregion_entity',
|
'propertyName' => 'subregion_entity',
|
||||||
]);
|
]);
|
||||||
$this->hasMany('Addresses', [
|
$this->hasMany('Addresses', [
|
||||||
'foreignKey' => 'country_id',
|
'foreignKey' => 'country_id',
|
||||||
'className' => 'CakeAddresses.Addresses',
|
'className' => 'CakeAddresses.Addresses',
|
||||||
]);
|
]);
|
||||||
$this->hasMany('Cities', [
|
$this->hasMany('Cities', [
|
||||||
'foreignKey' => 'country_id',
|
'foreignKey' => 'country_id',
|
||||||
'className' => 'CakeAddresses.Cities',
|
'className' => 'CakeAddresses.Cities',
|
||||||
]);
|
]);
|
||||||
$this->hasMany('States', [
|
$this->hasMany('States', [
|
||||||
'foreignKey' => 'country_id',
|
'foreignKey' => 'country_id',
|
||||||
'className' => 'CakeAddresses.States',
|
'className' => 'CakeAddresses.States',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default validation rules.
|
* Default validation rules.
|
||||||
*
|
*
|
||||||
* @param \Cake\Validation\Validator $validator Validator instance.
|
* @param \Cake\Validation\Validator $validator Validator instance.
|
||||||
* @return \Cake\Validation\Validator
|
* @return \Cake\Validation\Validator
|
||||||
*/
|
*/
|
||||||
public function validationDefault(Validator $validator): Validator
|
public function validationDefault(Validator $validator): Validator {
|
||||||
{
|
$validator
|
||||||
$validator
|
->scalar('name')
|
||||||
->scalar('name')
|
->maxLength('name', 100)
|
||||||
->maxLength('name', 100)
|
->requirePresence('name', 'create')
|
||||||
->requirePresence('name', 'create')
|
->notEmptyString('name');
|
||||||
->notEmptyString('name');
|
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('iso3')
|
->scalar('iso3')
|
||||||
->maxLength('iso3', 3)
|
->maxLength('iso3', 3)
|
||||||
->allowEmptyString('iso3');
|
->allowEmptyString('iso3');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('numeric_code')
|
->scalar('numeric_code')
|
||||||
->maxLength('numeric_code', 3)
|
->maxLength('numeric_code', 3)
|
||||||
->allowEmptyString('numeric_code');
|
->allowEmptyString('numeric_code');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('iso2')
|
->scalar('iso2')
|
||||||
->maxLength('iso2', 2)
|
->maxLength('iso2', 2)
|
||||||
->allowEmptyString('iso2');
|
->allowEmptyString('iso2');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('phonecode')
|
->scalar('phonecode')
|
||||||
->maxLength('phonecode', 255)
|
->maxLength('phonecode', 255)
|
||||||
->allowEmptyString('phonecode');
|
->allowEmptyString('phonecode');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('capital')
|
->scalar('capital')
|
||||||
->maxLength('capital', 255)
|
->maxLength('capital', 255)
|
||||||
->allowEmptyString('capital');
|
->allowEmptyString('capital');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('currency')
|
->scalar('currency')
|
||||||
->maxLength('currency', 255)
|
->maxLength('currency', 255)
|
||||||
->allowEmptyString('currency');
|
->allowEmptyString('currency');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('currency_name')
|
->scalar('currency_name')
|
||||||
->maxLength('currency_name', 255)
|
->maxLength('currency_name', 255)
|
||||||
->allowEmptyString('currency_name');
|
->allowEmptyString('currency_name');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('currency_symbol')
|
->scalar('currency_symbol')
|
||||||
->maxLength('currency_symbol', 255)
|
->maxLength('currency_symbol', 255)
|
||||||
->allowEmptyString('currency_symbol');
|
->allowEmptyString('currency_symbol');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('tld')
|
->scalar('tld')
|
||||||
->maxLength('tld', 255)
|
->maxLength('tld', 255)
|
||||||
->allowEmptyString('tld');
|
->allowEmptyString('tld');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('native')
|
->scalar('native')
|
||||||
->maxLength('native', 255)
|
->maxLength('native', 255)
|
||||||
->allowEmptyString('native');
|
->allowEmptyString('native');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('region')
|
->scalar('region')
|
||||||
->maxLength('region', 255)
|
->maxLength('region', 255)
|
||||||
->allowEmptyString('region');
|
->allowEmptyString('region');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->nonNegativeInteger('region_id')
|
->nonNegativeInteger('region_id')
|
||||||
->allowEmptyString('region_id');
|
->allowEmptyString('region_id');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('subregion')
|
->scalar('subregion')
|
||||||
->maxLength('subregion', 255)
|
->maxLength('subregion', 255)
|
||||||
->allowEmptyString('subregion');
|
->allowEmptyString('subregion');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->nonNegativeInteger('subregion_id')
|
->nonNegativeInteger('subregion_id')
|
||||||
->allowEmptyString('subregion_id');
|
->allowEmptyString('subregion_id');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('nationality')
|
->scalar('nationality')
|
||||||
->maxLength('nationality', 255)
|
->maxLength('nationality', 255)
|
||||||
->allowEmptyString('nationality');
|
->allowEmptyString('nationality');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('timezones')
|
->scalar('timezones')
|
||||||
->allowEmptyString('timezones');
|
->allowEmptyString('timezones');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('translations')
|
->scalar('translations')
|
||||||
->allowEmptyString('translations');
|
->allowEmptyString('translations');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->decimal('latitude')
|
->decimal('latitude')
|
||||||
->allowEmptyString('latitude');
|
->allowEmptyString('latitude');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->decimal('longitude')
|
->decimal('longitude')
|
||||||
->allowEmptyString('longitude');
|
->allowEmptyString('longitude');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('emoji')
|
->scalar('emoji')
|
||||||
->maxLength('emoji', 191)
|
->maxLength('emoji', 191)
|
||||||
->allowEmptyString('emoji');
|
->allowEmptyString('emoji');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('emojiU')
|
->scalar('emojiU')
|
||||||
->maxLength('emojiU', 191)
|
->maxLength('emojiU', 191)
|
||||||
->allowEmptyString('emojiU');
|
->allowEmptyString('emojiU');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->dateTime('created_at')
|
->dateTime('created_at')
|
||||||
->allowEmptyDateTime('created_at');
|
->allowEmptyDateTime('created_at');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->dateTime('updated_at')
|
->dateTime('updated_at')
|
||||||
->notEmptyDateTime('updated_at');
|
->notEmptyDateTime('updated_at');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->boolean('flag')
|
->boolean('flag')
|
||||||
->notEmptyString('flag');
|
->notEmptyString('flag');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('wikiDataId')
|
->scalar('wikiDataId')
|
||||||
->maxLength('wikiDataId', 255)
|
->maxLength('wikiDataId', 255)
|
||||||
->allowEmptyString('wikiDataId');
|
->allowEmptyString('wikiDataId');
|
||||||
|
|
||||||
return $validator;
|
return $validator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a rules checker object that will be used for validating
|
* Returns a rules checker object that will be used for validating
|
||||||
* application integrity.
|
* application integrity.
|
||||||
*
|
*
|
||||||
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
|
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
|
||||||
* @return \Cake\ORM\RulesChecker
|
* @return \Cake\ORM\RulesChecker
|
||||||
*/
|
*/
|
||||||
public function buildRules(RulesChecker $rules): RulesChecker
|
public function buildRules(RulesChecker $rules): RulesChecker {
|
||||||
{
|
$rules->add($rules->existsIn('region_id', 'Regions'), ['errorField' => 'region_id']);
|
||||||
$rules->add($rules->existsIn('region_id', 'Regions'), ['errorField' => 'region_id']);
|
$rules->add($rules->existsIn('subregion_id', 'Subregions'), ['errorField' => 'subregion_id']);
|
||||||
$rules->add($rules->existsIn('subregion_id', 'Subregions'), ['errorField' => 'subregion_id']);
|
|
||||||
|
return $rules;
|
||||||
|
}
|
||||||
|
|
||||||
return $rules;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace CakeAddresses\Model\Table;
|
namespace CakeAddresses\Model\Table;
|
||||||
|
|
||||||
use Cake\ORM\Query\SelectQuery;
|
|
||||||
use Cake\ORM\RulesChecker;
|
|
||||||
use Cake\ORM\Table;
|
use Cake\ORM\Table;
|
||||||
use Cake\Validation\Validator;
|
use Cake\Validation\Validator;
|
||||||
|
|
||||||
@@ -28,67 +26,66 @@ use Cake\Validation\Validator;
|
|||||||
* @method iterable<\CakeAddresses\Model\Entity\Region>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\Region>|false deleteMany(iterable $entities, array $options = [])
|
* @method iterable<\CakeAddresses\Model\Entity\Region>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\Region>|false deleteMany(iterable $entities, array $options = [])
|
||||||
* @method iterable<\CakeAddresses\Model\Entity\Region>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\Region> deleteManyOrFail(iterable $entities, array $options = [])
|
* @method iterable<\CakeAddresses\Model\Entity\Region>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\Region> deleteManyOrFail(iterable $entities, array $options = [])
|
||||||
*/
|
*/
|
||||||
class RegionsTable extends Table
|
class RegionsTable extends Table {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Initialize method
|
* Initialize method
|
||||||
*
|
*
|
||||||
* @param array<string, mixed> $config The configuration for the Table.
|
* @param array<string, mixed> $config The configuration for the Table.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initialize(array $config): void
|
public function initialize(array $config): void {
|
||||||
{
|
parent::initialize($config);
|
||||||
parent::initialize($config);
|
|
||||||
|
|
||||||
$this->setTable('regions');
|
$this->setTable('regions');
|
||||||
$this->setDisplayField('name');
|
$this->setDisplayField('name');
|
||||||
$this->setPrimaryKey('id');
|
$this->setPrimaryKey('id');
|
||||||
|
|
||||||
$this->hasMany('Countries', [
|
$this->hasMany('Countries', [
|
||||||
'foreignKey' => 'region_id',
|
'foreignKey' => 'region_id',
|
||||||
'className' => 'CakeAddresses.Countries',
|
'className' => 'CakeAddresses.Countries',
|
||||||
]);
|
]);
|
||||||
$this->hasMany('Subregions', [
|
$this->hasMany('Subregions', [
|
||||||
'foreignKey' => 'region_id',
|
'foreignKey' => 'region_id',
|
||||||
'className' => 'CakeAddresses.Subregions',
|
'className' => 'CakeAddresses.Subregions',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default validation rules.
|
* Default validation rules.
|
||||||
*
|
*
|
||||||
* @param \Cake\Validation\Validator $validator Validator instance.
|
* @param \Cake\Validation\Validator $validator Validator instance.
|
||||||
* @return \Cake\Validation\Validator
|
* @return \Cake\Validation\Validator
|
||||||
*/
|
*/
|
||||||
public function validationDefault(Validator $validator): Validator
|
public function validationDefault(Validator $validator): Validator {
|
||||||
{
|
$validator
|
||||||
$validator
|
->scalar('name')
|
||||||
->scalar('name')
|
->maxLength('name', 100)
|
||||||
->maxLength('name', 100)
|
->requirePresence('name', 'create')
|
||||||
->requirePresence('name', 'create')
|
->notEmptyString('name');
|
||||||
->notEmptyString('name');
|
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('translations')
|
->scalar('translations')
|
||||||
->allowEmptyString('translations');
|
->allowEmptyString('translations');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->dateTime('created_at')
|
->dateTime('created_at')
|
||||||
->allowEmptyDateTime('created_at');
|
->allowEmptyDateTime('created_at');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->dateTime('updated_at')
|
->dateTime('updated_at')
|
||||||
->notEmptyDateTime('updated_at');
|
->notEmptyDateTime('updated_at');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->boolean('flag')
|
->boolean('flag')
|
||||||
->notEmptyString('flag');
|
->notEmptyString('flag');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('wikiDataId')
|
->scalar('wikiDataId')
|
||||||
->maxLength('wikiDataId', 255)
|
->maxLength('wikiDataId', 255)
|
||||||
->allowEmptyString('wikiDataId');
|
->allowEmptyString('wikiDataId');
|
||||||
|
|
||||||
|
return $validator;
|
||||||
|
}
|
||||||
|
|
||||||
return $validator;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace CakeAddresses\Model\Table;
|
namespace CakeAddresses\Model\Table;
|
||||||
|
|
||||||
use Cake\ORM\Query\SelectQuery;
|
|
||||||
use Cake\ORM\RulesChecker;
|
use Cake\ORM\RulesChecker;
|
||||||
use Cake\ORM\Table;
|
use Cake\ORM\Table;
|
||||||
use Cake\Validation\Validator;
|
use Cake\Validation\Validator;
|
||||||
@@ -29,115 +28,113 @@ use Cake\Validation\Validator;
|
|||||||
* @method iterable<\CakeAddresses\Model\Entity\State>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\State>|false deleteMany(iterable $entities, array $options = [])
|
* @method iterable<\CakeAddresses\Model\Entity\State>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\State>|false deleteMany(iterable $entities, array $options = [])
|
||||||
* @method iterable<\CakeAddresses\Model\Entity\State>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\State> deleteManyOrFail(iterable $entities, array $options = [])
|
* @method iterable<\CakeAddresses\Model\Entity\State>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\State> deleteManyOrFail(iterable $entities, array $options = [])
|
||||||
*/
|
*/
|
||||||
class StatesTable extends Table
|
class StatesTable extends Table {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Initialize method
|
* Initialize method
|
||||||
*
|
*
|
||||||
* @param array<string, mixed> $config The configuration for the Table.
|
* @param array<string, mixed> $config The configuration for the Table.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initialize(array $config): void
|
public function initialize(array $config): void {
|
||||||
{
|
parent::initialize($config);
|
||||||
parent::initialize($config);
|
|
||||||
|
|
||||||
$this->setTable('states');
|
$this->setTable('states');
|
||||||
$this->setDisplayField('name');
|
$this->setDisplayField('name');
|
||||||
$this->setPrimaryKey('id');
|
$this->setPrimaryKey('id');
|
||||||
|
|
||||||
$this->belongsTo('Countries', [
|
$this->belongsTo('Countries', [
|
||||||
'foreignKey' => 'country_id',
|
'foreignKey' => 'country_id',
|
||||||
'joinType' => 'INNER',
|
'joinType' => 'INNER',
|
||||||
'className' => 'CakeAddresses.Countries',
|
'className' => 'CakeAddresses.Countries',
|
||||||
]);
|
]);
|
||||||
$this->hasMany('Addresses', [
|
$this->hasMany('Addresses', [
|
||||||
'foreignKey' => 'state_id',
|
'foreignKey' => 'state_id',
|
||||||
'className' => 'CakeAddresses.Addresses',
|
'className' => 'CakeAddresses.Addresses',
|
||||||
]);
|
]);
|
||||||
$this->hasMany('Cities', [
|
$this->hasMany('Cities', [
|
||||||
'foreignKey' => 'state_id',
|
'foreignKey' => 'state_id',
|
||||||
'className' => 'CakeAddresses.Cities',
|
'className' => 'CakeAddresses.Cities',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default validation rules.
|
* Default validation rules.
|
||||||
*
|
*
|
||||||
* @param \Cake\Validation\Validator $validator Validator instance.
|
* @param \Cake\Validation\Validator $validator Validator instance.
|
||||||
* @return \Cake\Validation\Validator
|
* @return \Cake\Validation\Validator
|
||||||
*/
|
*/
|
||||||
public function validationDefault(Validator $validator): Validator
|
public function validationDefault(Validator $validator): Validator {
|
||||||
{
|
$validator
|
||||||
$validator
|
->scalar('name')
|
||||||
->scalar('name')
|
->maxLength('name', 255)
|
||||||
->maxLength('name', 255)
|
->requirePresence('name', 'create')
|
||||||
->requirePresence('name', 'create')
|
->notEmptyString('name');
|
||||||
->notEmptyString('name');
|
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->nonNegativeInteger('country_id')
|
->nonNegativeInteger('country_id')
|
||||||
->notEmptyString('country_id');
|
->notEmptyString('country_id');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('country_code')
|
->scalar('country_code')
|
||||||
->maxLength('country_code', 2)
|
->maxLength('country_code', 2)
|
||||||
->requirePresence('country_code', 'create')
|
->requirePresence('country_code', 'create')
|
||||||
->notEmptyString('country_code');
|
->notEmptyString('country_code');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('fips_code')
|
->scalar('fips_code')
|
||||||
->maxLength('fips_code', 255)
|
->maxLength('fips_code', 255)
|
||||||
->allowEmptyString('fips_code');
|
->allowEmptyString('fips_code');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('iso2')
|
->scalar('iso2')
|
||||||
->maxLength('iso2', 255)
|
->maxLength('iso2', 255)
|
||||||
->allowEmptyString('iso2');
|
->allowEmptyString('iso2');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('type')
|
->scalar('type')
|
||||||
->maxLength('type', 191)
|
->maxLength('type', 191)
|
||||||
->allowEmptyString('type');
|
->allowEmptyString('type');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->decimal('latitude')
|
->decimal('latitude')
|
||||||
->allowEmptyString('latitude');
|
->allowEmptyString('latitude');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->decimal('longitude')
|
->decimal('longitude')
|
||||||
->allowEmptyString('longitude');
|
->allowEmptyString('longitude');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->dateTime('created_at')
|
->dateTime('created_at')
|
||||||
->allowEmptyDateTime('created_at');
|
->allowEmptyDateTime('created_at');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->dateTime('updated_at')
|
->dateTime('updated_at')
|
||||||
->notEmptyDateTime('updated_at');
|
->notEmptyDateTime('updated_at');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->boolean('flag')
|
->boolean('flag')
|
||||||
->notEmptyString('flag');
|
->notEmptyString('flag');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('wikiDataId')
|
->scalar('wikiDataId')
|
||||||
->maxLength('wikiDataId', 255)
|
->maxLength('wikiDataId', 255)
|
||||||
->allowEmptyString('wikiDataId');
|
->allowEmptyString('wikiDataId');
|
||||||
|
|
||||||
return $validator;
|
return $validator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a rules checker object that will be used for validating
|
* Returns a rules checker object that will be used for validating
|
||||||
* application integrity.
|
* application integrity.
|
||||||
*
|
*
|
||||||
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
|
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
|
||||||
* @return \Cake\ORM\RulesChecker
|
* @return \Cake\ORM\RulesChecker
|
||||||
*/
|
*/
|
||||||
public function buildRules(RulesChecker $rules): RulesChecker
|
public function buildRules(RulesChecker $rules): RulesChecker {
|
||||||
{
|
$rules->add($rules->existsIn('country_id', 'Countries'), ['errorField' => 'country_id']);
|
||||||
$rules->add($rules->existsIn('country_id', 'Countries'), ['errorField' => 'country_id']);
|
|
||||||
|
return $rules;
|
||||||
|
}
|
||||||
|
|
||||||
return $rules;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace CakeAddresses\Model\Table;
|
namespace CakeAddresses\Model\Table;
|
||||||
|
|
||||||
use Cake\ORM\Query\SelectQuery;
|
|
||||||
use Cake\ORM\RulesChecker;
|
use Cake\ORM\RulesChecker;
|
||||||
use Cake\ORM\Table;
|
use Cake\ORM\Table;
|
||||||
use Cake\Validation\Validator;
|
use Cake\Validation\Validator;
|
||||||
@@ -28,86 +27,84 @@ use Cake\Validation\Validator;
|
|||||||
* @method iterable<\CakeAddresses\Model\Entity\Subregion>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\Subregion>|false deleteMany(iterable $entities, array $options = [])
|
* @method iterable<\CakeAddresses\Model\Entity\Subregion>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\Subregion>|false deleteMany(iterable $entities, array $options = [])
|
||||||
* @method iterable<\CakeAddresses\Model\Entity\Subregion>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\Subregion> deleteManyOrFail(iterable $entities, array $options = [])
|
* @method iterable<\CakeAddresses\Model\Entity\Subregion>|\Cake\Datasource\ResultSetInterface<\CakeAddresses\Model\Entity\Subregion> deleteManyOrFail(iterable $entities, array $options = [])
|
||||||
*/
|
*/
|
||||||
class SubregionsTable extends Table
|
class SubregionsTable extends Table {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Initialize method
|
* Initialize method
|
||||||
*
|
*
|
||||||
* @param array<string, mixed> $config The configuration for the Table.
|
* @param array<string, mixed> $config The configuration for the Table.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initialize(array $config): void
|
public function initialize(array $config): void {
|
||||||
{
|
parent::initialize($config);
|
||||||
parent::initialize($config);
|
|
||||||
|
|
||||||
$this->setTable('subregions');
|
$this->setTable('subregions');
|
||||||
$this->setDisplayField('name');
|
$this->setDisplayField('name');
|
||||||
$this->setPrimaryKey('id');
|
$this->setPrimaryKey('id');
|
||||||
|
|
||||||
$this->belongsTo('Regions', [
|
$this->belongsTo('Regions', [
|
||||||
'foreignKey' => 'region_id',
|
'foreignKey' => 'region_id',
|
||||||
'joinType' => 'INNER',
|
'joinType' => 'INNER',
|
||||||
'className' => 'CakeAddresses.Regions',
|
'className' => 'CakeAddresses.Regions',
|
||||||
]);
|
]);
|
||||||
$this->hasMany('Countries', [
|
$this->hasMany('Countries', [
|
||||||
'foreignKey' => 'subregion_id',
|
'foreignKey' => 'subregion_id',
|
||||||
'className' => 'CakeAddresses.Countries',
|
'className' => 'CakeAddresses.Countries',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default validation rules.
|
* Default validation rules.
|
||||||
*
|
*
|
||||||
* @param \Cake\Validation\Validator $validator Validator instance.
|
* @param \Cake\Validation\Validator $validator Validator instance.
|
||||||
* @return \Cake\Validation\Validator
|
* @return \Cake\Validation\Validator
|
||||||
*/
|
*/
|
||||||
public function validationDefault(Validator $validator): Validator
|
public function validationDefault(Validator $validator): Validator {
|
||||||
{
|
$validator
|
||||||
$validator
|
->scalar('name')
|
||||||
->scalar('name')
|
->maxLength('name', 100)
|
||||||
->maxLength('name', 100)
|
->requirePresence('name', 'create')
|
||||||
->requirePresence('name', 'create')
|
->notEmptyString('name');
|
||||||
->notEmptyString('name');
|
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('translations')
|
->scalar('translations')
|
||||||
->allowEmptyString('translations');
|
->allowEmptyString('translations');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->nonNegativeInteger('region_id')
|
->nonNegativeInteger('region_id')
|
||||||
->notEmptyString('region_id');
|
->notEmptyString('region_id');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->dateTime('created_at')
|
->dateTime('created_at')
|
||||||
->allowEmptyDateTime('created_at');
|
->allowEmptyDateTime('created_at');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->dateTime('updated_at')
|
->dateTime('updated_at')
|
||||||
->notEmptyDateTime('updated_at');
|
->notEmptyDateTime('updated_at');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->boolean('flag')
|
->boolean('flag')
|
||||||
->notEmptyString('flag');
|
->notEmptyString('flag');
|
||||||
|
|
||||||
$validator
|
$validator
|
||||||
->scalar('wikiDataId')
|
->scalar('wikiDataId')
|
||||||
->maxLength('wikiDataId', 255)
|
->maxLength('wikiDataId', 255)
|
||||||
->allowEmptyString('wikiDataId');
|
->allowEmptyString('wikiDataId');
|
||||||
|
|
||||||
return $validator;
|
return $validator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a rules checker object that will be used for validating
|
* Returns a rules checker object that will be used for validating
|
||||||
* application integrity.
|
* application integrity.
|
||||||
*
|
*
|
||||||
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
|
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
|
||||||
* @return \Cake\ORM\RulesChecker
|
* @return \Cake\ORM\RulesChecker
|
||||||
*/
|
*/
|
||||||
public function buildRules(RulesChecker $rules): RulesChecker
|
public function buildRules(RulesChecker $rules): RulesChecker {
|
||||||
{
|
$rules->add($rules->existsIn('region_id', 'Regions'), ['errorField' => 'region_id']);
|
||||||
$rules->add($rules->existsIn('region_id', 'Regions'), ['errorField' => 'region_id']);
|
|
||||||
|
return $rules;
|
||||||
|
}
|
||||||
|
|
||||||
return $rules;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,36 +8,36 @@ use Cake\TestSuite\Fixture\TestFixture;
|
|||||||
/**
|
/**
|
||||||
* AddressesFixture
|
* AddressesFixture
|
||||||
*/
|
*/
|
||||||
class AddressesFixture extends TestFixture
|
class AddressesFixture extends TestFixture {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Init method
|
* Init method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function init(): void
|
public function init(): void {
|
||||||
{
|
$this->records = [
|
||||||
$this->records = [
|
[
|
||||||
[
|
'id' => 1,
|
||||||
'id' => 1,
|
'address_name' => 'Apple Headquarters',
|
||||||
'address_name' => 'Apple Headquarters',
|
'contact_name' => 'Steve Jobs',
|
||||||
'contact_name' => 'Steve Jobs',
|
'address_line1' => '1 Apple Park Way',
|
||||||
'address_line1' => '1 Apple Park Way',
|
'address_line2' => null,
|
||||||
'address_line2' => null,
|
'city' => 'San Francisco',
|
||||||
'city' => 'San Francisco',
|
'city_id' => 125809,
|
||||||
'city_id' => 125809,
|
'state' => 'California',
|
||||||
'state' => 'California',
|
'state_id' => 1416,
|
||||||
'state_id' => 1416,
|
'postal_code' => '95014',
|
||||||
'postal_code' => '95014',
|
'country' => 'United States',
|
||||||
'country' => 'United States',
|
'country_id' => 233,
|
||||||
'country_id' => 233,
|
'phone_number' => 'Lorem ipsum dolor sit a',
|
||||||
'phone_number' => 'Lorem ipsum dolor sit a',
|
'email' => 'test@test.com',
|
||||||
'email' => 'test@test.com',
|
'notes' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.',
|
||||||
'notes' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.',
|
'foreign_key' => null,
|
||||||
'foreign_key' => null,
|
'model' => null,
|
||||||
'model' => null,
|
],
|
||||||
],
|
];
|
||||||
];
|
parent::init();
|
||||||
parent::init();
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -10,335 +10,335 @@ use ReflectionClass;
|
|||||||
/**
|
/**
|
||||||
* CountriesFixture
|
* CountriesFixture
|
||||||
*/
|
*/
|
||||||
class CountriesFixture extends TestFixture
|
class CountriesFixture extends TestFixture {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Init method
|
* Init method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function init(): void
|
public function init(): void {
|
||||||
{
|
$this->records = [
|
||||||
$this->records = [
|
[
|
||||||
[
|
'id' => 25,
|
||||||
'id' => 25,
|
'name' => 'Bermuda',
|
||||||
'name' => 'Bermuda',
|
'iso3' => 'BMU',
|
||||||
'iso3' => 'BMU',
|
'numeric_code' => '060',
|
||||||
'numeric_code' => '060',
|
'iso2' => 'BM',
|
||||||
'iso2' => 'BM',
|
'phonecode' => '+1-441',
|
||||||
'phonecode' => '+1-441',
|
'capital' => 'Hamilton',
|
||||||
'capital' => 'Hamilton',
|
'currency' => 'BMD',
|
||||||
'currency' => 'BMD',
|
'currency_name' => 'Bermudian dollar',
|
||||||
'currency_name' => 'Bermudian dollar',
|
'currency_symbol' => '$',
|
||||||
'currency_symbol' => '$',
|
'tld' => '.bm',
|
||||||
'tld' => '.bm',
|
'native' => 'Bermuda',
|
||||||
'native' => 'Bermuda',
|
'region' => 'Americas',
|
||||||
'region' => 'Americas',
|
'region_id' => 2,
|
||||||
'region_id' => 2,
|
'subregion' => 'Northern America',
|
||||||
'subregion' => 'Northern America',
|
'subregion_id' => 6,
|
||||||
'subregion_id' => 6,
|
'nationality' => 'Bermudian, Bermudan',
|
||||||
'nationality' => 'Bermudian, Bermudan',
|
'timezones' => '[{"zoneName":"Atlantic/Bermuda","gmtOffset":-14400,"gmtOffsetName":"UTC-04:00","abbreviation":"AST","tzName":"Atlantic Standard Time"}]',
|
||||||
'timezones' => '[{"zoneName":"Atlantic/Bermuda","gmtOffset":-14400,"gmtOffsetName":"UTC-04:00","abbreviation":"AST","tzName":"Atlantic Standard Time"}]',
|
'translations' => '{"kr":"버뮤다","pt-BR":"Bermudas","pt":"Bermudas","nl":"Bermuda","hr":"Bermudi","fa":"برمودا","de":"Bermuda","es":"Bermudas","fr":"Bermudes","ja":"バミューダ","it":"Bermuda","cn":"百慕大","tr":"Bermuda"}',
|
||||||
'translations' => '{"kr":"버뮤다","pt-BR":"Bermudas","pt":"Bermudas","nl":"Bermuda","hr":"Bermudi","fa":"برمودا","de":"Bermuda","es":"Bermudas","fr":"Bermudes","ja":"バミューダ","it":"Bermuda","cn":"百慕大","tr":"Bermuda"}',
|
'latitude' => (static function() {
|
||||||
'latitude' => (static function() {
|
$class = new ReflectionClass(Decimal::class);
|
||||||
$class = new ReflectionClass(Decimal::class);
|
$object = $class->newInstanceWithoutConstructor();
|
||||||
$object = $class->newInstanceWithoutConstructor();
|
|
||||||
|
(function() {
|
||||||
(function() {
|
$this->integralPart = '32';
|
||||||
$this->integralPart = '32';
|
$this->fractionalPart = '33333333';
|
||||||
$this->fractionalPart = '33333333';
|
$this->negative = false;
|
||||||
$this->negative = false;
|
$this->scale = 8;
|
||||||
$this->scale = 8;
|
})->bindTo($object, Decimal::class)();
|
||||||
})->bindTo($object, Decimal::class)();
|
|
||||||
|
return $object;
|
||||||
return $object;
|
})(),
|
||||||
})(),
|
'longitude' => (static function() {
|
||||||
'longitude' => (static function() {
|
$class = new ReflectionClass(Decimal::class);
|
||||||
$class = new ReflectionClass(Decimal::class);
|
$object = $class->newInstanceWithoutConstructor();
|
||||||
$object = $class->newInstanceWithoutConstructor();
|
|
||||||
|
(function() {
|
||||||
(function() {
|
$this->integralPart = '64';
|
||||||
$this->integralPart = '64';
|
$this->fractionalPart = '75000000';
|
||||||
$this->fractionalPart = '75000000';
|
$this->negative = true;
|
||||||
$this->negative = true;
|
$this->scale = 8;
|
||||||
$this->scale = 8;
|
})->bindTo($object, Decimal::class)();
|
||||||
})->bindTo($object, Decimal::class)();
|
|
||||||
|
return $object;
|
||||||
return $object;
|
})(),
|
||||||
})(),
|
'emoji' => '🇧🇲',
|
||||||
'emoji' => '🇧🇲',
|
'emojiU' => 'U+1F1E7 U+1F1F2',
|
||||||
'emojiU' => 'U+1F1E7 U+1F1F2',
|
'created_at' => '2018-07-21 16:11:03',
|
||||||
'created_at' => '2018-07-21 16:11:03',
|
'updated_at' => '2023-08-09 06:04:58',
|
||||||
'updated_at' => '2023-08-09 06:04:58',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => null,
|
||||||
'wikiDataId' => null,
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 39,
|
||||||
'id' => 39,
|
'name' => 'Canada',
|
||||||
'name' => 'Canada',
|
'iso3' => 'CAN',
|
||||||
'iso3' => 'CAN',
|
'numeric_code' => '124',
|
||||||
'numeric_code' => '124',
|
'iso2' => 'CA',
|
||||||
'iso2' => 'CA',
|
'phonecode' => '1',
|
||||||
'phonecode' => '1',
|
'capital' => 'Ottawa',
|
||||||
'capital' => 'Ottawa',
|
'currency' => 'CAD',
|
||||||
'currency' => 'CAD',
|
'currency_name' => 'Canadian dollar',
|
||||||
'currency_name' => 'Canadian dollar',
|
'currency_symbol' => '$',
|
||||||
'currency_symbol' => '$',
|
'tld' => '.ca',
|
||||||
'tld' => '.ca',
|
'native' => 'Canada',
|
||||||
'native' => 'Canada',
|
'region' => 'Americas',
|
||||||
'region' => 'Americas',
|
'region_id' => 2,
|
||||||
'region_id' => 2,
|
'subregion' => 'Northern America',
|
||||||
'subregion' => 'Northern America',
|
'subregion_id' => 6,
|
||||||
'subregion_id' => 6,
|
'nationality' => 'Canadian',
|
||||||
'nationality' => 'Canadian',
|
'timezones' => '[{"zoneName":"America/Atikokan","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America)"},{"zoneName":"America/Blanc-Sablon","gmtOffset":-14400,"gmtOffsetName":"UTC-04:00","abbreviation":"AST","tzName":"Atlantic Standard Time"},{"zoneName":"America/Cambridge_Bay","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America)"},{"zoneName":"America/Creston","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America)"},{"zoneName":"America/Dawson","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America)"},{"zoneName":"America/Dawson_Creek","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America)"},{"zoneName":"America/Edmonton","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America)"},{"zoneName":"America/Fort_Nelson","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America)"},{"zoneName":"America/Glace_Bay","gmtOffset":-14400,"gmtOffsetName":"UTC-04:00","abbreviation":"AST","tzName":"Atlantic Standard Time"},{"zoneName":"America/Goose_Bay","gmtOffset":-14400,"gmtOffsetName":"UTC-04:00","abbreviation":"AST","tzName":"Atlantic Standard Time"},{"zoneName":"America/Halifax","gmtOffset":-14400,"gmtOffsetName":"UTC-04:00","abbreviation":"AST","tzName":"Atlantic Standard Time"},{"zoneName":"America/Inuvik","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America"},{"zoneName":"America/Iqaluit","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Moncton","gmtOffset":-14400,"gmtOffsetName":"UTC-04:00","abbreviation":"AST","tzName":"Atlantic Standard Time"},{"zoneName":"America/Nipigon","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Pangnirtung","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Rainy_River","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Rankin_Inlet","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Regina","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Resolute","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/St_Johns","gmtOffset":-12600,"gmtOffsetName":"UTC-03:30","abbreviation":"NST","tzName":"Newfoundland Standard Time"},{"zoneName":"America/Swift_Current","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Thunder_Bay","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Toronto","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Vancouver","gmtOffset":-28800,"gmtOffsetName":"UTC-08:00","abbreviation":"PST","tzName":"Pacific Standard Time (North America"},{"zoneName":"America/Whitehorse","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America"},{"zoneName":"America/Winnipeg","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Yellowknife","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America"}]',
|
||||||
'timezones' => '[{"zoneName":"America/Atikokan","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America)"},{"zoneName":"America/Blanc-Sablon","gmtOffset":-14400,"gmtOffsetName":"UTC-04:00","abbreviation":"AST","tzName":"Atlantic Standard Time"},{"zoneName":"America/Cambridge_Bay","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America)"},{"zoneName":"America/Creston","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America)"},{"zoneName":"America/Dawson","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America)"},{"zoneName":"America/Dawson_Creek","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America)"},{"zoneName":"America/Edmonton","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America)"},{"zoneName":"America/Fort_Nelson","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America)"},{"zoneName":"America/Glace_Bay","gmtOffset":-14400,"gmtOffsetName":"UTC-04:00","abbreviation":"AST","tzName":"Atlantic Standard Time"},{"zoneName":"America/Goose_Bay","gmtOffset":-14400,"gmtOffsetName":"UTC-04:00","abbreviation":"AST","tzName":"Atlantic Standard Time"},{"zoneName":"America/Halifax","gmtOffset":-14400,"gmtOffsetName":"UTC-04:00","abbreviation":"AST","tzName":"Atlantic Standard Time"},{"zoneName":"America/Inuvik","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America"},{"zoneName":"America/Iqaluit","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Moncton","gmtOffset":-14400,"gmtOffsetName":"UTC-04:00","abbreviation":"AST","tzName":"Atlantic Standard Time"},{"zoneName":"America/Nipigon","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Pangnirtung","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Rainy_River","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Rankin_Inlet","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Regina","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Resolute","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/St_Johns","gmtOffset":-12600,"gmtOffsetName":"UTC-03:30","abbreviation":"NST","tzName":"Newfoundland Standard Time"},{"zoneName":"America/Swift_Current","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Thunder_Bay","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Toronto","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Vancouver","gmtOffset":-28800,"gmtOffsetName":"UTC-08:00","abbreviation":"PST","tzName":"Pacific Standard Time (North America"},{"zoneName":"America/Whitehorse","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America"},{"zoneName":"America/Winnipeg","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Yellowknife","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America"}]',
|
'translations' => '{"kr":"캐나다","pt-BR":"Canadá","pt":"Canadá","nl":"Canada","hr":"Kanada","fa":"کانادا","de":"Kanada","es":"Canadá","fr":"Canada","ja":"カナダ","it":"Canada","cn":"加拿大","tr":"Kanada"}',
|
||||||
'translations' => '{"kr":"캐나다","pt-BR":"Canadá","pt":"Canadá","nl":"Canada","hr":"Kanada","fa":"کانادا","de":"Kanada","es":"Canadá","fr":"Canada","ja":"カナダ","it":"Canada","cn":"加拿大","tr":"Kanada"}',
|
'latitude' => (static function() {
|
||||||
'latitude' => (static function() {
|
$class = new ReflectionClass(Decimal::class);
|
||||||
$class = new ReflectionClass(Decimal::class);
|
$object = $class->newInstanceWithoutConstructor();
|
||||||
$object = $class->newInstanceWithoutConstructor();
|
|
||||||
|
(function() {
|
||||||
(function() {
|
$this->integralPart = '60';
|
||||||
$this->integralPart = '60';
|
$this->fractionalPart = '00000000';
|
||||||
$this->fractionalPart = '00000000';
|
$this->negative = false;
|
||||||
$this->negative = false;
|
$this->scale = 8;
|
||||||
$this->scale = 8;
|
})->bindTo($object, Decimal::class)();
|
||||||
})->bindTo($object, Decimal::class)();
|
|
||||||
|
return $object;
|
||||||
return $object;
|
})(),
|
||||||
})(),
|
'longitude' => (static function() {
|
||||||
'longitude' => (static function() {
|
$class = new ReflectionClass(Decimal::class);
|
||||||
$class = new ReflectionClass(Decimal::class);
|
$object = $class->newInstanceWithoutConstructor();
|
||||||
$object = $class->newInstanceWithoutConstructor();
|
|
||||||
|
(function() {
|
||||||
(function() {
|
$this->integralPart = '95';
|
||||||
$this->integralPart = '95';
|
$this->fractionalPart = '00000000';
|
||||||
$this->fractionalPart = '00000000';
|
$this->negative = true;
|
||||||
$this->negative = true;
|
$this->scale = 8;
|
||||||
$this->scale = 8;
|
})->bindTo($object, Decimal::class)();
|
||||||
})->bindTo($object, Decimal::class)();
|
|
||||||
|
return $object;
|
||||||
return $object;
|
})(),
|
||||||
})(),
|
'emoji' => '🇨🇦',
|
||||||
'emoji' => '🇨🇦',
|
'emojiU' => 'U+1F1E8 U+1F1E6',
|
||||||
'emojiU' => 'U+1F1E8 U+1F1E6',
|
'created_at' => '2018-07-21 16:11:03',
|
||||||
'created_at' => '2018-07-21 16:11:03',
|
'updated_at' => '2023-08-09 06:04:58',
|
||||||
'updated_at' => '2023-08-09 06:04:58',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q16',
|
||||||
'wikiDataId' => 'Q16',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 86,
|
||||||
'id' => 86,
|
'name' => 'Greenland',
|
||||||
'name' => 'Greenland',
|
'iso3' => 'GRL',
|
||||||
'iso3' => 'GRL',
|
'numeric_code' => '304',
|
||||||
'numeric_code' => '304',
|
'iso2' => 'GL',
|
||||||
'iso2' => 'GL',
|
'phonecode' => '299',
|
||||||
'phonecode' => '299',
|
'capital' => 'Nuuk',
|
||||||
'capital' => 'Nuuk',
|
'currency' => 'DKK',
|
||||||
'currency' => 'DKK',
|
'currency_name' => 'Danish krone',
|
||||||
'currency_name' => 'Danish krone',
|
'currency_symbol' => 'Kr.',
|
||||||
'currency_symbol' => 'Kr.',
|
'tld' => '.gl',
|
||||||
'tld' => '.gl',
|
'native' => 'Kalaallit Nunaat',
|
||||||
'native' => 'Kalaallit Nunaat',
|
'region' => 'Americas',
|
||||||
'region' => 'Americas',
|
'region_id' => 2,
|
||||||
'region_id' => 2,
|
'subregion' => 'Northern America',
|
||||||
'subregion' => 'Northern America',
|
'subregion_id' => 6,
|
||||||
'subregion_id' => 6,
|
'nationality' => 'Greenlandic',
|
||||||
'nationality' => 'Greenlandic',
|
'timezones' => '[{"zoneName":"America/Danmarkshavn","gmtOffset":0,"gmtOffsetName":"UTC±00","abbreviation":"GMT","tzName":"Greenwich Mean Time"},{"zoneName":"America/Nuuk","gmtOffset":-10800,"gmtOffsetName":"UTC-03:00","abbreviation":"WGT","tzName":"West Greenland Time"},{"zoneName":"America/Scoresbysund","gmtOffset":-3600,"gmtOffsetName":"UTC-01:00","abbreviation":"EGT","tzName":"Eastern Greenland Time"},{"zoneName":"America/Thule","gmtOffset":-14400,"gmtOffsetName":"UTC-04:00","abbreviation":"AST","tzName":"Atlantic Standard Time"}]',
|
||||||
'timezones' => '[{"zoneName":"America/Danmarkshavn","gmtOffset":0,"gmtOffsetName":"UTC±00","abbreviation":"GMT","tzName":"Greenwich Mean Time"},{"zoneName":"America/Nuuk","gmtOffset":-10800,"gmtOffsetName":"UTC-03:00","abbreviation":"WGT","tzName":"West Greenland Time"},{"zoneName":"America/Scoresbysund","gmtOffset":-3600,"gmtOffsetName":"UTC-01:00","abbreviation":"EGT","tzName":"Eastern Greenland Time"},{"zoneName":"America/Thule","gmtOffset":-14400,"gmtOffsetName":"UTC-04:00","abbreviation":"AST","tzName":"Atlantic Standard Time"}]',
|
'translations' => '{"kr":"그린란드","pt-BR":"Groelândia","pt":"Gronelândia","nl":"Groenland","hr":"Grenland","fa":"گرینلند","de":"Grönland","es":"Groenlandia","fr":"Groenland","ja":"グリーンランド","it":"Groenlandia","cn":"格陵兰岛","tr":"Grönland"}',
|
||||||
'translations' => '{"kr":"그린란드","pt-BR":"Groelândia","pt":"Gronelândia","nl":"Groenland","hr":"Grenland","fa":"گرینلند","de":"Grönland","es":"Groenlandia","fr":"Groenland","ja":"グリーンランド","it":"Groenlandia","cn":"格陵兰岛","tr":"Grönland"}',
|
'latitude' => (static function() {
|
||||||
'latitude' => (static function() {
|
$class = new ReflectionClass(Decimal::class);
|
||||||
$class = new ReflectionClass(Decimal::class);
|
$object = $class->newInstanceWithoutConstructor();
|
||||||
$object = $class->newInstanceWithoutConstructor();
|
|
||||||
|
(function() {
|
||||||
(function() {
|
$this->integralPart = '72';
|
||||||
$this->integralPart = '72';
|
$this->fractionalPart = '00000000';
|
||||||
$this->fractionalPart = '00000000';
|
$this->negative = false;
|
||||||
$this->negative = false;
|
$this->scale = 8;
|
||||||
$this->scale = 8;
|
})->bindTo($object, Decimal::class)();
|
||||||
})->bindTo($object, Decimal::class)();
|
|
||||||
|
return $object;
|
||||||
return $object;
|
})(),
|
||||||
})(),
|
'longitude' => (static function() {
|
||||||
'longitude' => (static function() {
|
$class = new ReflectionClass(Decimal::class);
|
||||||
$class = new ReflectionClass(Decimal::class);
|
$object = $class->newInstanceWithoutConstructor();
|
||||||
$object = $class->newInstanceWithoutConstructor();
|
|
||||||
|
(function() {
|
||||||
(function() {
|
$this->integralPart = '40';
|
||||||
$this->integralPart = '40';
|
$this->fractionalPart = '00000000';
|
||||||
$this->fractionalPart = '00000000';
|
$this->negative = true;
|
||||||
$this->negative = true;
|
$this->scale = 8;
|
||||||
$this->scale = 8;
|
})->bindTo($object, Decimal::class)();
|
||||||
})->bindTo($object, Decimal::class)();
|
|
||||||
|
return $object;
|
||||||
return $object;
|
})(),
|
||||||
})(),
|
'emoji' => '🇬🇱',
|
||||||
'emoji' => '🇬🇱',
|
'emojiU' => 'U+1F1EC U+1F1F1',
|
||||||
'emojiU' => 'U+1F1EC U+1F1F1',
|
'created_at' => '2018-07-21 16:11:03',
|
||||||
'created_at' => '2018-07-21 16:11:03',
|
'updated_at' => '2023-08-09 06:04:58',
|
||||||
'updated_at' => '2023-08-09 06:04:58',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => null,
|
||||||
'wikiDataId' => null,
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 187,
|
||||||
'id' => 187,
|
'name' => 'Saint Pierre and Miquelon',
|
||||||
'name' => 'Saint Pierre and Miquelon',
|
'iso3' => 'SPM',
|
||||||
'iso3' => 'SPM',
|
'numeric_code' => '666',
|
||||||
'numeric_code' => '666',
|
'iso2' => 'PM',
|
||||||
'iso2' => 'PM',
|
'phonecode' => '508',
|
||||||
'phonecode' => '508',
|
'capital' => 'Saint-Pierre',
|
||||||
'capital' => 'Saint-Pierre',
|
'currency' => 'EUR',
|
||||||
'currency' => 'EUR',
|
'currency_name' => 'Euro',
|
||||||
'currency_name' => 'Euro',
|
'currency_symbol' => '€',
|
||||||
'currency_symbol' => '€',
|
'tld' => '.pm',
|
||||||
'tld' => '.pm',
|
'native' => 'Saint-Pierre-et-Miquelon',
|
||||||
'native' => 'Saint-Pierre-et-Miquelon',
|
'region' => 'Americas',
|
||||||
'region' => 'Americas',
|
'region_id' => 2,
|
||||||
'region_id' => 2,
|
'subregion' => 'Northern America',
|
||||||
'subregion' => 'Northern America',
|
'subregion_id' => 6,
|
||||||
'subregion_id' => 6,
|
'nationality' => 'Saint-Pierrais or Miquelonnais',
|
||||||
'nationality' => 'Saint-Pierrais or Miquelonnais',
|
'timezones' => '[{"zoneName":"America/Miquelon","gmtOffset":-10800,"gmtOffsetName":"UTC-03:00","abbreviation":"PMDT","tzName":"Pierre & Miquelon Daylight Time"}]',
|
||||||
'timezones' => '[{"zoneName":"America/Miquelon","gmtOffset":-10800,"gmtOffsetName":"UTC-03:00","abbreviation":"PMDT","tzName":"Pierre & Miquelon Daylight Time"}]',
|
'translations' => '{"kr":"생피에르 미클롱","pt-BR":"Saint-Pierre e Miquelon","pt":"São Pedro e Miquelon","nl":"Saint Pierre en Miquelon","hr":"Sveti Petar i Mikelon","fa":"سن پیر و میکلن","de":"Saint-Pierre und Miquelon","es":"San Pedro y Miquelón","fr":"Saint-Pierre-et-Miquelon","ja":"サンピエール島・ミクロン島","it":"Saint-Pierre e Miquelon","cn":"圣皮埃尔和密克隆","tr":"Saint Pierre Ve Miquelon"}',
|
||||||
'translations' => '{"kr":"생피에르 미클롱","pt-BR":"Saint-Pierre e Miquelon","pt":"São Pedro e Miquelon","nl":"Saint Pierre en Miquelon","hr":"Sveti Petar i Mikelon","fa":"سن پیر و میکلن","de":"Saint-Pierre und Miquelon","es":"San Pedro y Miquelón","fr":"Saint-Pierre-et-Miquelon","ja":"サンピエール島・ミクロン島","it":"Saint-Pierre e Miquelon","cn":"圣皮埃尔和密克隆","tr":"Saint Pierre Ve Miquelon"}',
|
'latitude' => (static function() {
|
||||||
'latitude' => (static function() {
|
$class = new ReflectionClass(Decimal::class);
|
||||||
$class = new ReflectionClass(Decimal::class);
|
$object = $class->newInstanceWithoutConstructor();
|
||||||
$object = $class->newInstanceWithoutConstructor();
|
|
||||||
|
(function() {
|
||||||
(function() {
|
$this->integralPart = '46';
|
||||||
$this->integralPart = '46';
|
$this->fractionalPart = '83333333';
|
||||||
$this->fractionalPart = '83333333';
|
$this->negative = false;
|
||||||
$this->negative = false;
|
$this->scale = 8;
|
||||||
$this->scale = 8;
|
})->bindTo($object, Decimal::class)();
|
||||||
})->bindTo($object, Decimal::class)();
|
|
||||||
|
return $object;
|
||||||
return $object;
|
})(),
|
||||||
})(),
|
'longitude' => (static function() {
|
||||||
'longitude' => (static function() {
|
$class = new ReflectionClass(Decimal::class);
|
||||||
$class = new ReflectionClass(Decimal::class);
|
$object = $class->newInstanceWithoutConstructor();
|
||||||
$object = $class->newInstanceWithoutConstructor();
|
|
||||||
|
(function() {
|
||||||
(function() {
|
$this->integralPart = '56';
|
||||||
$this->integralPart = '56';
|
$this->fractionalPart = '33333333';
|
||||||
$this->fractionalPart = '33333333';
|
$this->negative = true;
|
||||||
$this->negative = true;
|
$this->scale = 8;
|
||||||
$this->scale = 8;
|
})->bindTo($object, Decimal::class)();
|
||||||
})->bindTo($object, Decimal::class)();
|
|
||||||
|
return $object;
|
||||||
return $object;
|
})(),
|
||||||
})(),
|
'emoji' => '🇵🇲',
|
||||||
'emoji' => '🇵🇲',
|
'emojiU' => 'U+1F1F5 U+1F1F2',
|
||||||
'emojiU' => 'U+1F1F5 U+1F1F2',
|
'created_at' => '2018-07-21 16:11:03',
|
||||||
'created_at' => '2018-07-21 16:11:03',
|
'updated_at' => '2023-08-10 04:23:19',
|
||||||
'updated_at' => '2023-08-10 04:23:19',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => null,
|
||||||
'wikiDataId' => null,
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 233,
|
||||||
'id' => 233,
|
'name' => 'United States',
|
||||||
'name' => 'United States',
|
'iso3' => 'USA',
|
||||||
'iso3' => 'USA',
|
'numeric_code' => '840',
|
||||||
'numeric_code' => '840',
|
'iso2' => 'US',
|
||||||
'iso2' => 'US',
|
'phonecode' => '1',
|
||||||
'phonecode' => '1',
|
'capital' => 'Washington',
|
||||||
'capital' => 'Washington',
|
'currency' => 'USD',
|
||||||
'currency' => 'USD',
|
'currency_name' => 'United States dollar',
|
||||||
'currency_name' => 'United States dollar',
|
'currency_symbol' => '$',
|
||||||
'currency_symbol' => '$',
|
'tld' => '.us',
|
||||||
'tld' => '.us',
|
'native' => 'United States',
|
||||||
'native' => 'United States',
|
'region' => 'Americas',
|
||||||
'region' => 'Americas',
|
'region_id' => 2,
|
||||||
'region_id' => 2,
|
'subregion' => 'Northern America',
|
||||||
'subregion' => 'Northern America',
|
'subregion_id' => 6,
|
||||||
'subregion_id' => 6,
|
'nationality' => 'American',
|
||||||
'nationality' => 'American',
|
'timezones' => '[{"zoneName":"America/Adak","gmtOffset":-36000,"gmtOffsetName":"UTC-10:00","abbreviation":"HST","tzName":"Hawaii–Aleutian Standard Time"},{"zoneName":"America/Anchorage","gmtOffset":-32400,"gmtOffsetName":"UTC-09:00","abbreviation":"AKST","tzName":"Alaska Standard Time"},{"zoneName":"America/Boise","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America"},{"zoneName":"America/Chicago","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Denver","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America"},{"zoneName":"America/Detroit","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Indiana/Indianapolis","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Indiana/Knox","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Indiana/Marengo","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Indiana/Petersburg","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Indiana/Tell_City","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Indiana/Vevay","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Indiana/Vincennes","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Indiana/Winamac","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Juneau","gmtOffset":-32400,"gmtOffsetName":"UTC-09:00","abbreviation":"AKST","tzName":"Alaska Standard Time"},{"zoneName":"America/Kentucky/Louisville","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Kentucky/Monticello","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Los_Angeles","gmtOffset":-28800,"gmtOffsetName":"UTC-08:00","abbreviation":"PST","tzName":"Pacific Standard Time (North America"},{"zoneName":"America/Menominee","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Metlakatla","gmtOffset":-32400,"gmtOffsetName":"UTC-09:00","abbreviation":"AKST","tzName":"Alaska Standard Time"},{"zoneName":"America/New_York","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Nome","gmtOffset":-32400,"gmtOffsetName":"UTC-09:00","abbreviation":"AKST","tzName":"Alaska Standard Time"},{"zoneName":"America/North_Dakota/Beulah","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/North_Dakota/Center","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/North_Dakota/New_Salem","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Phoenix","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America"},{"zoneName":"America/Sitka","gmtOffset":-32400,"gmtOffsetName":"UTC-09:00","abbreviation":"AKST","tzName":"Alaska Standard Time"},{"zoneName":"America/Yakutat","gmtOffset":-32400,"gmtOffsetName":"UTC-09:00","abbreviation":"AKST","tzName":"Alaska Standard Time"},{"zoneName":"Pacific/Honolulu","gmtOffset":-36000,"gmtOffsetName":"UTC-10:00","abbreviation":"HST","tzName":"Hawaii–Aleutian Standard Time"}]',
|
||||||
'timezones' => '[{"zoneName":"America/Adak","gmtOffset":-36000,"gmtOffsetName":"UTC-10:00","abbreviation":"HST","tzName":"Hawaii–Aleutian Standard Time"},{"zoneName":"America/Anchorage","gmtOffset":-32400,"gmtOffsetName":"UTC-09:00","abbreviation":"AKST","tzName":"Alaska Standard Time"},{"zoneName":"America/Boise","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America"},{"zoneName":"America/Chicago","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Denver","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America"},{"zoneName":"America/Detroit","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Indiana/Indianapolis","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Indiana/Knox","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Indiana/Marengo","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Indiana/Petersburg","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Indiana/Tell_City","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Indiana/Vevay","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Indiana/Vincennes","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Indiana/Winamac","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Juneau","gmtOffset":-32400,"gmtOffsetName":"UTC-09:00","abbreviation":"AKST","tzName":"Alaska Standard Time"},{"zoneName":"America/Kentucky/Louisville","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Kentucky/Monticello","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Los_Angeles","gmtOffset":-28800,"gmtOffsetName":"UTC-08:00","abbreviation":"PST","tzName":"Pacific Standard Time (North America"},{"zoneName":"America/Menominee","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Metlakatla","gmtOffset":-32400,"gmtOffsetName":"UTC-09:00","abbreviation":"AKST","tzName":"Alaska Standard Time"},{"zoneName":"America/New_York","gmtOffset":-18000,"gmtOffsetName":"UTC-05:00","abbreviation":"EST","tzName":"Eastern Standard Time (North America"},{"zoneName":"America/Nome","gmtOffset":-32400,"gmtOffsetName":"UTC-09:00","abbreviation":"AKST","tzName":"Alaska Standard Time"},{"zoneName":"America/North_Dakota/Beulah","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/North_Dakota/Center","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/North_Dakota/New_Salem","gmtOffset":-21600,"gmtOffsetName":"UTC-06:00","abbreviation":"CST","tzName":"Central Standard Time (North America"},{"zoneName":"America/Phoenix","gmtOffset":-25200,"gmtOffsetName":"UTC-07:00","abbreviation":"MST","tzName":"Mountain Standard Time (North America"},{"zoneName":"America/Sitka","gmtOffset":-32400,"gmtOffsetName":"UTC-09:00","abbreviation":"AKST","tzName":"Alaska Standard Time"},{"zoneName":"America/Yakutat","gmtOffset":-32400,"gmtOffsetName":"UTC-09:00","abbreviation":"AKST","tzName":"Alaska Standard Time"},{"zoneName":"Pacific/Honolulu","gmtOffset":-36000,"gmtOffsetName":"UTC-10:00","abbreviation":"HST","tzName":"Hawaii–Aleutian Standard Time"}]',
|
'translations' => '{"kr":"미국","pt-BR":"Estados Unidos","pt":"Estados Unidos","nl":"Verenigde Staten","hr":"Sjedinjene Američke Države","fa":"ایالات متحده آمریکا","de":"Vereinigte Staaten von Amerika","es":"Estados Unidos","fr":"États-Unis","ja":"アメリカ合衆国","it":"Stati Uniti D\'America","cn":"美国","tr":"Amerika"}',
|
||||||
'translations' => '{"kr":"미국","pt-BR":"Estados Unidos","pt":"Estados Unidos","nl":"Verenigde Staten","hr":"Sjedinjene Američke Države","fa":"ایالات متحده آمریکا","de":"Vereinigte Staaten von Amerika","es":"Estados Unidos","fr":"États-Unis","ja":"アメリカ合衆国","it":"Stati Uniti D\'America","cn":"美国","tr":"Amerika"}',
|
'latitude' => (static function() {
|
||||||
'latitude' => (static function() {
|
$class = new ReflectionClass(Decimal::class);
|
||||||
$class = new ReflectionClass(Decimal::class);
|
$object = $class->newInstanceWithoutConstructor();
|
||||||
$object = $class->newInstanceWithoutConstructor();
|
|
||||||
|
(function() {
|
||||||
(function() {
|
$this->integralPart = '38';
|
||||||
$this->integralPart = '38';
|
$this->fractionalPart = '00000000';
|
||||||
$this->fractionalPart = '00000000';
|
$this->negative = false;
|
||||||
$this->negative = false;
|
$this->scale = 8;
|
||||||
$this->scale = 8;
|
})->bindTo($object, Decimal::class)();
|
||||||
})->bindTo($object, Decimal::class)();
|
|
||||||
|
return $object;
|
||||||
return $object;
|
})(),
|
||||||
})(),
|
'longitude' => (static function() {
|
||||||
'longitude' => (static function() {
|
$class = new ReflectionClass(Decimal::class);
|
||||||
$class = new ReflectionClass(Decimal::class);
|
$object = $class->newInstanceWithoutConstructor();
|
||||||
$object = $class->newInstanceWithoutConstructor();
|
|
||||||
|
(function() {
|
||||||
(function() {
|
$this->integralPart = '97';
|
||||||
$this->integralPart = '97';
|
$this->fractionalPart = '00000000';
|
||||||
$this->fractionalPart = '00000000';
|
$this->negative = true;
|
||||||
$this->negative = true;
|
$this->scale = 8;
|
||||||
$this->scale = 8;
|
})->bindTo($object, Decimal::class)();
|
||||||
})->bindTo($object, Decimal::class)();
|
|
||||||
|
return $object;
|
||||||
return $object;
|
})(),
|
||||||
})(),
|
'emoji' => '🇺🇸',
|
||||||
'emoji' => '🇺🇸',
|
'emojiU' => 'U+1F1FA U+1F1F8',
|
||||||
'emojiU' => 'U+1F1FA U+1F1F8',
|
'created_at' => '2018-07-21 16:11:03',
|
||||||
'created_at' => '2018-07-21 16:11:03',
|
'updated_at' => '2023-08-10 04:23:19',
|
||||||
'updated_at' => '2023-08-10 04:23:19',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q30',
|
||||||
'wikiDataId' => 'Q30',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 234,
|
||||||
'id' => 234,
|
'name' => 'United States Minor Outlying Islands',
|
||||||
'name' => 'United States Minor Outlying Islands',
|
'iso3' => 'UMI',
|
||||||
'iso3' => 'UMI',
|
'numeric_code' => '581',
|
||||||
'numeric_code' => '581',
|
'iso2' => 'UM',
|
||||||
'iso2' => 'UM',
|
'phonecode' => '1',
|
||||||
'phonecode' => '1',
|
'capital' => '',
|
||||||
'capital' => '',
|
'currency' => 'USD',
|
||||||
'currency' => 'USD',
|
'currency_name' => 'United States dollar',
|
||||||
'currency_name' => 'United States dollar',
|
'currency_symbol' => '$',
|
||||||
'currency_symbol' => '$',
|
'tld' => '.us',
|
||||||
'tld' => '.us',
|
'native' => 'United States Minor Outlying Islands',
|
||||||
'native' => 'United States Minor Outlying Islands',
|
'region' => 'Americas',
|
||||||
'region' => 'Americas',
|
'region_id' => 2,
|
||||||
'region_id' => 2,
|
'subregion' => 'Northern America',
|
||||||
'subregion' => 'Northern America',
|
'subregion_id' => 6,
|
||||||
'subregion_id' => 6,
|
'nationality' => 'American',
|
||||||
'nationality' => 'American',
|
'timezones' => '[{"zoneName":"Pacific/Midway","gmtOffset":-39600,"gmtOffsetName":"UTC-11:00","abbreviation":"SST","tzName":"Samoa Standard Time"},{"zoneName":"Pacific/Wake","gmtOffset":43200,"gmtOffsetName":"UTC+12:00","abbreviation":"WAKT","tzName":"Wake Island Time"}]',
|
||||||
'timezones' => '[{"zoneName":"Pacific/Midway","gmtOffset":-39600,"gmtOffsetName":"UTC-11:00","abbreviation":"SST","tzName":"Samoa Standard Time"},{"zoneName":"Pacific/Wake","gmtOffset":43200,"gmtOffsetName":"UTC+12:00","abbreviation":"WAKT","tzName":"Wake Island Time"}]',
|
'translations' => '{"kr":"미국령 군소 제도","pt-BR":"Ilhas Menores Distantes dos Estados Unidos","pt":"Ilhas Menores Distantes dos Estados Unidos","nl":"Kleine afgelegen eilanden van de Verenigde Staten","hr":"Mali udaljeni otoci SAD-a","fa":"جزایر کوچک حاشیهای ایالات متحده آمریکا","de":"Kleinere Inselbesitzungen der Vereinigten Staaten","es":"Islas Ultramarinas Menores de Estados Unidos","fr":"Îles mineures éloignées des États-Unis","ja":"合衆国領有小離島","it":"Isole minori esterne degli Stati Uniti d\'America","cn":"美国本土外小岛屿","tr":"Abd Küçük Harici Adalari"}',
|
||||||
'translations' => '{"kr":"미국령 군소 제도","pt-BR":"Ilhas Menores Distantes dos Estados Unidos","pt":"Ilhas Menores Distantes dos Estados Unidos","nl":"Kleine afgelegen eilanden van de Verenigde Staten","hr":"Mali udaljeni otoci SAD-a","fa":"جزایر کوچک حاشیهای ایالات متحده آمریکا","de":"Kleinere Inselbesitzungen der Vereinigten Staaten","es":"Islas Ultramarinas Menores de Estados Unidos","fr":"Îles mineures éloignées des États-Unis","ja":"合衆国領有小離島","it":"Isole minori esterne degli Stati Uniti d\'America","cn":"美国本土外小岛屿","tr":"Abd Küçük Harici Adalari"}',
|
'latitude' => (static function() {
|
||||||
'latitude' => (static function() {
|
$class = new ReflectionClass(Decimal::class);
|
||||||
$class = new ReflectionClass(Decimal::class);
|
$object = $class->newInstanceWithoutConstructor();
|
||||||
$object = $class->newInstanceWithoutConstructor();
|
|
||||||
|
(function() {
|
||||||
(function() {
|
$this->integralPart = '0';
|
||||||
$this->integralPart = '0';
|
$this->fractionalPart = '00000000';
|
||||||
$this->fractionalPart = '00000000';
|
$this->negative = false;
|
||||||
$this->negative = false;
|
$this->scale = 8;
|
||||||
$this->scale = 8;
|
})->bindTo($object, Decimal::class)();
|
||||||
})->bindTo($object, Decimal::class)();
|
|
||||||
|
return $object;
|
||||||
return $object;
|
})(),
|
||||||
})(),
|
'longitude' => (static function() {
|
||||||
'longitude' => (static function() {
|
$class = new ReflectionClass(Decimal::class);
|
||||||
$class = new ReflectionClass(Decimal::class);
|
$object = $class->newInstanceWithoutConstructor();
|
||||||
$object = $class->newInstanceWithoutConstructor();
|
|
||||||
|
(function() {
|
||||||
(function() {
|
$this->integralPart = '0';
|
||||||
$this->integralPart = '0';
|
$this->fractionalPart = '00000000';
|
||||||
$this->fractionalPart = '00000000';
|
$this->negative = false;
|
||||||
$this->negative = false;
|
$this->scale = 8;
|
||||||
$this->scale = 8;
|
})->bindTo($object, Decimal::class)();
|
||||||
})->bindTo($object, Decimal::class)();
|
|
||||||
|
return $object;
|
||||||
return $object;
|
})(),
|
||||||
})(),
|
'emoji' => '🇺🇲',
|
||||||
'emoji' => '🇺🇲',
|
'emojiU' => 'U+1F1FA U+1F1F2',
|
||||||
'emojiU' => 'U+1F1FA U+1F1F2',
|
'created_at' => '2018-07-21 16:11:03',
|
||||||
'created_at' => '2018-07-21 16:11:03',
|
'updated_at' => '2023-08-10 04:23:19',
|
||||||
'updated_at' => '2023-08-10 04:23:19',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => null,
|
||||||
'wikiDataId' => null,
|
],
|
||||||
],
|
];
|
||||||
];
|
parent::init();
|
||||||
parent::init();
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,77 +8,77 @@ use Cake\TestSuite\Fixture\TestFixture;
|
|||||||
/**
|
/**
|
||||||
* RegionsFixture
|
* RegionsFixture
|
||||||
*/
|
*/
|
||||||
class RegionsFixture extends TestFixture
|
class RegionsFixture extends TestFixture {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Init method
|
* Init method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function init(): void
|
public function init(): void {
|
||||||
{
|
$this->records = [
|
||||||
$this->records = [
|
[
|
||||||
[
|
'id' => 1,
|
||||||
'id' => 1,
|
'name' => 'Africa',
|
||||||
'name' => 'Africa',
|
|
||||||
// 'translations' => '{"kr":"아프리카","pt-BR":"África","pt":"África","nl":"Afrika","hr":"Afrika","fa":"آفریقا","de":"Afrika","es":"África","fr":"Afrique","ja":"アフリカ","it":"Africa","cn":"非洲","tr":"Afrika"}',
|
// 'translations' => '{"kr":"아프리카","pt-BR":"África","pt":"África","nl":"Afrika","hr":"Afrika","fa":"آفریقا","de":"Afrika","es":"África","fr":"Afrique","ja":"アフリカ","it":"Africa","cn":"非洲","tr":"Afrika"}',
|
||||||
'translations' => '',
|
'translations' => '',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'updated_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-14 14:11:03',
|
||||||
'flag' => true,
|
'flag' => true,
|
||||||
'wikiDataId' => 'Q15',
|
'wikiDataId' => 'Q15',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'id' => 2,
|
'id' => 2,
|
||||||
'name' => 'Americas',
|
'name' => 'Americas',
|
||||||
// 'translations' => '{"kr":"아메리카","pt-BR":"América","pt":"América","nl":"Amerika","hr":"Amerika","fa":"قاره آمریکا","de":"Amerika","es":"América","fr":"Amérique","ja":"アメリカ州","it":"America","cn":"美洲","tr":"Amerika"}',
|
// 'translations' => '{"kr":"아메리카","pt-BR":"América","pt":"América","nl":"Amerika","hr":"Amerika","fa":"قاره آمریکا","de":"Amerika","es":"América","fr":"Amérique","ja":"アメリカ州","it":"America","cn":"美洲","tr":"Amerika"}',
|
||||||
'translations' => '',
|
'translations' => '',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'updated_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-14 14:11:03',
|
||||||
'flag' => true,
|
'flag' => true,
|
||||||
'wikiDataId' => 'Q828',
|
'wikiDataId' => 'Q828',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'id' => 3,
|
'id' => 3,
|
||||||
'name' => 'Asia',
|
'name' => 'Asia',
|
||||||
// 'translations' => '{"kr":"아시아","pt-BR":"Ásia","pt":"Ásia","nl":"Azië","hr":"Ázsia","fa":"آسیا","de":"Asien","es":"Asia","fr":"Asie","ja":"アジア","it":"Asia","cn":"亚洲","tr":"Asya"}',
|
// 'translations' => '{"kr":"아시아","pt-BR":"Ásia","pt":"Ásia","nl":"Azië","hr":"Ázsia","fa":"آسیا","de":"Asien","es":"Asia","fr":"Asie","ja":"アジア","it":"Asia","cn":"亚洲","tr":"Asya"}',
|
||||||
'translations' => '',
|
'translations' => '',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'updated_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-14 14:11:03',
|
||||||
'flag' => true,
|
'flag' => true,
|
||||||
'wikiDataId' => 'Q48',
|
'wikiDataId' => 'Q48',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'id' => 4,
|
'id' => 4,
|
||||||
'name' => 'Europe',
|
'name' => 'Europe',
|
||||||
// 'translations' => '{"kr":"유럽","pt-BR":"Europa","pt":"Europa","nl":"Europa","hr":"Európa","fa":"اروپا","de":"Europa","es":"Europa","fr":"Europe","ja":"ヨーロッパ","it":"Europa","cn":"欧洲","tr":"Avrupa"}',
|
// 'translations' => '{"kr":"유럽","pt-BR":"Europa","pt":"Europa","nl":"Europa","hr":"Európa","fa":"اروپا","de":"Europa","es":"Europa","fr":"Europe","ja":"ヨーロッパ","it":"Europa","cn":"欧洲","tr":"Avrupa"}',
|
||||||
'translations' => '',
|
'translations' => '',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'updated_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-14 14:11:03',
|
||||||
'flag' => true,
|
'flag' => true,
|
||||||
'wikiDataId' => 'Q46',
|
'wikiDataId' => 'Q46',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'id' => 5,
|
'id' => 5,
|
||||||
'name' => 'Oceania',
|
'name' => 'Oceania',
|
||||||
// 'translations' => '{"kr":"오세아니아","pt-BR":"Oceania","pt":"Oceania","nl":"Oceanië en Australië","hr":"Óceánia és Ausztrália","fa":"اقیانوسیه","de":"Ozeanien und Australien","es":"Oceanía","fr":"Océanie","ja":"オセアニア","it":"Oceania","cn":"大洋洲","tr":"Okyanusya"}',
|
// 'translations' => '{"kr":"오세아니아","pt-BR":"Oceania","pt":"Oceania","nl":"Oceanië en Australië","hr":"Óceánia és Ausztrália","fa":"اقیانوسیه","de":"Ozeanien und Australien","es":"Oceanía","fr":"Océanie","ja":"オセアニア","it":"Oceania","cn":"大洋洲","tr":"Okyanusya"}',
|
||||||
'translations' => '',
|
'translations' => '',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'updated_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-14 14:11:03',
|
||||||
'flag' => true,
|
'flag' => true,
|
||||||
'wikiDataId' => 'Q55643',
|
'wikiDataId' => 'Q55643',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'id' => 6,
|
'id' => 6,
|
||||||
'name' => 'Polar',
|
'name' => 'Polar',
|
||||||
// 'translations' => '{"kr":"남극","pt-BR":"Antártida","pt":"Antártida","nl":"Antarctica","hr":"Antarktika","fa":"جنوبگان","de":"Antarktika","es":"Antártida","fr":"Antarctique","ja":"南極大陸","it":"Antartide","cn":"南極洲","tr":"Antarktika"}',
|
// 'translations' => '{"kr":"남극","pt-BR":"Antártida","pt":"Antártida","nl":"Antarctica","hr":"Antarktika","fa":"جنوبگان","de":"Antarktika","es":"Antártida","fr":"Antarctique","ja":"南極大陸","it":"Antartide","cn":"南極洲","tr":"Antarktika"}',
|
||||||
'translations' => '',
|
'translations' => '',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'updated_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-14 14:11:03',
|
||||||
'flag' => true,
|
'flag' => true,
|
||||||
'wikiDataId' => 'Q51',
|
'wikiDataId' => 'Q51',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
parent::init();
|
parent::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -8,237 +8,237 @@ use Cake\TestSuite\Fixture\TestFixture;
|
|||||||
/**
|
/**
|
||||||
* SubregionsFixture
|
* SubregionsFixture
|
||||||
*/
|
*/
|
||||||
class SubregionsFixture extends TestFixture
|
class SubregionsFixture extends TestFixture {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Init method
|
* Init method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function init(): void
|
public function init(): void {
|
||||||
{
|
$this->records = [
|
||||||
$this->records = [
|
[
|
||||||
[
|
'id' => 1,
|
||||||
'id' => 1,
|
'name' => 'Northern Africa',
|
||||||
'name' => 'Northern Africa',
|
'translations' => '{"korean":"북아프리카","portuguese":"Norte de África","dutch":"Noord-Afrika","croatian":"Sjeverna Afrika","persian":"شمال آفریقا","german":"Nordafrika","spanish":"Norte de África","french":"Afrique du Nord","japanese":"北アフリカ","italian":"Nordafrica","chinese":"北部非洲"}',
|
||||||
'translations' => '{"korean":"북아프리카","portuguese":"Norte de África","dutch":"Noord-Afrika","croatian":"Sjeverna Afrika","persian":"شمال آفریقا","german":"Nordafrika","spanish":"Norte de África","french":"Afrique du Nord","japanese":"北アフリカ","italian":"Nordafrica","chinese":"北部非洲"}',
|
'region_id' => 1,
|
||||||
'region_id' => 1,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:10:23',
|
||||||
'updated_at' => '2023-08-25 03:10:23',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q27381',
|
||||||
'wikiDataId' => 'Q27381',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 2,
|
||||||
'id' => 2,
|
'name' => 'Middle Africa',
|
||||||
'name' => 'Middle Africa',
|
'translations' => '{"korean":"중앙아프리카","portuguese":"África Central","dutch":"Centraal-Afrika","croatian":"Srednja Afrika","persian":"مرکز آفریقا","german":"Zentralafrika","spanish":"África Central","french":"Afrique centrale","japanese":"中部アフリカ","italian":"Africa centrale","chinese":"中部非洲"}',
|
||||||
'translations' => '{"korean":"중앙아프리카","portuguese":"África Central","dutch":"Centraal-Afrika","croatian":"Srednja Afrika","persian":"مرکز آفریقا","german":"Zentralafrika","spanish":"África Central","french":"Afrique centrale","japanese":"中部アフリカ","italian":"Africa centrale","chinese":"中部非洲"}',
|
'region_id' => 1,
|
||||||
'region_id' => 1,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:09',
|
||||||
'updated_at' => '2023-08-25 03:22:09',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q27433',
|
||||||
'wikiDataId' => 'Q27433',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 3,
|
||||||
'id' => 3,
|
'name' => 'Western Africa',
|
||||||
'name' => 'Western Africa',
|
'translations' => '{"korean":"서아프리카","portuguese":"África Ocidental","dutch":"West-Afrika","croatian":"Zapadna Afrika","persian":"غرب آفریقا","german":"Westafrika","spanish":"África Occidental","french":"Afrique de l\'Ouest","japanese":"西アフリカ","italian":"Africa occidentale","chinese":"西非"}',
|
||||||
'translations' => '{"korean":"서아프리카","portuguese":"África Ocidental","dutch":"West-Afrika","croatian":"Zapadna Afrika","persian":"غرب آفریقا","german":"Westafrika","spanish":"África Occidental","french":"Afrique de l\'Ouest","japanese":"西アフリカ","italian":"Africa occidentale","chinese":"西非"}',
|
'region_id' => 1,
|
||||||
'region_id' => 1,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:09',
|
||||||
'updated_at' => '2023-08-25 03:22:09',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q4412',
|
||||||
'wikiDataId' => 'Q4412',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 4,
|
||||||
'id' => 4,
|
'name' => 'Eastern Africa',
|
||||||
'name' => 'Eastern Africa',
|
'translations' => '{"korean":"동아프리카","portuguese":"África Oriental","dutch":"Oost-Afrika","croatian":"Istočna Afrika","persian":"شرق آفریقا","german":"Ostafrika","spanish":"África Oriental","french":"Afrique de l\'Est","japanese":"東アフリカ","italian":"Africa orientale","chinese":"东部非洲"}',
|
||||||
'translations' => '{"korean":"동아프리카","portuguese":"África Oriental","dutch":"Oost-Afrika","croatian":"Istočna Afrika","persian":"شرق آفریقا","german":"Ostafrika","spanish":"África Oriental","french":"Afrique de l\'Est","japanese":"東アフリカ","italian":"Africa orientale","chinese":"东部非洲"}',
|
'region_id' => 1,
|
||||||
'region_id' => 1,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:10',
|
||||||
'updated_at' => '2023-08-25 03:22:10',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q27407',
|
||||||
'wikiDataId' => 'Q27407',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 5,
|
||||||
'id' => 5,
|
'name' => 'Southern Africa',
|
||||||
'name' => 'Southern Africa',
|
'translations' => '{"korean":"남아프리카","portuguese":"África Austral","dutch":"Zuidelijk Afrika","croatian":"Južna Afrika","persian":"جنوب آفریقا","german":"Südafrika","spanish":"África austral","french":"Afrique australe","japanese":"南部アフリカ","italian":"Africa australe","chinese":"南部非洲"}',
|
||||||
'translations' => '{"korean":"남아프리카","portuguese":"África Austral","dutch":"Zuidelijk Afrika","croatian":"Južna Afrika","persian":"جنوب آفریقا","german":"Südafrika","spanish":"África austral","french":"Afrique australe","japanese":"南部アフリカ","italian":"Africa australe","chinese":"南部非洲"}',
|
'region_id' => 1,
|
||||||
'region_id' => 1,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:10',
|
||||||
'updated_at' => '2023-08-25 03:22:10',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q27394',
|
||||||
'wikiDataId' => 'Q27394',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 6,
|
||||||
'id' => 6,
|
'name' => 'Northern America',
|
||||||
'name' => 'Northern America',
|
'translations' => '{"korean":"북미","portuguese":"América Setentrional","dutch":"Noord-Amerika","persian":"شمال آمریکا","german":"Nordamerika","spanish":"América Norteña","french":"Amérique septentrionale","japanese":"北部アメリカ","italian":"America settentrionale","chinese":"北美地區"}',
|
||||||
'translations' => '{"korean":"북미","portuguese":"América Setentrional","dutch":"Noord-Amerika","persian":"شمال آمریکا","german":"Nordamerika","spanish":"América Norteña","french":"Amérique septentrionale","japanese":"北部アメリカ","italian":"America settentrionale","chinese":"北美地區"}',
|
'region_id' => 2,
|
||||||
'region_id' => 2,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:10',
|
||||||
'updated_at' => '2023-08-25 03:22:10',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q2017699',
|
||||||
'wikiDataId' => 'Q2017699',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 7,
|
||||||
'id' => 7,
|
'name' => 'Caribbean',
|
||||||
'name' => 'Caribbean',
|
'translations' => '{"korean":"카리브","portuguese":"Caraíbas","dutch":"Caraïben","croatian":"Karibi","persian":"کارائیب","german":"Karibik","spanish":"Caribe","french":"Caraïbes","japanese":"カリブ海地域","italian":"Caraibi","chinese":"加勒比地区"}',
|
||||||
'translations' => '{"korean":"카리브","portuguese":"Caraíbas","dutch":"Caraïben","croatian":"Karibi","persian":"کارائیب","german":"Karibik","spanish":"Caribe","french":"Caraïbes","japanese":"カリブ海地域","italian":"Caraibi","chinese":"加勒比地区"}',
|
'region_id' => 2,
|
||||||
'region_id' => 2,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:10',
|
||||||
'updated_at' => '2023-08-25 03:22:10',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q664609',
|
||||||
'wikiDataId' => 'Q664609',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 8,
|
||||||
'id' => 8,
|
'name' => 'South America',
|
||||||
'name' => 'South America',
|
'translations' => '{"korean":"남아메리카","portuguese":"América do Sul","dutch":"Zuid-Amerika","croatian":"Južna Amerika","persian":"آمریکای جنوبی","german":"Südamerika","spanish":"América del Sur","french":"Amérique du Sud","japanese":"南アメリカ","italian":"America meridionale","chinese":"南美洲"}',
|
||||||
'translations' => '{"korean":"남아메리카","portuguese":"América do Sul","dutch":"Zuid-Amerika","croatian":"Južna Amerika","persian":"آمریکای جنوبی","german":"Südamerika","spanish":"América del Sur","french":"Amérique du Sud","japanese":"南アメリカ","italian":"America meridionale","chinese":"南美洲"}',
|
'region_id' => 2,
|
||||||
'region_id' => 2,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:10',
|
||||||
'updated_at' => '2023-08-25 03:22:10',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q18',
|
||||||
'wikiDataId' => 'Q18',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 9,
|
||||||
'id' => 9,
|
'name' => 'Central America',
|
||||||
'name' => 'Central America',
|
'translations' => '{"korean":"중앙아메리카","portuguese":"América Central","dutch":"Centraal-Amerika","croatian":"Srednja Amerika","persian":"آمریکای مرکزی","german":"Zentralamerika","spanish":"América Central","french":"Amérique centrale","japanese":"中央アメリカ","italian":"America centrale","chinese":"中美洲"}',
|
||||||
'translations' => '{"korean":"중앙아메리카","portuguese":"América Central","dutch":"Centraal-Amerika","croatian":"Srednja Amerika","persian":"آمریکای مرکزی","german":"Zentralamerika","spanish":"América Central","french":"Amérique centrale","japanese":"中央アメリカ","italian":"America centrale","chinese":"中美洲"}',
|
'region_id' => 2,
|
||||||
'region_id' => 2,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:11',
|
||||||
'updated_at' => '2023-08-25 03:22:11',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q27611',
|
||||||
'wikiDataId' => 'Q27611',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 10,
|
||||||
'id' => 10,
|
'name' => 'Central Asia',
|
||||||
'name' => 'Central Asia',
|
'translations' => '{"korean":"중앙아시아","portuguese":"Ásia Central","dutch":"Centraal-Azië","croatian":"Srednja Azija","persian":"آسیای میانه","german":"Zentralasien","spanish":"Asia Central","french":"Asie centrale","japanese":"中央アジア","italian":"Asia centrale","chinese":"中亚"}',
|
||||||
'translations' => '{"korean":"중앙아시아","portuguese":"Ásia Central","dutch":"Centraal-Azië","croatian":"Srednja Azija","persian":"آسیای میانه","german":"Zentralasien","spanish":"Asia Central","french":"Asie centrale","japanese":"中央アジア","italian":"Asia centrale","chinese":"中亚"}',
|
'region_id' => 3,
|
||||||
'region_id' => 3,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:11',
|
||||||
'updated_at' => '2023-08-25 03:22:11',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q27275',
|
||||||
'wikiDataId' => 'Q27275',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 11,
|
||||||
'id' => 11,
|
'name' => 'Western Asia',
|
||||||
'name' => 'Western Asia',
|
'translations' => '{"korean":"서아시아","portuguese":"Sudoeste Asiático","dutch":"Zuidwest-Azië","croatian":"Jugozapadna Azija","persian":"غرب آسیا","german":"Vorderasien","spanish":"Asia Occidental","french":"Asie de l\'Ouest","japanese":"西アジア","italian":"Asia occidentale","chinese":"西亚"}',
|
||||||
'translations' => '{"korean":"서아시아","portuguese":"Sudoeste Asiático","dutch":"Zuidwest-Azië","croatian":"Jugozapadna Azija","persian":"غرب آسیا","german":"Vorderasien","spanish":"Asia Occidental","french":"Asie de l\'Ouest","japanese":"西アジア","italian":"Asia occidentale","chinese":"西亚"}',
|
'region_id' => 3,
|
||||||
'region_id' => 3,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:11',
|
||||||
'updated_at' => '2023-08-25 03:22:11',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q27293',
|
||||||
'wikiDataId' => 'Q27293',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 12,
|
||||||
'id' => 12,
|
'name' => 'Eastern Asia',
|
||||||
'name' => 'Eastern Asia',
|
'translations' => '{"korean":"동아시아","portuguese":"Ásia Oriental","dutch":"Oost-Azië","croatian":"Istočna Azija","persian":"شرق آسیا","german":"Ostasien","spanish":"Asia Oriental","french":"Asie de l\'Est","japanese":"東アジア","italian":"Asia orientale","chinese":"東亞"}',
|
||||||
'translations' => '{"korean":"동아시아","portuguese":"Ásia Oriental","dutch":"Oost-Azië","croatian":"Istočna Azija","persian":"شرق آسیا","german":"Ostasien","spanish":"Asia Oriental","french":"Asie de l\'Est","japanese":"東アジア","italian":"Asia orientale","chinese":"東亞"}',
|
'region_id' => 3,
|
||||||
'region_id' => 3,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:11',
|
||||||
'updated_at' => '2023-08-25 03:22:11',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q27231',
|
||||||
'wikiDataId' => 'Q27231',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 13,
|
||||||
'id' => 13,
|
'name' => 'South-Eastern Asia',
|
||||||
'name' => 'South-Eastern Asia',
|
'translations' => '{"korean":"동남아시아","portuguese":"Sudeste Asiático","dutch":"Zuidoost-Azië","croatian":"Jugoistočna Azija","persian":"جنوب شرق آسیا","german":"Südostasien","spanish":"Sudeste Asiático","french":"Asie du Sud-Est","japanese":"東南アジア","italian":"Sud-est asiatico","chinese":"东南亚"}',
|
||||||
'translations' => '{"korean":"동남아시아","portuguese":"Sudeste Asiático","dutch":"Zuidoost-Azië","croatian":"Jugoistočna Azija","persian":"جنوب شرق آسیا","german":"Südostasien","spanish":"Sudeste Asiático","french":"Asie du Sud-Est","japanese":"東南アジア","italian":"Sud-est asiatico","chinese":"东南亚"}',
|
'region_id' => 3,
|
||||||
'region_id' => 3,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:12',
|
||||||
'updated_at' => '2023-08-25 03:22:12',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q11708',
|
||||||
'wikiDataId' => 'Q11708',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 14,
|
||||||
'id' => 14,
|
'name' => 'Southern Asia',
|
||||||
'name' => 'Southern Asia',
|
'translations' => '{"korean":"남아시아","portuguese":"Ásia Meridional","dutch":"Zuid-Azië","croatian":"Južna Azija","persian":"جنوب آسیا","german":"Südasien","spanish":"Asia del Sur","french":"Asie du Sud","japanese":"南アジア","italian":"Asia meridionale","chinese":"南亚"}',
|
||||||
'translations' => '{"korean":"남아시아","portuguese":"Ásia Meridional","dutch":"Zuid-Azië","croatian":"Južna Azija","persian":"جنوب آسیا","german":"Südasien","spanish":"Asia del Sur","french":"Asie du Sud","japanese":"南アジア","italian":"Asia meridionale","chinese":"南亚"}',
|
'region_id' => 3,
|
||||||
'region_id' => 3,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:12',
|
||||||
'updated_at' => '2023-08-25 03:22:12',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q771405',
|
||||||
'wikiDataId' => 'Q771405',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 15,
|
||||||
'id' => 15,
|
'name' => 'Eastern Europe',
|
||||||
'name' => 'Eastern Europe',
|
'translations' => '{"korean":"동유럽","portuguese":"Europa de Leste","dutch":"Oost-Europa","croatian":"Istočna Europa","persian":"شرق اروپا","german":"Osteuropa","spanish":"Europa Oriental","french":"Europe de l\'Est","japanese":"東ヨーロッパ","italian":"Europa orientale","chinese":"东欧"}',
|
||||||
'translations' => '{"korean":"동유럽","portuguese":"Europa de Leste","dutch":"Oost-Europa","croatian":"Istočna Europa","persian":"شرق اروپا","german":"Osteuropa","spanish":"Europa Oriental","french":"Europe de l\'Est","japanese":"東ヨーロッパ","italian":"Europa orientale","chinese":"东欧"}',
|
'region_id' => 4,
|
||||||
'region_id' => 4,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:12',
|
||||||
'updated_at' => '2023-08-25 03:22:12',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q27468',
|
||||||
'wikiDataId' => 'Q27468',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 16,
|
||||||
'id' => 16,
|
'name' => 'Southern Europe',
|
||||||
'name' => 'Southern Europe',
|
'translations' => '{"korean":"남유럽","portuguese":"Europa meridional","dutch":"Zuid-Europa","croatian":"Južna Europa","persian":"جنوب اروپا","german":"Südeuropa","spanish":"Europa del Sur","french":"Europe du Sud","japanese":"南ヨーロッパ","italian":"Europa meridionale","chinese":"南欧"}',
|
||||||
'translations' => '{"korean":"남유럽","portuguese":"Europa meridional","dutch":"Zuid-Europa","croatian":"Južna Europa","persian":"جنوب اروپا","german":"Südeuropa","spanish":"Europa del Sur","french":"Europe du Sud","japanese":"南ヨーロッパ","italian":"Europa meridionale","chinese":"南欧"}',
|
'region_id' => 4,
|
||||||
'region_id' => 4,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:12',
|
||||||
'updated_at' => '2023-08-25 03:22:12',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q27449',
|
||||||
'wikiDataId' => 'Q27449',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 17,
|
||||||
'id' => 17,
|
'name' => 'Western Europe',
|
||||||
'name' => 'Western Europe',
|
'translations' => '{"korean":"서유럽","portuguese":"Europa Ocidental","dutch":"West-Europa","croatian":"Zapadna Europa","persian":"غرب اروپا","german":"Westeuropa","spanish":"Europa Occidental","french":"Europe de l\'Ouest","japanese":"西ヨーロッパ","italian":"Europa occidentale","chinese":"西欧"}',
|
||||||
'translations' => '{"korean":"서유럽","portuguese":"Europa Ocidental","dutch":"West-Europa","croatian":"Zapadna Europa","persian":"غرب اروپا","german":"Westeuropa","spanish":"Europa Occidental","french":"Europe de l\'Ouest","japanese":"西ヨーロッパ","italian":"Europa occidentale","chinese":"西欧"}',
|
'region_id' => 4,
|
||||||
'region_id' => 4,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:12',
|
||||||
'updated_at' => '2023-08-25 03:22:12',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q27496',
|
||||||
'wikiDataId' => 'Q27496',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 18,
|
||||||
'id' => 18,
|
'name' => 'Northern Europe',
|
||||||
'name' => 'Northern Europe',
|
'translations' => '{"korean":"북유럽","portuguese":"Europa Setentrional","dutch":"Noord-Europa","croatian":"Sjeverna Europa","persian":"شمال اروپا","german":"Nordeuropa","spanish":"Europa del Norte","french":"Europe du Nord","japanese":"北ヨーロッパ","italian":"Europa settentrionale","chinese":"北歐"}',
|
||||||
'translations' => '{"korean":"북유럽","portuguese":"Europa Setentrional","dutch":"Noord-Europa","croatian":"Sjeverna Europa","persian":"شمال اروپا","german":"Nordeuropa","spanish":"Europa del Norte","french":"Europe du Nord","japanese":"北ヨーロッパ","italian":"Europa settentrionale","chinese":"北歐"}',
|
'region_id' => 4,
|
||||||
'region_id' => 4,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:13',
|
||||||
'updated_at' => '2023-08-25 03:22:13',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q27479',
|
||||||
'wikiDataId' => 'Q27479',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 19,
|
||||||
'id' => 19,
|
'name' => 'Australia and New Zealand',
|
||||||
'name' => 'Australia and New Zealand',
|
'translations' => '{"korean":"오스트랄라시아","portuguese":"Australásia","dutch":"Australazië","croatian":"Australazija","persian":"استرالزی","german":"Australasien","spanish":"Australasia","french":"Australasie","japanese":"オーストララシア","italian":"Australasia","chinese":"澳大拉西亞"}',
|
||||||
'translations' => '{"korean":"오스트랄라시아","portuguese":"Australásia","dutch":"Australazië","croatian":"Australazija","persian":"استرالزی","german":"Australasien","spanish":"Australasia","french":"Australasie","japanese":"オーストララシア","italian":"Australasia","chinese":"澳大拉西亞"}',
|
'region_id' => 5,
|
||||||
'region_id' => 5,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:13',
|
||||||
'updated_at' => '2023-08-25 03:22:13',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q45256',
|
||||||
'wikiDataId' => 'Q45256',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 20,
|
||||||
'id' => 20,
|
'name' => 'Melanesia',
|
||||||
'name' => 'Melanesia',
|
'translations' => '{"korean":"멜라네시아","portuguese":"Melanésia","dutch":"Melanesië","croatian":"Melanezija","persian":"ملانزی","german":"Melanesien","spanish":"Melanesia","french":"Mélanésie","japanese":"メラネシア","italian":"Melanesia","chinese":"美拉尼西亚"}',
|
||||||
'translations' => '{"korean":"멜라네시아","portuguese":"Melanésia","dutch":"Melanesië","croatian":"Melanezija","persian":"ملانزی","german":"Melanesien","spanish":"Melanesia","french":"Mélanésie","japanese":"メラネシア","italian":"Melanesia","chinese":"美拉尼西亚"}',
|
'region_id' => 5,
|
||||||
'region_id' => 5,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:13',
|
||||||
'updated_at' => '2023-08-25 03:22:13',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q37394',
|
||||||
'wikiDataId' => 'Q37394',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 21,
|
||||||
'id' => 21,
|
'name' => 'Micronesia',
|
||||||
'name' => 'Micronesia',
|
'translations' => '{"korean":"미크로네시아","portuguese":"Micronésia","dutch":"Micronesië","croatian":"Mikronezija","persian":"میکرونزی","german":"Mikronesien","spanish":"Micronesia","french":"Micronésie","japanese":"ミクロネシア","italian":"Micronesia","chinese":"密克罗尼西亚群岛"}',
|
||||||
'translations' => '{"korean":"미크로네시아","portuguese":"Micronésia","dutch":"Micronesië","croatian":"Mikronezija","persian":"میکرونزی","german":"Mikronesien","spanish":"Micronesia","french":"Micronésie","japanese":"ミクロネシア","italian":"Micronesia","chinese":"密克罗尼西亚群岛"}',
|
'region_id' => 5,
|
||||||
'region_id' => 5,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:13',
|
||||||
'updated_at' => '2023-08-25 03:22:13',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q3359409',
|
||||||
'wikiDataId' => 'Q3359409',
|
],
|
||||||
],
|
[
|
||||||
[
|
'id' => 22,
|
||||||
'id' => 22,
|
'name' => 'Polynesia',
|
||||||
'name' => 'Polynesia',
|
'translations' => '{"korean":"폴리네시아","portuguese":"Polinésia","dutch":"Polynesië","croatian":"Polinezija","persian":"پلینزی","german":"Polynesien","spanish":"Polinesia","french":"Polynésie","japanese":"ポリネシア","italian":"Polinesia","chinese":"玻里尼西亞"}',
|
||||||
'translations' => '{"korean":"폴리네시아","portuguese":"Polinésia","dutch":"Polynesië","croatian":"Polinezija","persian":"پلینزی","german":"Polynesien","spanish":"Polinesia","french":"Polynésie","japanese":"ポリネシア","italian":"Polinesia","chinese":"玻里尼西亞"}',
|
'region_id' => 5,
|
||||||
'region_id' => 5,
|
'created_at' => '2023-08-14 14:11:03',
|
||||||
'created_at' => '2023-08-14 14:11:03',
|
'updated_at' => '2023-08-25 03:22:13',
|
||||||
'updated_at' => '2023-08-25 03:22:13',
|
'flag' => true,
|
||||||
'flag' => true,
|
'wikiDataId' => 'Q35942',
|
||||||
'wikiDataId' => 'Q35942',
|
],
|
||||||
],
|
];
|
||||||
];
|
parent::init();
|
||||||
parent::init();
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,347 +3,333 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace CakeAddresses\Test\TestCase\Controller;
|
namespace CakeAddresses\Test\TestCase\Controller;
|
||||||
|
|
||||||
use CakeAddresses\Controller\AddressesController;
|
|
||||||
use CakeAddresses\Model\Table\AddressesTable;
|
|
||||||
use PHPUnit\Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CakeAddresses\Controller\AddressesController Test Case
|
* CakeAddresses\Controller\AddressesController Test Case
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\AddressesController
|
* @uses \CakeAddresses\Controller\AddressesController
|
||||||
*/
|
*/
|
||||||
class AddressesControllerTest extends BaseControllerTest
|
class AddressesControllerTest extends BaseControllerTest {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Addresses Table
|
* Addresses Table
|
||||||
*
|
*
|
||||||
* @var \CakeAddresses\Model\Table\AddressesTable
|
* @var \CakeAddresses\Model\Table\AddressesTable
|
||||||
*/
|
*/
|
||||||
protected $Addresses;
|
protected $Addresses;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixtures
|
* Fixtures
|
||||||
*
|
*
|
||||||
* @var array<string>
|
* @var array<string>
|
||||||
*/
|
*/
|
||||||
protected array $fixtures = [
|
protected array $fixtures = [
|
||||||
'plugin.CakeAddresses.Addresses',
|
'plugin.CakeAddresses.Addresses',
|
||||||
// 'plugin.CakeAddresses.Cities',
|
// 'plugin.CakeAddresses.Cities',
|
||||||
'plugin.CakeAddresses.Countries',
|
'plugin.CakeAddresses.Countries',
|
||||||
// 'plugin.CakeAddresses.Regions',
|
// 'plugin.CakeAddresses.Regions',
|
||||||
'plugin.CakeAddresses.States',
|
'plugin.CakeAddresses.States',
|
||||||
// 'plugin.CakeAddresses.Subregions',
|
// 'plugin.CakeAddresses.Subregions',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void {
|
||||||
{
|
parent::setUp();
|
||||||
parent::setUp();
|
$this->Addresses = $this->getTableLocator()->get('CakeAddresses.Addresses');
|
||||||
$this->Addresses = $this->getTableLocator()->get('CakeAddresses.Addresses');
|
|
||||||
// $this->enableCsrfToken();
|
// $this->enableCsrfToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* tearDown method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void {
|
||||||
{
|
unset($this->Addresses);
|
||||||
unset($this->Addresses);
|
|
||||||
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test index method
|
* Test index method
|
||||||
*
|
*
|
||||||
* Tests the index action with an unauthenticated user (not logged in)
|
* Tests the index action with an unauthenticated user (not logged in)
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\AddressesController::index()
|
* @uses \CakeAddresses\Controller\AddressesController::index()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testIndexGet(): void
|
public function testIndexGet(): void {
|
||||||
{
|
$url = [
|
||||||
$url = [
|
'plugin' => 'CakeAddresses',
|
||||||
'plugin' => 'CakeAddresses',
|
'controller' => 'Addresses',
|
||||||
'controller' => 'Addresses',
|
'action' => 'index',
|
||||||
'action' => 'index',
|
];
|
||||||
];
|
$this->get($url);
|
||||||
$this->get($url);
|
$this->assertResponseCode(200);
|
||||||
$this->assertResponseCode(200);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test view method
|
* Test view method
|
||||||
*
|
*
|
||||||
* Tests the view action with an unauthenticated user (not logged in)
|
* Tests the view action with an unauthenticated user (not logged in)
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\AddressesController::view()
|
* @uses \CakeAddresses\Controller\AddressesController::view()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testViewGet(): void
|
public function testViewGet(): void {
|
||||||
{
|
$id = 1;
|
||||||
$id = 1;
|
$url = [
|
||||||
$url = [
|
'plugin' => 'CakeAddresses',
|
||||||
'plugin' => 'CakeAddresses',
|
'controller' => 'Addresses',
|
||||||
'controller' => 'Addresses',
|
'action' => 'view',
|
||||||
'action' => 'view',
|
$id,
|
||||||
$id,
|
];
|
||||||
];
|
$this->get($url);
|
||||||
$this->get($url);
|
$this->assertResponseCode(200);
|
||||||
$this->assertResponseCode(200);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test add method
|
* Test add method
|
||||||
*
|
*
|
||||||
* Tests the add action with an unauthenticated user (not logged in)
|
* Tests the add action with an unauthenticated user (not logged in)
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\AddressesController::add()
|
* @uses \CakeAddresses\Controller\AddressesController::add()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAddGet(): void
|
public function testAddGet(): void {
|
||||||
{
|
$cntBefore = $this->Addresses->find()->count();
|
||||||
$cntBefore = $this->Addresses->find()->count();
|
$url = [
|
||||||
$url = [
|
'plugin' => 'CakeAddresses',
|
||||||
'plugin' => 'CakeAddresses',
|
'controller' => 'Addresses',
|
||||||
'controller' => 'Addresses',
|
'action' => 'add',
|
||||||
'action' => 'add',
|
];
|
||||||
];
|
$this->get($url);
|
||||||
$this->get($url);
|
$this->assertResponseCode(200);
|
||||||
$this->assertResponseCode(200);
|
|
||||||
|
|
||||||
$cntAfter = $this->Addresses->find()->count();
|
$cntAfter = $this->Addresses->find()->count();
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
$this->assertEquals($cntBefore, $cntAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test add method
|
* Test add method
|
||||||
*
|
*
|
||||||
* Tests a POST request to the add action with a logged in user
|
* Tests a POST request to the add action with a logged in user
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\AddressesController::add()
|
* @uses \CakeAddresses\Controller\AddressesController::add()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAddPostSuccess(): void
|
public function testAddPostSuccess(): void {
|
||||||
{
|
$cntBefore = $this->Addresses->find()->count();
|
||||||
$cntBefore = $this->Addresses->find()->count();
|
|
||||||
|
|
||||||
$this->loginUserByRole();
|
$this->loginUserByRole();
|
||||||
$url = [
|
$url = [
|
||||||
'plugin' => 'CakeAddresses',
|
'plugin' => 'CakeAddresses',
|
||||||
'controller' => 'Addresses',
|
'controller' => 'Addresses',
|
||||||
'action' => 'add',
|
'action' => 'add',
|
||||||
];
|
];
|
||||||
$data = [
|
$data = [
|
||||||
'address_name' => 'new address',
|
'address_name' => 'new address',
|
||||||
'contact_name' => 'john doe',
|
'contact_name' => 'john doe',
|
||||||
'address_line1' => '123 Test ST',
|
'address_line1' => '123 Test ST',
|
||||||
'address_line2' => '',
|
'address_line2' => '',
|
||||||
'city' => 'Seattle',
|
'city' => 'Seattle',
|
||||||
'city_id' => '',
|
'city_id' => '',
|
||||||
'state_id' => 1462,
|
'state_id' => 1462,
|
||||||
'postal_code' => '98056',
|
'postal_code' => '98056',
|
||||||
'country_id' => 233,
|
'country_id' => 233,
|
||||||
'phone_number' => '',
|
'phone_number' => '',
|
||||||
'email' => '',
|
'email' => '',
|
||||||
'notes' => '',
|
'notes' => '',
|
||||||
];
|
];
|
||||||
$this->post($url, $data);
|
$this->post($url, $data);
|
||||||
$this->assertResponseCode(302);
|
$this->assertResponseCode(302);
|
||||||
$this->assertRedirectContains('addresses');
|
$this->assertRedirectContains('addresses');
|
||||||
|
|
||||||
$cntAfter = $this->Addresses->find()->count();
|
$cntAfter = $this->Addresses->find()->count();
|
||||||
$this->assertEquals($cntBefore + 1, $cntAfter);
|
$this->assertEquals($cntBefore + 1, $cntAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test add method
|
* Test add method
|
||||||
*
|
*
|
||||||
* Tests a POST request to the add action with a logged in user
|
* Tests a POST request to the add action with a logged in user
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\AddressesController::add()
|
* @uses \CakeAddresses\Controller\AddressesController::add()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAddPostFailure(): void
|
public function testAddPostFailure(): void {
|
||||||
{
|
$cntBefore = $this->Addresses->find()->count();
|
||||||
$cntBefore = $this->Addresses->find()->count();
|
|
||||||
|
|
||||||
$this->loginUserByRole();
|
$this->loginUserByRole();
|
||||||
$url = [
|
$url = [
|
||||||
'plugin' => 'CakeAddresses',
|
'plugin' => 'CakeAddresses',
|
||||||
'controller' => 'Addresses',
|
'controller' => 'Addresses',
|
||||||
'action' => 'add',
|
'action' => 'add',
|
||||||
];
|
];
|
||||||
$data = [
|
$data = [
|
||||||
'address_name' => '',
|
'address_name' => '',
|
||||||
'contact_name' => '',
|
'contact_name' => '',
|
||||||
'address_line1' => '',
|
'address_line1' => '',
|
||||||
'address_line2' => '',
|
'address_line2' => '',
|
||||||
'city' => 'Seattle',
|
'city' => 'Seattle',
|
||||||
'city_id' => '',
|
'city_id' => '',
|
||||||
'state_id' => 1462,
|
'state_id' => 1462,
|
||||||
'postal_code' => '98056',
|
'postal_code' => '98056',
|
||||||
'country_id' => 233,
|
'country_id' => 233,
|
||||||
'phone_number' => '',
|
'phone_number' => '',
|
||||||
'email' => '',
|
'email' => '',
|
||||||
'notes' => '',
|
'notes' => '',
|
||||||
];
|
];
|
||||||
$this->post($url, $data);
|
$this->post($url, $data);
|
||||||
$this->assertResponseCode(200);
|
$this->assertResponseCode(200);
|
||||||
|
|
||||||
$cntAfter = $this->Addresses->find()->count();
|
$cntAfter = $this->Addresses->find()->count();
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
$this->assertEquals($cntBefore, $cntAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test edit method
|
* Test edit method
|
||||||
*
|
*
|
||||||
* Tests the edit action with an unauthenticated user (not logged in)
|
* Tests the edit action with an unauthenticated user (not logged in)
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\AddressesController::edit()
|
* @uses \CakeAddresses\Controller\AddressesController::edit()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testEditGet(): void
|
public function testEditGet(): void {
|
||||||
{
|
$id = 1;
|
||||||
$id = 1;
|
$url = [
|
||||||
$url = [
|
'plugin' => 'CakeAddresses',
|
||||||
'plugin' => 'CakeAddresses',
|
'controller' => 'Addresses',
|
||||||
'controller' => 'Addresses',
|
'action' => 'edit',
|
||||||
'action' => 'edit',
|
$id,
|
||||||
$id,
|
];
|
||||||
];
|
$this->get($url);
|
||||||
$this->get($url);
|
$this->assertResponseCode(200);
|
||||||
$this->assertResponseCode(200);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test edit method
|
* Test edit method
|
||||||
*
|
*
|
||||||
* Tests a PUT request to the edit action with a logged in user
|
* Tests a PUT request to the edit action with a logged in user
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\AddressesController::edit()
|
* @uses \CakeAddresses\Controller\AddressesController::edit()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testEditPutSuccess(): void
|
public function testEditPutSuccess(): void {
|
||||||
{
|
$this->loginUserByRole();
|
||||||
$this->loginUserByRole();
|
$id = 1;
|
||||||
$id = 1;
|
$before = $this->Addresses->get($id);
|
||||||
$before = $this->Addresses->get($id);
|
$url = [
|
||||||
$url = [
|
'plugin' => 'CakeAddresses',
|
||||||
'plugin' => 'CakeAddresses',
|
'controller' => 'Addresses',
|
||||||
'controller' => 'Addresses',
|
'action' => 'edit',
|
||||||
'action' => 'edit',
|
$id,
|
||||||
$id,
|
];
|
||||||
];
|
$data = [
|
||||||
$data = [
|
// test new data here
|
||||||
// test new data here
|
'address_name' => 'new address',
|
||||||
'address_name' => 'new address',
|
'contact_name' => 'john doe',
|
||||||
'contact_name' => 'john doe',
|
'address_line1' => '123 Test ST',
|
||||||
'address_line1' => '123 Test ST',
|
'address_line2' => '',
|
||||||
'address_line2' => '',
|
'city' => 'Seattle',
|
||||||
'city' => 'Seattle',
|
'city_id' => '',
|
||||||
'city_id' => '',
|
'state_id' => 1462,
|
||||||
'state_id' => 1462,
|
'postal_code' => '98056',
|
||||||
'postal_code' => '98056',
|
'country_id' => 233,
|
||||||
'country_id' => 233,
|
'phone_number' => '',
|
||||||
'phone_number' => '',
|
'email' => '',
|
||||||
'email' => '',
|
'notes' => '',
|
||||||
'notes' => '',
|
];
|
||||||
];
|
$this->put($url, $data);
|
||||||
$this->put($url, $data);
|
|
||||||
|
|
||||||
$this->assertResponseCode(302);
|
$this->assertResponseCode(302);
|
||||||
$this->assertRedirectContains('addresses');
|
$this->assertRedirectContains('addresses');
|
||||||
|
|
||||||
$after = $this->Addresses->get($id);
|
$after = $this->Addresses->get($id);
|
||||||
// assert saved properly below
|
// assert saved properly below
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test edit method
|
* Test edit method
|
||||||
*
|
*
|
||||||
* Tests a PUT request to the edit action with a logged in user
|
* Tests a PUT request to the edit action with a logged in user
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\AddressesController::edit()
|
* @uses \CakeAddresses\Controller\AddressesController::edit()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testEditPutFailure(): void
|
public function testEditPutFailure(): void {
|
||||||
{
|
$id = 1;
|
||||||
$id = 1;
|
$before = $this->Addresses->get($id);
|
||||||
$before = $this->Addresses->get($id);
|
$url = [
|
||||||
$url = [
|
'plugin' => 'CakeAddresses',
|
||||||
'plugin' => 'CakeAddresses',
|
'controller' => 'Addresses',
|
||||||
'controller' => 'Addresses',
|
'action' => 'edit',
|
||||||
'action' => 'edit',
|
$id,
|
||||||
$id,
|
];
|
||||||
];
|
$data = [
|
||||||
$data = [
|
'address_name' => '',
|
||||||
'address_name' => '',
|
'contact_name' => '',
|
||||||
'contact_name' => '',
|
'address_line1' => '',
|
||||||
'address_line1' => '',
|
'address_line2' => '',
|
||||||
'address_line2' => '',
|
'city' => 'Seattle',
|
||||||
'city' => 'Seattle',
|
'city_id' => '',
|
||||||
'city_id' => '',
|
'state_id' => 1462,
|
||||||
'state_id' => 1462,
|
'postal_code' => '98056',
|
||||||
'postal_code' => '98056',
|
'country_id' => 233,
|
||||||
'country_id' => 233,
|
'phone_number' => '',
|
||||||
'phone_number' => '',
|
'email' => '',
|
||||||
'email' => '',
|
'notes' => '',
|
||||||
'notes' => '',
|
];
|
||||||
];
|
$this->put($url, $data);
|
||||||
$this->put($url, $data);
|
$this->assertResponseCode(200);
|
||||||
$this->assertResponseCode(200);
|
$after = $this->Addresses->get($id);
|
||||||
$after = $this->Addresses->get($id);
|
|
||||||
|
|
||||||
// assert save failed below
|
// assert save failed below
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test delete method
|
* Test delete method
|
||||||
*
|
*
|
||||||
* Tests the delete action with an unauthenticated user (not logged in)
|
* Tests the delete action with an unauthenticated user (not logged in)
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\AddressesController::delete()
|
* @uses \CakeAddresses\Controller\AddressesController::delete()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testDelete(): void
|
public function testDelete(): void {
|
||||||
{
|
$cntBefore = $this->Addresses->find()->count();
|
||||||
$cntBefore = $this->Addresses->find()->count();
|
|
||||||
|
|
||||||
$url = [
|
$url = [
|
||||||
'plugin' => 'CakeAddresses',
|
'plugin' => 'CakeAddresses',
|
||||||
'controller' => 'Addresses',
|
'controller' => 'Addresses',
|
||||||
'action' => 'delete',
|
'action' => 'delete',
|
||||||
1,
|
1,
|
||||||
];
|
];
|
||||||
$this->delete($url);
|
$this->delete($url);
|
||||||
$this->assertResponseCode(302);
|
$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\IntegrationTestTrait;
|
||||||
use Cake\TestSuite\TestCase;
|
use Cake\TestSuite\TestCase;
|
||||||
|
|
||||||
class BaseControllerTest extends TestCase
|
class BaseControllerTest extends TestCase {
|
||||||
{
|
|
||||||
use IntegrationTestTrait;
|
|
||||||
|
|
||||||
public function loginUserByRole(string $role = 'admin'): void
|
use IntegrationTestTrait;
|
||||||
{
|
|
||||||
$this->session(['Auth.User.id' => 1]);
|
|
||||||
$this->session(['Auth.id' => 1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $role - role name - makes testing different roles easier
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testTest()
|
public function loginUserByRole(string $role = 'admin'): void {
|
||||||
{
|
$this->session(['Auth.User.id' => 1]);
|
||||||
$this->assertEquals(1, 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;
|
namespace CakeAddresses\Test\TestCase\Controller;
|
||||||
|
|
||||||
use CakeAddresses\Controller\CitiesController;
|
|
||||||
use PHPUnit\Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CakeAddresses\Controller\CitiesController Test Case
|
* CakeAddresses\Controller\CitiesController Test Case
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\CitiesController
|
* @uses \CakeAddresses\Controller\CitiesController
|
||||||
*/
|
*/
|
||||||
class CitiesControllerTest extends BaseControllerTest
|
class CitiesControllerTest extends BaseControllerTest {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Cities Table
|
* Cities Table
|
||||||
*
|
*
|
||||||
* @var \CakeAddresses\Model\Table\CitiesTable
|
* @var \CakeAddresses\Model\Table\CitiesTable
|
||||||
*/
|
*/
|
||||||
protected $Cities;
|
protected $Cities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixtures
|
* Fixtures
|
||||||
*
|
*
|
||||||
* @var array<string>
|
* @var array<string>
|
||||||
*/
|
*/
|
||||||
protected array $fixtures = [
|
protected array $fixtures = [
|
||||||
// 'plugin.CakeAddresses.Regions',
|
// 'plugin.CakeAddresses.Regions',
|
||||||
// 'plugin.CakeAddresses.Subregions',
|
// 'plugin.CakeAddresses.Subregions',
|
||||||
'plugin.CakeAddresses.Countries',
|
'plugin.CakeAddresses.Countries',
|
||||||
'plugin.CakeAddresses.States',
|
'plugin.CakeAddresses.States',
|
||||||
'plugin.CakeAddresses.Cities',
|
'plugin.CakeAddresses.Cities',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void {
|
||||||
{
|
parent::setUp();
|
||||||
parent::setUp();
|
$this->Cities = $this->getTableLocator()->get('CakeAddresses.Cities');
|
||||||
$this->Cities = $this->getTableLocator()->get('CakeAddresses.Cities');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* tearDown method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void {
|
||||||
{
|
unset($this->Cities);
|
||||||
unset($this->Cities);
|
|
||||||
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test select method
|
* Test select method
|
||||||
*
|
*
|
||||||
* Tests the select action with a logged in user
|
* Tests the select action with a logged in user
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\CitiesController::select()
|
* @uses \CakeAddresses\Controller\CitiesController::select()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testSelect(): void
|
public function testSelect(): void {
|
||||||
{
|
$url = [
|
||||||
$url = [
|
'plugin' => 'CakeAddresses',
|
||||||
'plugin' => 'CakeAddresses',
|
'controller' => 'Cities',
|
||||||
'controller' => 'Cities',
|
'action' => 'select',
|
||||||
'action' => 'select',
|
];
|
||||||
];
|
$this->get($url);
|
||||||
$this->get($url);
|
$this->assertResponseCode(200);
|
||||||
$this->assertResponseCode(200);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,100 +3,94 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace CakeAddresses\Test\TestCase\Controller;
|
namespace CakeAddresses\Test\TestCase\Controller;
|
||||||
|
|
||||||
use CakeAddresses\Controller\CountriesController;
|
|
||||||
use PHPUnit\Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CakeAddresses\Controller\CountriesController Test Case
|
* CakeAddresses\Controller\CountriesController Test Case
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\CountriesController
|
* @uses \CakeAddresses\Controller\CountriesController
|
||||||
*/
|
*/
|
||||||
class CountriesControllerTest extends BaseControllerTest
|
class CountriesControllerTest extends BaseControllerTest {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* AnsibleGroups Table
|
* AnsibleGroups Table
|
||||||
*
|
*
|
||||||
* @var \CakeAddresses\Model\Table\CountriesTable
|
* @var \CakeAddresses\Model\Table\CountriesTable
|
||||||
*/
|
*/
|
||||||
protected $Countries;
|
protected $Countries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixtures
|
* Fixtures
|
||||||
*
|
*
|
||||||
* @var array<string>
|
* @var array<string>
|
||||||
*/
|
*/
|
||||||
protected array $fixtures = [
|
protected array $fixtures = [
|
||||||
'plugin.CakeAddresses.Regions',
|
'plugin.CakeAddresses.Regions',
|
||||||
'plugin.CakeAddresses.Subregions',
|
'plugin.CakeAddresses.Subregions',
|
||||||
'plugin.CakeAddresses.Countries',
|
'plugin.CakeAddresses.Countries',
|
||||||
'plugin.CakeAddresses.States',
|
'plugin.CakeAddresses.States',
|
||||||
// 'plugin.CakeAddresses.Cities',
|
// 'plugin.CakeAddresses.Cities',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void {
|
||||||
{
|
parent::setUp();
|
||||||
parent::setUp();
|
$this->Countries = $this->getTableLocator()->get('CakeAddresses.Countries');
|
||||||
$this->Countries = $this->getTableLocator()->get('CakeAddresses.Countries');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* tearDown method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void {
|
||||||
{
|
unset($this->Countries);
|
||||||
unset($this->Countries);
|
|
||||||
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test index method
|
* Test index method
|
||||||
*
|
*
|
||||||
* Tests the index action with a logged in user
|
* Tests the index action with a logged in user
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\CountriesController::index()
|
* @uses \CakeAddresses\Controller\CountriesController::index()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testIndexGet(): void
|
public function testIndexGet(): void {
|
||||||
{
|
$url = [
|
||||||
$url = [
|
'plugin' => 'CakeAddresses',
|
||||||
'plugin' => 'CakeAddresses',
|
'controller' => 'Countries',
|
||||||
'controller' => 'Countries',
|
'action' => 'index',
|
||||||
'action' => 'index',
|
];
|
||||||
];
|
$this->get($url);
|
||||||
$this->get($url);
|
$this->assertResponseCode(200);
|
||||||
$this->assertResponseCode(200);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test view method
|
* Test view method
|
||||||
*
|
*
|
||||||
* Tests the view action with a logged in user
|
* Tests the view action with a logged in user
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\CountriesController::view()
|
* @uses \CakeAddresses\Controller\CountriesController::view()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testViewGet(): void
|
public function testViewGet(): void {
|
||||||
{
|
$id = 233;
|
||||||
$id = 233;
|
$url = [
|
||||||
$url = [
|
'plugin' => 'CakeAddresses',
|
||||||
'plugin' => 'CakeAddresses',
|
'controller' => 'Countries',
|
||||||
'controller' => 'Countries',
|
'action' => 'view',
|
||||||
'action' => 'view',
|
$id,
|
||||||
$id,
|
];
|
||||||
];
|
$this->get($url);
|
||||||
$this->get($url);
|
$this->assertResponseCode(200);
|
||||||
$this->assertResponseCode(200);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,103 +3,95 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace CakeAddresses\Test\TestCase\Controller;
|
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
|
* CakeAddresses\Controller\RegionsController Test Case
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\RegionsController
|
* @uses \CakeAddresses\Controller\RegionsController
|
||||||
*/
|
*/
|
||||||
class RegionsControllerTest extends BaseControllerTest
|
class RegionsControllerTest extends BaseControllerTest {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Regions Table
|
* Regions Table
|
||||||
*
|
*
|
||||||
* @var \CakeAddresses\Model\Table\RegionsTable
|
* @var \CakeAddresses\Model\Table\RegionsTable
|
||||||
*/
|
*/
|
||||||
protected $Regions;
|
protected $Regions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixtures
|
* Fixtures
|
||||||
*
|
*
|
||||||
* @var array<string>
|
* @var array<string>
|
||||||
*/
|
*/
|
||||||
protected array $fixtures = [
|
protected array $fixtures = [
|
||||||
'plugin.CakeAddresses.Regions',
|
'plugin.CakeAddresses.Regions',
|
||||||
// 'plugin.CakeAddresses.Subregions',
|
// 'plugin.CakeAddresses.Subregions',
|
||||||
// 'plugin.CakeAddresses.Countries',
|
// 'plugin.CakeAddresses.Countries',
|
||||||
// 'plugin.CakeAddresses.States',
|
// 'plugin.CakeAddresses.States',
|
||||||
// 'plugin.CakeAddresses.Cities',
|
// 'plugin.CakeAddresses.Cities',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void {
|
||||||
{
|
parent::setUp();
|
||||||
parent::setUp();
|
$this->Regions = $this->getTableLocator()->get('CakeAddresses.Regions');
|
||||||
$this->Regions = $this->getTableLocator()->get('CakeAddresses.Regions');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* tearDown method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void {
|
||||||
{
|
unset($this->Regions);
|
||||||
unset($this->Regions);
|
|
||||||
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test index method
|
* Test index method
|
||||||
*
|
*
|
||||||
* Tests the index action with a logged in user
|
* Tests the index action with a logged in user
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\RegionsController::index()
|
* @uses \CakeAddresses\Controller\RegionsController::index()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testIndexGet(): void
|
public function testIndexGet(): void {
|
||||||
{
|
$url = [
|
||||||
$url = [
|
'plugin' => 'CakeAddresses',
|
||||||
'plugin' => 'CakeAddresses',
|
'controller' => 'Regions',
|
||||||
'controller' => 'Regions',
|
'action' => 'index',
|
||||||
'action' => 'index',
|
];
|
||||||
];
|
$this->get($url);
|
||||||
$this->get($url);
|
$this->assertResponseCode(200);
|
||||||
$this->assertResponseCode(200);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test view method
|
* Test view method
|
||||||
*
|
*
|
||||||
* Tests the view action with a logged in user
|
* Tests the view action with a logged in user
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\RegionsController::view()
|
* @uses \CakeAddresses\Controller\RegionsController::view()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testViewGet(): void
|
public function testViewGet(): void {
|
||||||
{
|
$id = 1;
|
||||||
$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;
|
namespace CakeAddresses\Test\TestCase\Controller;
|
||||||
|
|
||||||
use CakeAddresses\Controller\StatesController;
|
|
||||||
use PHPUnit\Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CakeAddresses\Controller\StatesController Test Case
|
* CakeAddresses\Controller\StatesController Test Case
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\StatesController
|
* @uses \CakeAddresses\Controller\StatesController
|
||||||
*/
|
*/
|
||||||
class StatesControllerTest extends BaseControllerTest
|
class StatesControllerTest extends BaseControllerTest {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* States Table
|
* States Table
|
||||||
*
|
*
|
||||||
* @var \CakeAddresses\Model\Table\StatesTable
|
* @var \CakeAddresses\Model\Table\StatesTable
|
||||||
*/
|
*/
|
||||||
protected $States;
|
protected $States;
|
||||||
/**
|
|
||||||
|
/**
|
||||||
* Fixtures
|
* Fixtures
|
||||||
*
|
*
|
||||||
* @var array<string>
|
* @var array<string>
|
||||||
*/
|
*/
|
||||||
protected array $fixtures = [
|
protected array $fixtures = [
|
||||||
// 'plugin.CakeAddresses.Regions',
|
// 'plugin.CakeAddresses.Regions',
|
||||||
// 'plugin.CakeAddresses.Subregions',
|
// 'plugin.CakeAddresses.Subregions',
|
||||||
'plugin.CakeAddresses.Countries',
|
'plugin.CakeAddresses.Countries',
|
||||||
'plugin.CakeAddresses.States',
|
'plugin.CakeAddresses.States',
|
||||||
// 'plugin.CakeAddresses.Cities',
|
// 'plugin.CakeAddresses.Cities',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void {
|
||||||
{
|
parent::setUp();
|
||||||
parent::setUp();
|
$this->States = $this->getTableLocator()->get('CakeAddresses.States');
|
||||||
$this->States = $this->getTableLocator()->get('CakeAddresses.States');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* tearDown method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void {
|
||||||
{
|
unset($this->States);
|
||||||
unset($this->States);
|
|
||||||
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test index method
|
* Test index method
|
||||||
*
|
*
|
||||||
* Tests the index action with a logged in user
|
* Tests the index action with a logged in user
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\StatesController::index()
|
* @uses \CakeAddresses\Controller\StatesController::index()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testIndexGet(): void
|
public function testIndexGet(): void {
|
||||||
{
|
$url = [
|
||||||
$url = [
|
'plugin' => 'CakeAddresses',
|
||||||
'plugin' => 'CakeAddresses',
|
'controller' => 'States',
|
||||||
'controller' => 'States',
|
'action' => 'index',
|
||||||
'action' => 'index',
|
];
|
||||||
];
|
$this->get($url);
|
||||||
$this->get($url);
|
$this->assertResponseCode(200);
|
||||||
$this->assertResponseCode(200);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test view method
|
* Test view method
|
||||||
*
|
*
|
||||||
* Tests the view action with a logged in user
|
* Tests the view action with a logged in user
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\StatesController::view()
|
* @uses \CakeAddresses\Controller\StatesController::view()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testViewGet(): void
|
public function testViewGet(): void {
|
||||||
{
|
$id = 1462;
|
||||||
$id = 1462;
|
$url = [
|
||||||
$url = [
|
'plugin' => 'CakeAddresses',
|
||||||
'plugin' => 'CakeAddresses',
|
'controller' => 'States',
|
||||||
'controller' => 'States',
|
'action' => 'view',
|
||||||
'action' => 'view',
|
$id,
|
||||||
$id,
|
];
|
||||||
];
|
$this->get($url);
|
||||||
$this->get($url);
|
$this->assertResponseCode(200);
|
||||||
$this->assertResponseCode(200);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,104 +3,96 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace CakeAddresses\Test\TestCase\Controller;
|
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
|
* CakeAddresses\Controller\SubregionsController Test Case
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\SubregionsController
|
* @uses \CakeAddresses\Controller\SubregionsController
|
||||||
*/
|
*/
|
||||||
class SubregionsControllerTest extends BaseControllerTest
|
class SubregionsControllerTest extends BaseControllerTest {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Subregions Table
|
* Subregions Table
|
||||||
*
|
*
|
||||||
* @var \CakeAddresses\Model\Table\SubregionsTable
|
* @var \CakeAddresses\Model\Table\SubregionsTable
|
||||||
*/
|
*/
|
||||||
protected $Subregions;
|
protected $Subregions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixtures
|
* Fixtures
|
||||||
*
|
*
|
||||||
* @var array<string>
|
* @var array<string>
|
||||||
*/
|
*/
|
||||||
protected array $fixtures = [
|
protected array $fixtures = [
|
||||||
'plugin.CakeAddresses.Regions',
|
'plugin.CakeAddresses.Regions',
|
||||||
'plugin.CakeAddresses.Subregions',
|
'plugin.CakeAddresses.Subregions',
|
||||||
'plugin.CakeAddresses.Countries',
|
'plugin.CakeAddresses.Countries',
|
||||||
// 'plugin.CakeAddresses.States',
|
// 'plugin.CakeAddresses.States',
|
||||||
// 'plugin.CakeAddresses.Cities',
|
// 'plugin.CakeAddresses.Cities',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void {
|
||||||
{
|
parent::setUp();
|
||||||
parent::setUp();
|
$this->Subregions = $this->getTableLocator()->get('CakeAddresses.Subregions');
|
||||||
$this->Subregions = $this->getTableLocator()->get('CakeAddresses.Subregions');
|
$this->enableCsrfToken();
|
||||||
$this->enableCsrfToken();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* tearDown method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void {
|
||||||
{
|
unset($this->Subregions);
|
||||||
unset($this->Subregions);
|
|
||||||
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test index method
|
* Test index method
|
||||||
*
|
*
|
||||||
* Tests the index action with a logged in user
|
* Tests the index action with a logged in user
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\SubregionsController::index()
|
* @uses \CakeAddresses\Controller\SubregionsController::index()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testIndexGet(): void
|
public function testIndexGet(): void {
|
||||||
{
|
$url = [
|
||||||
$url = [
|
'plugin' => 'CakeAddresses',
|
||||||
'plugin' => 'CakeAddresses',
|
'controller' => 'Subregions',
|
||||||
'controller' => 'Subregions',
|
'action' => 'index',
|
||||||
'action' => 'index',
|
];
|
||||||
];
|
$this->get($url);
|
||||||
$this->get($url);
|
$this->assertResponseCode(200);
|
||||||
$this->assertResponseCode(200);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test view method
|
* Test view method
|
||||||
*
|
*
|
||||||
* Tests the view action with a logged in user
|
* Tests the view action with a logged in user
|
||||||
*
|
*
|
||||||
* @uses \CakeAddresses\Controller\SubregionsController::view()
|
* @uses \CakeAddresses\Controller\SubregionsController::view()
|
||||||
* @throws Exception
|
* @throws \PHPUnit\Exception
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testViewGet(): void
|
public function testViewGet(): void {
|
||||||
{
|
$id = 1;
|
||||||
$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
|
* CakeAddresses\Model\Table\AddressesTable Test Case
|
||||||
*/
|
*/
|
||||||
class AddressesTableTest extends TestCase
|
class AddressesTableTest extends TestCase {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Test subject
|
* Test subject
|
||||||
*
|
*
|
||||||
* @var \CakeAddresses\Model\Table\AddressesTable
|
* @var \CakeAddresses\Model\Table\AddressesTable
|
||||||
*/
|
*/
|
||||||
protected $Addresses;
|
protected $Addresses;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixtures
|
* Fixtures
|
||||||
*
|
*
|
||||||
* @var array<string>
|
* @var array<string>
|
||||||
*/
|
*/
|
||||||
protected array $fixtures = [
|
protected array $fixtures = [
|
||||||
'plugin.CakeAddresses.Addresses',
|
'plugin.CakeAddresses.Addresses',
|
||||||
'plugin.CakeAddresses.Cities',
|
'plugin.CakeAddresses.Cities',
|
||||||
'plugin.CakeAddresses.States',
|
'plugin.CakeAddresses.States',
|
||||||
'plugin.CakeAddresses.Countries',
|
'plugin.CakeAddresses.Countries',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void {
|
||||||
{
|
parent::setUp();
|
||||||
parent::setUp();
|
$config = $this->getTableLocator()->exists('Addresses') ? [] : ['className' => AddressesTable::class];
|
||||||
$config = $this->getTableLocator()->exists('Addresses') ? [] : ['className' => AddressesTable::class];
|
$this->Addresses = $this->getTableLocator()->get('Addresses', $config);
|
||||||
$this->Addresses = $this->getTableLocator()->get('Addresses', $config);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TestInitialize method
|
* TestInitialize method
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
* @uses \CakeAddresses\Model\Table\AddressesTable::initialize()
|
* @uses \CakeAddresses\Model\Table\AddressesTable::initialize()
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testInitialize(): void
|
public function testInitialize(): void {
|
||||||
{
|
// verify all associations loaded
|
||||||
// verify all associations loaded
|
$expectedAssociations = [
|
||||||
$expectedAssociations = [
|
'Cities',
|
||||||
'Cities',
|
'States',
|
||||||
'States',
|
'Countries',
|
||||||
'Countries',
|
];
|
||||||
];
|
$associations = $this->Addresses->associations();
|
||||||
$associations = $this->Addresses->associations();
|
|
||||||
|
|
||||||
$this->assertCount(count($expectedAssociations), $associations);
|
$this->assertCount(count($expectedAssociations), $associations);
|
||||||
foreach ($expectedAssociations as $expectedAssociation) {
|
foreach ($expectedAssociations as $expectedAssociation) {
|
||||||
$this->assertTrue($this->Addresses->hasAssociation($expectedAssociation), 'Failed asserting Addresses has the association: ' . $expectedAssociation);
|
$this->assertTrue($this->Addresses->hasAssociation($expectedAssociation), 'Failed asserting Addresses has the association: ' . $expectedAssociation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// verify all behaviors loaded
|
// verify all behaviors loaded
|
||||||
$expectedBehaviors = [
|
$expectedBehaviors = [];
|
||||||
];
|
$behaviors = $this->Addresses->behaviors();
|
||||||
$behaviors = $this->Addresses->behaviors();
|
|
||||||
|
|
||||||
$this->assertCount(count($expectedBehaviors), $behaviors);
|
$this->assertCount(count($expectedBehaviors), $behaviors);
|
||||||
foreach ($expectedBehaviors as $expectedBehavior) {
|
foreach ($expectedBehaviors as $expectedBehavior) {
|
||||||
$this->assertTrue($this->Addresses->hasBehavior($expectedBehavior));
|
$this->assertTrue($this->Addresses->hasBehavior($expectedBehavior));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/**
|
|
||||||
* tearDown method
|
* tearDown method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void {
|
||||||
{
|
unset($this->Addresses);
|
||||||
unset($this->Addresses);
|
|
||||||
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test validationDefault method
|
* Test validationDefault method
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
* @uses \CakeAddresses\Model\Table\AddressesTable::validationDefault()
|
* @uses \CakeAddresses\Model\Table\AddressesTable::validationDefault()
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testValidationDefault(): void
|
public function testValidationDefault(): void {
|
||||||
{
|
$this->markTestIncomplete('Not implemented yet.');
|
||||||
$this->markTestIncomplete('Not implemented yet.');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test buildRules method
|
* Test buildRules method
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
* @uses \CakeAddresses\Model\Table\AddressesTable::buildRules()
|
* @uses \CakeAddresses\Model\Table\AddressesTable::buildRules()
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testBuildRules(): void
|
public function testBuildRules(): void {
|
||||||
{
|
$this->markTestIncomplete('Not implemented yet.');
|
||||||
$this->markTestIncomplete('Not implemented yet.');
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,103 +9,97 @@ use CakeAddresses\Model\Table\CitiesTable;
|
|||||||
/**
|
/**
|
||||||
* CakeAddresses\Model\Table\CitiesTable Test Case
|
* CakeAddresses\Model\Table\CitiesTable Test Case
|
||||||
*/
|
*/
|
||||||
class CitiesTableTest extends TestCase
|
class CitiesTableTest extends TestCase {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Test subject
|
* Test subject
|
||||||
*
|
*
|
||||||
* @var \CakeAddresses\Model\Table\CitiesTable
|
* @var \CakeAddresses\Model\Table\CitiesTable
|
||||||
*/
|
*/
|
||||||
protected $Cities;
|
protected $Cities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixtures
|
* Fixtures
|
||||||
*
|
*
|
||||||
* @var array<string>
|
* @var array<string>
|
||||||
*/
|
*/
|
||||||
protected array $fixtures = [
|
protected array $fixtures = [
|
||||||
'plugin.CakeAddresses.Cities',
|
'plugin.CakeAddresses.Cities',
|
||||||
'plugin.CakeAddresses.States',
|
'plugin.CakeAddresses.States',
|
||||||
'plugin.CakeAddresses.Countries',
|
'plugin.CakeAddresses.Countries',
|
||||||
'plugin.CakeAddresses.Addresses',
|
'plugin.CakeAddresses.Addresses',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void {
|
||||||
{
|
parent::setUp();
|
||||||
parent::setUp();
|
$config = $this->getTableLocator()->exists('Cities') ? [] : ['className' => CitiesTable::class];
|
||||||
$config = $this->getTableLocator()->exists('Cities') ? [] : ['className' => CitiesTable::class];
|
$this->Cities = $this->getTableLocator()->get('Cities', $config);
|
||||||
$this->Cities = $this->getTableLocator()->get('Cities', $config);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* tearDown method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void {
|
||||||
{
|
unset($this->Cities);
|
||||||
unset($this->Cities);
|
|
||||||
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TestInitialize method
|
* TestInitialize method
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
* @uses \CakeAddresses\Model\Table\CitiesTable::initialize()
|
* @uses \CakeAddresses\Model\Table\CitiesTable::initialize()
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testInitialize(): void
|
public function testInitialize(): void {
|
||||||
{
|
// verify all associations loaded
|
||||||
// verify all associations loaded
|
$expectedAssociations = [
|
||||||
$expectedAssociations = [
|
'States',
|
||||||
'States',
|
'Countries',
|
||||||
'Countries',
|
'Addresses',
|
||||||
'Addresses',
|
];
|
||||||
];
|
$associations = $this->Cities->associations();
|
||||||
$associations = $this->Cities->associations();
|
|
||||||
|
|
||||||
$this->assertCount(count($expectedAssociations), $associations);
|
$this->assertCount(count($expectedAssociations), $associations);
|
||||||
foreach ($expectedAssociations as $expectedAssociation) {
|
foreach ($expectedAssociations as $expectedAssociation) {
|
||||||
$this->assertTrue($this->Cities->hasAssociation($expectedAssociation), 'Failed asserting Cities has the association: ' . $expectedAssociation);
|
$this->assertTrue($this->Cities->hasAssociation($expectedAssociation), 'Failed asserting Cities has the association: ' . $expectedAssociation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// verify all behaviors loaded
|
// verify all behaviors loaded
|
||||||
$expectedBehaviors = [
|
$expectedBehaviors = [];
|
||||||
];
|
$behaviors = $this->Cities->behaviors();
|
||||||
$behaviors = $this->Cities->behaviors();
|
|
||||||
|
|
||||||
$this->assertCount(count($expectedBehaviors), $behaviors);
|
$this->assertCount(count($expectedBehaviors), $behaviors);
|
||||||
foreach ($expectedBehaviors as $expectedBehavior) {
|
foreach ($expectedBehaviors as $expectedBehavior) {
|
||||||
$this->assertTrue($this->Cities->hasBehavior($expectedBehavior));
|
$this->assertTrue($this->Cities->hasBehavior($expectedBehavior));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/**
|
|
||||||
* Test validationDefault method
|
* Test validationDefault method
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
* @uses \CakeAddresses\Model\Table\CitiesTable::validationDefault()
|
* @uses \CakeAddresses\Model\Table\CitiesTable::validationDefault()
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testValidationDefault(): void
|
public function testValidationDefault(): void {
|
||||||
{
|
$this->markTestIncomplete('Not implemented yet.');
|
||||||
$this->markTestIncomplete('Not implemented yet.');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test buildRules method
|
* Test buildRules method
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
* @uses \CakeAddresses\Model\Table\CitiesTable::buildRules()
|
* @uses \CakeAddresses\Model\Table\CitiesTable::buildRules()
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testBuildRules(): void
|
public function testBuildRules(): void {
|
||||||
{
|
$this->markTestIncomplete('Not implemented yet.');
|
||||||
$this->markTestIncomplete('Not implemented yet.');
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,72 +9,69 @@ use CakeAddresses\Model\Table\CountriesTable;
|
|||||||
/**
|
/**
|
||||||
* CakeAddresses\Model\Table\CountriesTable Test Case
|
* CakeAddresses\Model\Table\CountriesTable Test Case
|
||||||
*/
|
*/
|
||||||
class CountriesTableTest extends TestCase
|
class CountriesTableTest extends TestCase {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Test subject
|
* Test subject
|
||||||
*
|
*
|
||||||
* @var \CakeAddresses\Model\Table\CountriesTable
|
* @var \CakeAddresses\Model\Table\CountriesTable
|
||||||
*/
|
*/
|
||||||
protected $Countries;
|
protected $Countries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixtures
|
* Fixtures
|
||||||
*
|
*
|
||||||
* @var array<string>
|
* @var array<string>
|
||||||
*/
|
*/
|
||||||
protected array $fixtures = [
|
protected array $fixtures = [
|
||||||
'plugin.CakeAddresses.Countries',
|
'plugin.CakeAddresses.Countries',
|
||||||
'plugin.CakeAddresses.Regions',
|
'plugin.CakeAddresses.Regions',
|
||||||
'plugin.CakeAddresses.Subregions',
|
'plugin.CakeAddresses.Subregions',
|
||||||
'plugin.CakeAddresses.Addresses',
|
'plugin.CakeAddresses.Addresses',
|
||||||
'plugin.CakeAddresses.Cities',
|
'plugin.CakeAddresses.Cities',
|
||||||
'plugin.CakeAddresses.States',
|
'plugin.CakeAddresses.States',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void {
|
||||||
{
|
parent::setUp();
|
||||||
parent::setUp();
|
$config = $this->getTableLocator()->exists('Countries') ? [] : ['className' => CountriesTable::class];
|
||||||
$config = $this->getTableLocator()->exists('Countries') ? [] : ['className' => CountriesTable::class];
|
$this->Countries = $this->getTableLocator()->get('Countries', $config);
|
||||||
$this->Countries = $this->getTableLocator()->get('Countries', $config);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* tearDown method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void {
|
||||||
{
|
unset($this->Countries);
|
||||||
unset($this->Countries);
|
|
||||||
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test validationDefault method
|
* Test validationDefault method
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
* @uses \CakeAddresses\Model\Table\CountriesTable::validationDefault()
|
* @uses \CakeAddresses\Model\Table\CountriesTable::validationDefault()
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testValidationDefault(): void
|
public function testValidationDefault(): void {
|
||||||
{
|
$this->markTestIncomplete('Not implemented yet.');
|
||||||
$this->markTestIncomplete('Not implemented yet.');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test buildRules method
|
* Test buildRules method
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
* @uses \CakeAddresses\Model\Table\CountriesTable::buildRules()
|
* @uses \CakeAddresses\Model\Table\CountriesTable::buildRules()
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testBuildRules(): void
|
public function testBuildRules(): void {
|
||||||
{
|
$this->markTestIncomplete('Not implemented yet.');
|
||||||
$this->markTestIncomplete('Not implemented yet.');
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,89 +9,86 @@ use CakeAddresses\Model\Table\RegionsTable;
|
|||||||
/**
|
/**
|
||||||
* CakeAddresses\Model\Table\RegionsTable Test Case
|
* CakeAddresses\Model\Table\RegionsTable Test Case
|
||||||
*/
|
*/
|
||||||
class RegionsTableTest extends TestCase
|
class RegionsTableTest extends TestCase {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Test subject
|
* Test subject
|
||||||
*
|
*
|
||||||
* @var \CakeAddresses\Model\Table\RegionsTable
|
* @var \CakeAddresses\Model\Table\RegionsTable
|
||||||
*/
|
*/
|
||||||
protected $Regions;
|
protected $Regions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixtures
|
* Fixtures
|
||||||
*
|
*
|
||||||
* @var array<string>
|
* @var array<string>
|
||||||
*/
|
*/
|
||||||
protected array $fixtures = [
|
protected array $fixtures = [
|
||||||
'plugin.CakeAddresses.Regions',
|
'plugin.CakeAddresses.Regions',
|
||||||
'plugin.CakeAddresses.Countries',
|
'plugin.CakeAddresses.Countries',
|
||||||
'plugin.CakeAddresses.Subregions',
|
'plugin.CakeAddresses.Subregions',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void {
|
||||||
{
|
parent::setUp();
|
||||||
parent::setUp();
|
$config = $this->getTableLocator()->exists('Regions') ? [] : ['className' => RegionsTable::class];
|
||||||
$config = $this->getTableLocator()->exists('Regions') ? [] : ['className' => RegionsTable::class];
|
$this->Regions = $this->getTableLocator()->get('Regions', $config);
|
||||||
$this->Regions = $this->getTableLocator()->get('Regions', $config);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* tearDown method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void {
|
||||||
{
|
unset($this->Regions);
|
||||||
unset($this->Regions);
|
|
||||||
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TestInitialize method
|
* TestInitialize method
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
* @uses \CakeAddresses\Model\Table\RegionsTable::initialize()
|
* @uses \CakeAddresses\Model\Table\RegionsTable::initialize()
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testInitialize(): void
|
public function testInitialize(): void {
|
||||||
{
|
// verify all associations loaded
|
||||||
// verify all associations loaded
|
$expectedAssociations = [
|
||||||
$expectedAssociations = [
|
'Countries',
|
||||||
'Countries',
|
'Subregions',
|
||||||
'Subregions',
|
|
||||||
// 'States',
|
// 'States',
|
||||||
];
|
];
|
||||||
$associations = $this->Regions->associations();
|
$associations = $this->Regions->associations();
|
||||||
|
|
||||||
$this->assertCount(count($expectedAssociations), $associations);
|
$this->assertCount(count($expectedAssociations), $associations);
|
||||||
foreach ($expectedAssociations as $expectedAssociation) {
|
foreach ($expectedAssociations as $expectedAssociation) {
|
||||||
$this->assertTrue($this->Regions->hasAssociation($expectedAssociation));
|
$this->assertTrue($this->Regions->hasAssociation($expectedAssociation));
|
||||||
}
|
}
|
||||||
|
|
||||||
// verify all behaviors loaded
|
// verify all behaviors loaded
|
||||||
$expectedBehaviors = [];
|
$expectedBehaviors = [];
|
||||||
$behaviors = $this->Regions->behaviors();
|
$behaviors = $this->Regions->behaviors();
|
||||||
|
|
||||||
$this->assertCount(count($expectedBehaviors), $behaviors);
|
$this->assertCount(count($expectedBehaviors), $behaviors);
|
||||||
foreach ($expectedBehaviors as $expectedBehavior) {
|
foreach ($expectedBehaviors as $expectedBehavior) {
|
||||||
$this->assertTrue($this->Regions->hasBehavior($expectedBehavior));
|
$this->assertTrue($this->Regions->hasBehavior($expectedBehavior));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test validationDefault method
|
* Test validationDefault method
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
* @uses \CakeAddresses\Model\Table\RegionsTable::validationDefault()
|
* @uses \CakeAddresses\Model\Table\RegionsTable::validationDefault()
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testValidationDefault(): void
|
public function testValidationDefault(): void {
|
||||||
{
|
$this->markTestIncomplete('Not implemented yet.');
|
||||||
$this->markTestIncomplete('Not implemented yet.');
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,70 +9,67 @@ use CakeAddresses\Model\Table\StatesTable;
|
|||||||
/**
|
/**
|
||||||
* CakeAddresses\Model\Table\StatesTable Test Case
|
* CakeAddresses\Model\Table\StatesTable Test Case
|
||||||
*/
|
*/
|
||||||
class StatesTableTest extends TestCase
|
class StatesTableTest extends TestCase {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Test subject
|
* Test subject
|
||||||
*
|
*
|
||||||
* @var \CakeAddresses\Model\Table\StatesTable
|
* @var \CakeAddresses\Model\Table\StatesTable
|
||||||
*/
|
*/
|
||||||
protected $States;
|
protected $States;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixtures
|
* Fixtures
|
||||||
*
|
*
|
||||||
* @var array<string>
|
* @var array<string>
|
||||||
*/
|
*/
|
||||||
protected array $fixtures = [
|
protected array $fixtures = [
|
||||||
'plugin.CakeAddresses.States',
|
'plugin.CakeAddresses.States',
|
||||||
'plugin.CakeAddresses.Countries',
|
'plugin.CakeAddresses.Countries',
|
||||||
'plugin.CakeAddresses.Addresses',
|
'plugin.CakeAddresses.Addresses',
|
||||||
'plugin.CakeAddresses.Cities',
|
'plugin.CakeAddresses.Cities',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void {
|
||||||
{
|
parent::setUp();
|
||||||
parent::setUp();
|
$config = $this->getTableLocator()->exists('States') ? [] : ['className' => StatesTable::class];
|
||||||
$config = $this->getTableLocator()->exists('States') ? [] : ['className' => StatesTable::class];
|
$this->States = $this->getTableLocator()->get('States', $config);
|
||||||
$this->States = $this->getTableLocator()->get('States', $config);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* tearDown method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void {
|
||||||
{
|
unset($this->States);
|
||||||
unset($this->States);
|
|
||||||
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test validationDefault method
|
* Test validationDefault method
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
* @uses \CakeAddresses\Model\Table\StatesTable::validationDefault()
|
* @uses \CakeAddresses\Model\Table\StatesTable::validationDefault()
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testValidationDefault(): void
|
public function testValidationDefault(): void {
|
||||||
{
|
$this->markTestIncomplete('Not implemented yet.');
|
||||||
$this->markTestIncomplete('Not implemented yet.');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test buildRules method
|
* Test buildRules method
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
* @uses \CakeAddresses\Model\Table\StatesTable::buildRules()
|
* @uses \CakeAddresses\Model\Table\StatesTable::buildRules()
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testBuildRules(): void
|
public function testBuildRules(): void {
|
||||||
{
|
$this->markTestIncomplete('Not implemented yet.');
|
||||||
$this->markTestIncomplete('Not implemented yet.');
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,69 +9,66 @@ use CakeAddresses\Model\Table\SubregionsTable;
|
|||||||
/**
|
/**
|
||||||
* CakeAddresses\Model\Table\SubregionsTable Test Case
|
* CakeAddresses\Model\Table\SubregionsTable Test Case
|
||||||
*/
|
*/
|
||||||
class SubregionsTableTest extends TestCase
|
class SubregionsTableTest extends TestCase {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Test subject
|
* Test subject
|
||||||
*
|
*
|
||||||
* @var \CakeAddresses\Model\Table\SubregionsTable
|
* @var \CakeAddresses\Model\Table\SubregionsTable
|
||||||
*/
|
*/
|
||||||
protected $Subregions;
|
protected $Subregions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixtures
|
* Fixtures
|
||||||
*
|
*
|
||||||
* @var array<string>
|
* @var array<string>
|
||||||
*/
|
*/
|
||||||
protected array $fixtures = [
|
protected array $fixtures = [
|
||||||
'plugin.CakeAddresses.Subregions',
|
'plugin.CakeAddresses.Subregions',
|
||||||
'plugin.CakeAddresses.Regions',
|
'plugin.CakeAddresses.Regions',
|
||||||
'plugin.CakeAddresses.Countries',
|
'plugin.CakeAddresses.Countries',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void {
|
||||||
{
|
parent::setUp();
|
||||||
parent::setUp();
|
$config = $this->getTableLocator()->exists('Subregions') ? [] : ['className' => SubregionsTable::class];
|
||||||
$config = $this->getTableLocator()->exists('Subregions') ? [] : ['className' => SubregionsTable::class];
|
$this->Subregions = $this->getTableLocator()->get('Subregions', $config);
|
||||||
$this->Subregions = $this->getTableLocator()->get('Subregions', $config);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* tearDown method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void {
|
||||||
{
|
unset($this->Subregions);
|
||||||
unset($this->Subregions);
|
|
||||||
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test validationDefault method
|
* Test validationDefault method
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
* @uses \CakeAddresses\Model\Table\SubregionsTable::validationDefault()
|
* @uses \CakeAddresses\Model\Table\SubregionsTable::validationDefault()
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testValidationDefault(): void
|
public function testValidationDefault(): void {
|
||||||
{
|
$this->markTestIncomplete('Not implemented yet.');
|
||||||
$this->markTestIncomplete('Not implemented yet.');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test buildRules method
|
* Test buildRules method
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
* @uses \CakeAddresses\Model\Table\SubregionsTable::buildRules()
|
* @uses \CakeAddresses\Model\Table\SubregionsTable::buildRules()
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testBuildRules(): void
|
public function testBuildRules(): void {
|
||||||
{
|
$this->markTestIncomplete('Not implemented yet.');
|
||||||
$this->markTestIncomplete('Not implemented yet.');
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,20 +7,19 @@ use Cake\Core\Configure;
|
|||||||
use Cake\Core\Plugin;
|
use Cake\Core\Plugin;
|
||||||
use Cake\Database\Connection;
|
use Cake\Database\Connection;
|
||||||
use Cake\Datasource\ConnectionManager;
|
use Cake\Datasource\ConnectionManager;
|
||||||
use Cake\TestSuite\Fixture\SchemaLoader;
|
|
||||||
use CakeAddresses\CakeAddressesPlugin;
|
use CakeAddresses\CakeAddressesPlugin;
|
||||||
use Migrations\TestSuite\Migrator;
|
use Migrations\TestSuite\Migrator;
|
||||||
use TestApp\Controller\AppController;
|
use TestApp\Controller\AppController;
|
||||||
|
|
||||||
if (!defined('DS')) {
|
if (!defined('DS')) {
|
||||||
define('DS', DIRECTORY_SEPARATOR);
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
}
|
}
|
||||||
if (!defined('WINDOWS')) {
|
if (!defined('WINDOWS')) {
|
||||||
if (DS === '\\' || substr(PHP_OS, 0, 3) === 'WIN') {
|
if (DS === '\\' || substr(PHP_OS, 0, 3) === 'WIN') {
|
||||||
define('WINDOWS', true);
|
define('WINDOWS', true);
|
||||||
} else {
|
} else {
|
||||||
define('WINDOWS', false);
|
define('WINDOWS', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define('PLUGIN_ROOT', dirname(__DIR__));
|
define('PLUGIN_ROOT', dirname(__DIR__));
|
||||||
@@ -45,39 +44,39 @@ require CORE_PATH . 'config/bootstrap.php';
|
|||||||
require CAKE . 'functions.php';
|
require CAKE . 'functions.php';
|
||||||
|
|
||||||
Configure::write('App', [
|
Configure::write('App', [
|
||||||
'namespace' => 'TestApp',
|
'namespace' => 'TestApp',
|
||||||
'encoding' => 'UTF-8',
|
'encoding' => 'UTF-8',
|
||||||
'paths' => [
|
'paths' => [
|
||||||
'testWebroot' => PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'webroot' . DS,
|
'testWebroot' => PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'webroot' . DS,
|
||||||
'webroot' => PLUGIN_ROOT . DS . 'webroot' . DS,
|
'webroot' => PLUGIN_ROOT . DS . 'webroot' . DS,
|
||||||
'templates' => [
|
'templates' => [
|
||||||
PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'templates' . DS,
|
PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'templates' . DS,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Configure::write('debug', true);
|
Configure::write('debug', true);
|
||||||
Configure::write('CakeAddresses', []);
|
Configure::write('CakeAddresses', []);
|
||||||
|
|
||||||
$cache = [
|
$cache = [
|
||||||
'default' => [
|
'default' => [
|
||||||
'engine' => 'File',
|
'engine' => 'File',
|
||||||
'path' => CACHE,
|
'path' => CACHE,
|
||||||
],
|
],
|
||||||
'_cake_translations_' => [
|
'_cake_translations_' => [
|
||||||
'className' => 'File',
|
'className' => 'File',
|
||||||
'prefix' => 'crud_myapp_cake_core_',
|
'prefix' => 'crud_myapp_cake_core_',
|
||||||
'path' => CACHE . 'persistent/',
|
'path' => CACHE . 'persistent/',
|
||||||
'serialize' => true,
|
'serialize' => true,
|
||||||
'duration' => '+10 seconds',
|
'duration' => '+10 seconds',
|
||||||
],
|
],
|
||||||
'_cake_model_' => [
|
'_cake_model_' => [
|
||||||
'className' => 'File',
|
'className' => 'File',
|
||||||
'prefix' => 'crud_my_app_cake_model_',
|
'prefix' => 'crud_my_app_cake_model_',
|
||||||
'path' => CACHE . 'models/',
|
'path' => CACHE . 'models/',
|
||||||
'serialize' => 'File',
|
'serialize' => 'File',
|
||||||
'duration' => '+10 seconds',
|
'duration' => '+10 seconds',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
Cache::setConfig($cache);
|
Cache::setConfig($cache);
|
||||||
@@ -89,15 +88,15 @@ Plugin::getCollection()->add(new CakeAddressesPlugin());
|
|||||||
Chronos::setTestNow(Chronos::now());
|
Chronos::setTestNow(Chronos::now());
|
||||||
|
|
||||||
if (!getenv('DB_URL')) {
|
if (!getenv('DB_URL')) {
|
||||||
putenv('DB_URL=sqlite:///:memory:');
|
putenv('DB_URL=sqlite:///:memory:');
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionManager::setConfig('test', [
|
ConnectionManager::setConfig('test', [
|
||||||
'className' => Connection::class,
|
'className' => Connection::class,
|
||||||
'url' => getenv('DB_URL') ?: null,
|
'url' => getenv('DB_URL') ?: null,
|
||||||
'timezone' => 'UTC',
|
'timezone' => 'UTC',
|
||||||
'quoteIdentifiers' => false,
|
'quoteIdentifiers' => false,
|
||||||
'cacheMetadata' => true,
|
'cacheMetadata' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Based entirely off of dereuromark's plugins as I was having trouble getting fixtures to load
|
* Based entirely off of dereuromark's plugins as I was having trouble getting fixtures to load
|
||||||
* after moving the plugins outside of an existing cakephp app's plugins folder
|
* after moving the plugins outside of an existing cakephp app's plugins folder
|
||||||
|
|||||||
Reference in New Issue
Block a user