mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 08:09:41 +00:00
mvc - replace \Phalcon\Filter\Validation\Exception with \OPNsense\Base\ValidationException (both simple empty Exception classes).
for https://github.com/opnsense/core/issues/6389
This commit is contained in:
parent
7d212f3e5d
commit
0dc6089f8a
1
plist
1
plist
@ -588,6 +588,7 @@
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/Base/Messages/Message.php
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/Base/ModelException.php
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/Base/Validation.php
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/Base/ValidationException.php
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/Base/Validators/CallbackValidator.php
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/Base/Validators/CsvListValidator.php
|
||||
/usr/local/opnsense/mvc/app/models/OPNsense/Base/Validators/Email.php
|
||||
|
||||
@ -226,7 +226,7 @@ abstract class ApiMutableModelControllerBase extends ApiControllerBase
|
||||
* @param string $node reference node, to use as relative offset
|
||||
* @param string $prefix prefix to use when $node is provided (defaults to static::$internalModelName)
|
||||
* @return array result / validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception on validation issues
|
||||
* @throws \OPNsense\Base\ValidationException on validation issues
|
||||
* @throws \ReflectionException when binding to the model class fails
|
||||
* @throws UserException when denied write access
|
||||
*/
|
||||
@ -296,7 +296,7 @@ abstract class ApiMutableModelControllerBase extends ApiControllerBase
|
||||
* @param bool $validateFullModel by default we only validate the fields we have changed
|
||||
* @param bool $disable_validation skip validation, be careful to use this!
|
||||
* @return array result / validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception on validation issues
|
||||
* @throws \OPNsense\Base\ValidationException on validation issues
|
||||
* @throws \ReflectionException when binding to the model class fails
|
||||
* @throws \OPNsense\Base\UserException when denied write access
|
||||
*/
|
||||
@ -340,7 +340,7 @@ abstract class ApiMutableModelControllerBase extends ApiControllerBase
|
||||
/**
|
||||
* Update model settings
|
||||
* @return array status / validation errors
|
||||
* @throws \Phalcon\Filter\Validation\Exception on validation issues
|
||||
* @throws \OPNsense\Base\ValidationException on validation issues
|
||||
* @throws \ReflectionException when binding to the model class fails
|
||||
* @throws UserException when denied write access
|
||||
*/
|
||||
@ -445,7 +445,7 @@ abstract class ApiMutableModelControllerBase extends ApiControllerBase
|
||||
* @param string $path relative model path
|
||||
* @param array|null $overlay properties to overlay when available (call setNodes)
|
||||
* @return array
|
||||
* @throws \Phalcon\Filter\Validation\Exception on validation issues
|
||||
* @throws \OPNsense\Base\ValidationException on validation issues
|
||||
* @throws \ReflectionException when binding to the model class fails
|
||||
* @throws UserException when denied write access
|
||||
*/
|
||||
@ -485,7 +485,7 @@ abstract class ApiMutableModelControllerBase extends ApiControllerBase
|
||||
* @param string $path relative model path
|
||||
* @param null|string $uuid node key
|
||||
* @return array
|
||||
* @throws \Phalcon\Filter\Validation\Exception on validation issues
|
||||
* @throws \OPNsense\Base\ValidationException on validation issues
|
||||
* @throws \ReflectionException when binding to the model class fails
|
||||
* @throws UserException when denied write access
|
||||
*/
|
||||
@ -520,7 +520,7 @@ abstract class ApiMutableModelControllerBase extends ApiControllerBase
|
||||
* @param string $uuid node key
|
||||
* @param array|null $overlay properties to overlay when available (call setNodes)
|
||||
* @return array
|
||||
* @throws \Phalcon\Filter\Validation\Exception on validation issues
|
||||
* @throws \OPNsense\Base\ValidationException on validation issues
|
||||
* @throws \ReflectionException when binding to the model class fails
|
||||
* @throws UserException when denied write access
|
||||
*/
|
||||
@ -569,7 +569,7 @@ abstract class ApiMutableModelControllerBase extends ApiControllerBase
|
||||
* @param string $uuid node key
|
||||
* @param string $enabled desired state enabled(1)/disabled(0), leave empty for toggle
|
||||
* @return array
|
||||
* @throws \Phalcon\Filter\Validation\Exception on validation issues
|
||||
* @throws \OPNsense\Base\ValidationException on validation issues
|
||||
* @throws \ReflectionException when binding to the model class fails
|
||||
* @throws UserException when denied write access
|
||||
*/
|
||||
|
||||
@ -103,7 +103,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* add new job and set with attributes from post
|
||||
* @return array save result + validation output
|
||||
* @throws \OPNsense\Base\ModelException when not bound to model
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function addJobAction()
|
||||
@ -116,7 +116,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* delete job by uuid ( only if origin is cron)
|
||||
* @param string $uuid item unique id
|
||||
* @return array status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
* @throws \OPNsense\Base\ModelException when not bound to model
|
||||
*/
|
||||
@ -136,7 +136,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* @param $uuid item unique id
|
||||
* @param $enabled desired state enabled(1)/disabled(1), leave empty for toggle
|
||||
* @return array status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function toggleJobAction($uuid, $enabled = null)
|
||||
|
||||
@ -74,7 +74,7 @@ class NetflowController extends ApiControllerBase
|
||||
/**
|
||||
* update netflow configuration fields
|
||||
* @return array
|
||||
* @throws \Phalcon\Filter\Validation\Exception
|
||||
* @throws \OPNsense\Base\ValidationException
|
||||
*/
|
||||
public function setconfigAction()
|
||||
{
|
||||
|
||||
@ -133,7 +133,7 @@ class AliasController extends ApiMutableModelControllerBase
|
||||
* Update alias with given properties
|
||||
* @param string $uuid internal id
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setItemAction($uuid)
|
||||
@ -159,7 +159,7 @@ class AliasController extends ApiMutableModelControllerBase
|
||||
* Add new alias and set with attributes from post
|
||||
* @return array save result + validation output
|
||||
* @throws \OPNsense\Base\ModelException when not bound to model
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function addItemAction()
|
||||
@ -210,7 +210,7 @@ class AliasController extends ApiMutableModelControllerBase
|
||||
* Delete alias by uuid, save contents to tmp for removal on apply
|
||||
* @param string $uuid internal id
|
||||
* @return array save status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
* @throws \OPNsense\Base\UserException when unable to delete
|
||||
*/
|
||||
@ -237,7 +237,7 @@ class AliasController extends ApiMutableModelControllerBase
|
||||
* @param string $uuid id to toggled
|
||||
* @param string|null $enabled set enabled by default
|
||||
* @return array status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function toggleItemAction($uuid, $enabled = null)
|
||||
|
||||
@ -64,7 +64,7 @@ class CategoryController extends ApiMutableModelControllerBase
|
||||
* Update category with given properties
|
||||
* @param string $uuid internal id
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setItemAction($uuid)
|
||||
@ -85,7 +85,7 @@ class CategoryController extends ApiMutableModelControllerBase
|
||||
* Add new category and set with attributes from post
|
||||
* @return array save result + validation output
|
||||
* @throws \OPNsense\Base\ModelException when not bound to model
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function addItemAction()
|
||||
@ -108,7 +108,7 @@ class CategoryController extends ApiMutableModelControllerBase
|
||||
* Delete alias by uuid, save contents to tmp for removal on apply
|
||||
* @param string $uuid internal id
|
||||
* @return array save status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
* @throws \OPNsense\Base\UserException when unable to delete
|
||||
*/
|
||||
|
||||
@ -57,7 +57,7 @@ class GroupController extends ApiMutableModelControllerBase
|
||||
* Update group with given properties
|
||||
* @param string $uuid internal id
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setItemAction($uuid)
|
||||
@ -84,7 +84,7 @@ class GroupController extends ApiMutableModelControllerBase
|
||||
* Add new group and set with attributes from post
|
||||
* @return array save result + validation output
|
||||
* @throws \OPNsense\Base\ModelException when not bound to model
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function addItemAction()
|
||||
@ -107,7 +107,7 @@ class GroupController extends ApiMutableModelControllerBase
|
||||
* Delete alias by uuid, save contents to tmp for removal on apply
|
||||
* @param string $uuid internal id
|
||||
* @return array save status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
* @throws \OPNsense\Base\UserException when unable to delete
|
||||
*/
|
||||
|
||||
@ -52,7 +52,7 @@ class ServiceController extends ApiMutableServiceControllerBase
|
||||
* @return array result status
|
||||
* @throws \Exception when configd action fails
|
||||
* @throws \OPNsense\Base\ModelException when unable to construct model
|
||||
* @throws \Phalcon\Filter\Validation\Exception when one or more model validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when one or more model validations fail
|
||||
*/
|
||||
public function reconfigureAction()
|
||||
{
|
||||
|
||||
@ -319,7 +319,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Update ruleset properties
|
||||
* @return array result status
|
||||
* @throws \Exception when config action fails
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setRulesetpropertiesAction()
|
||||
@ -408,7 +408,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* @param $filename rule filename (key)
|
||||
* @return array result status
|
||||
* @throws \Exception when configd action fails
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setRulesetAction($filename)
|
||||
@ -445,7 +445,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* @param $enabled desired state enabled(1)/disabled(1), leave empty for toggle
|
||||
* @return array status 0/1 or error
|
||||
* @throws \Exception
|
||||
* @throws \Phalcon\Filter\Validation\Exception
|
||||
* @throws \OPNsense\Base\ValidationException
|
||||
*/
|
||||
public function toggleRulesetAction($filenames, $enabled = null)
|
||||
{
|
||||
@ -488,7 +488,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* @param string|int $enabled desired state enabled(1)/disabled(1), leave empty for toggle
|
||||
* @return array empty
|
||||
* @throws \Exception when configd action fails
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function toggleRuleAction($sids, $enabled = null)
|
||||
@ -543,7 +543,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* @param $sid item unique id
|
||||
* @return array result status
|
||||
* @throws \Exception when configd action fails
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setRuleAction($sid)
|
||||
@ -584,7 +584,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Update user defined rules
|
||||
* @param string $uuid internal id
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setUserRuleAction($uuid)
|
||||
@ -595,7 +595,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
/**
|
||||
* Add new user defined rule
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function addUserRuleAction()
|
||||
@ -618,7 +618,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Delete user rule item
|
||||
* @param string $uuid user rule internal id
|
||||
* @return array save status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function delUserRuleAction($uuid)
|
||||
@ -631,7 +631,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* @param $uuid user defined rule internal id
|
||||
* @param $enabled desired state enabled(1)/disabled(1), leave empty for toggle
|
||||
* @return array save result
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function toggleUserRuleAction($uuid, $enabled = null)
|
||||
@ -653,7 +653,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Update policy
|
||||
* @param string $uuid internal id
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setPolicyAction($uuid)
|
||||
@ -664,7 +664,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
/**
|
||||
* Add new policy
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function addPolicyAction()
|
||||
@ -687,7 +687,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Delete policy item
|
||||
* @param string $uuid user rule internal id
|
||||
* @return array save status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function delPolicyAction($uuid)
|
||||
@ -700,7 +700,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* @param $uuid user defined rule internal id
|
||||
* @param $enabled desired state enabled(1)/disabled(1), leave empty for toggle
|
||||
* @return array save result
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function togglePolicyAction($uuid, $enabled = null)
|
||||
@ -726,7 +726,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Update policy rule adjustment
|
||||
* @param string $uuid internal id
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setPolicyRuleAction($uuid)
|
||||
@ -737,7 +737,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
/**
|
||||
* Add new policy rule adjustment
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function addPolicyRuleAction()
|
||||
@ -760,7 +760,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Delete policy rule adjustment item
|
||||
* @param string $uuid internal id
|
||||
* @return array save status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function delPolicyRuleAction($uuid)
|
||||
@ -773,7 +773,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* @param $uuid user internal id
|
||||
* @param $enabled desired state enabled(1)/disabled(1), leave empty for toggle
|
||||
* @return array save result
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function togglePolicyRuleAction($uuid, $enabled = null)
|
||||
|
||||
@ -69,7 +69,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Update alert with given properties
|
||||
* @param string $uuid internal id
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setAlertAction($uuid)
|
||||
@ -80,7 +80,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
/**
|
||||
* Add alert with given properties
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function addAlertAction()
|
||||
@ -92,7 +92,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Delete alert by uuid
|
||||
* @param string $uuid internal id
|
||||
* @return array save status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function delAlertAction($uuid)
|
||||
@ -119,7 +119,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* @param $uuid alert internal id
|
||||
* @param $enabled desired state enabled(1)/disabled(1), leave empty for toggle
|
||||
* @return array save result
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function toggleAlertAction($uuid, $enabled = null)
|
||||
@ -142,7 +142,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Update service with given properties
|
||||
* @param string $uuid internal id
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setServiceAction($uuid)
|
||||
@ -153,7 +153,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
/**
|
||||
* Add service with given properties
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function addServiceAction()
|
||||
@ -165,7 +165,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Delete service by uuid
|
||||
* @param string $uuid internal id
|
||||
* @return array save status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function delServiceAction($uuid)
|
||||
@ -188,7 +188,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* @param $uuid service internal id
|
||||
* @param $enabled desired state enabled(1)/disabled(1), leave empty for toggle
|
||||
* @return array save result
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function toggleServiceAction($uuid, $enabled = null)
|
||||
@ -211,7 +211,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Update test with given properties
|
||||
* @param string $uuid internal id
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setTestAction($uuid)
|
||||
@ -222,7 +222,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
/**
|
||||
* Add test with given properties
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function addTestAction()
|
||||
@ -234,7 +234,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Delete test by uuid
|
||||
* @param string $uuid internal id
|
||||
* @return array save status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function delTestAction($uuid)
|
||||
|
||||
@ -60,7 +60,7 @@ class RoutesController extends ApiMutableModelControllerBase
|
||||
* Update route with given properties
|
||||
* @param string $uuid internal id
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setrouteAction($uuid)
|
||||
@ -80,7 +80,7 @@ class RoutesController extends ApiMutableModelControllerBase
|
||||
* Add new route and set with attributes from post
|
||||
* @return array save result + validation output
|
||||
* @throws \OPNsense\Base\ModelException when not bound to model
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function addrouteAction()
|
||||
@ -103,7 +103,7 @@ class RoutesController extends ApiMutableModelControllerBase
|
||||
* Delete route by uuid, save contents to tmp for removal on apply
|
||||
* @param string $uuid internal id
|
||||
* @return array save status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
* @throws \OPNsense\Base\ModelException when not bound to model
|
||||
*/
|
||||
@ -123,7 +123,7 @@ class RoutesController extends ApiMutableModelControllerBase
|
||||
* @param string $uuid id to toggled
|
||||
* @param string|null $disabled set disabled by default
|
||||
* @return array status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
* @throws \OPNsense\Base\ModelException when not bound to model
|
||||
*/
|
||||
|
||||
@ -72,7 +72,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Update destination with given properties
|
||||
* @param string $uuid internal id
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setDestinationAction($uuid)
|
||||
@ -84,7 +84,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Add new destination and set with attributes from post
|
||||
* @return array save result + validation output
|
||||
* @throws \OPNsense\Base\ModelException when not bound to model
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
*/
|
||||
public function addDestinationAction()
|
||||
{
|
||||
@ -94,7 +94,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Delete destination by uuid
|
||||
* @param string $uuid internal id
|
||||
* @return array save status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function delDestinationAction($uuid)
|
||||
@ -107,7 +107,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* @param $uuid user defined rule internal id
|
||||
* @param $enabled desired state enabled(1)/disabled(1), leave empty for toggle
|
||||
* @return array save result
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function toggleDestinationAction($uuid, $enabled = null)
|
||||
|
||||
@ -59,7 +59,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Update pipe with given properties
|
||||
* @param string $uuid internal id
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setPipeAction($uuid)
|
||||
@ -71,7 +71,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Add new pipe and set with attributes from post
|
||||
* @return array save result + validation output
|
||||
* @throws \OPNsense\Base\ModelException when not bound to model
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
*/
|
||||
public function addPipeAction()
|
||||
{
|
||||
@ -85,7 +85,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Delete pipe by uuid
|
||||
* @param string $uuid internal id
|
||||
* @return array save status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function delPipeAction($uuid)
|
||||
@ -99,7 +99,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* @param $uuid user defined rule internal id
|
||||
* @param $enabled desired state enabled(1)/disabled(1), leave empty for toggle
|
||||
* @return array save result
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function togglePipeAction($uuid, $enabled = null)
|
||||
@ -151,7 +151,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Update queue with given properties
|
||||
* @param string $uuid internal id
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setQueueAction($uuid)
|
||||
@ -175,7 +175,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Delete queue by uuid
|
||||
* @param string $uuid internal id
|
||||
* @return array save status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function delQueueAction($uuid)
|
||||
@ -188,7 +188,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* @param $uuid user defined rule internal id
|
||||
* @param $enabled desired state enabled(1)/disabled(1), leave empty for toggle
|
||||
* @return array save result
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function toggleQueueAction($uuid, $enabled = null)
|
||||
@ -232,7 +232,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Update rule with given properties
|
||||
* @param string $uuid internal id
|
||||
* @return array save result + validation output
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function setRuleAction($uuid)
|
||||
@ -244,7 +244,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Add new rule and set with attributes from post
|
||||
* @return array save result + validation output
|
||||
* @throws \OPNsense\Base\ModelException when not bound to model
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
*/
|
||||
public function addRuleAction()
|
||||
{
|
||||
@ -254,7 +254,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* Delete rule by uuid
|
||||
* @param string $uuid internal id
|
||||
* @return array save status
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function delRuleAction($uuid)
|
||||
@ -267,7 +267,7 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
* @param $uuid user defined rule internal id
|
||||
* @param $enabled desired state enabled(1)/disabled(1), leave empty for toggle
|
||||
* @return array save result
|
||||
* @throws \Phalcon\Filter\Validation\Exception when field validations fail
|
||||
* @throws \OPNsense\Base\ValidationException when field validations fail
|
||||
* @throws \ReflectionException when not bound to model
|
||||
*/
|
||||
public function toggleRuleAction($uuid, $enabled = null)
|
||||
|
||||
@ -645,7 +645,7 @@ abstract class BaseModel
|
||||
$logger->error($exception_msg_part);
|
||||
}
|
||||
if (!$disable_validation) {
|
||||
throw new \Phalcon\Filter\Validation\Exception($exception_msg);
|
||||
throw new ValidationException($exception_msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2024 Deciso B.V.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OPNsense\Base;
|
||||
|
||||
class ValidationException extends \Exception
|
||||
{
|
||||
}
|
||||
@ -170,7 +170,7 @@ class BaseModelTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testValidationNOK()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("not a valid number");
|
||||
// replace all numbers
|
||||
foreach (BaseModelTest::$model->arraytypes->item->iterateItems() as $nodeid => $node) {
|
||||
@ -244,7 +244,7 @@ class BaseModelTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testConstraintsNok()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("number should be unique");
|
||||
$count = 2;
|
||||
foreach (BaseModelTest::$model->arraytypes->item->iterateItems() as $nodeid => $node) {
|
||||
|
||||
@ -70,7 +70,7 @@ class AuthGroupFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testSelectSetWithUnknownValue()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("CsvListValidator");
|
||||
// init field
|
||||
$field = new AuthGroupField();
|
||||
@ -99,7 +99,7 @@ class AuthGroupFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testSelectSetOnSingleValue()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("InclusionIn");
|
||||
// init field
|
||||
$field = new AuthGroupField();
|
||||
|
||||
@ -83,7 +83,7 @@ class AuthenticationServerFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testSelectSetWithUnknownValue()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("CsvListValidator");
|
||||
// init field
|
||||
$field = new AuthenticationServerField();
|
||||
@ -112,7 +112,7 @@ class AuthenticationServerFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testSelectSetOnSingleValue()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("InclusionIn");
|
||||
// init field
|
||||
$field = new AuthenticationServerField();
|
||||
|
||||
@ -45,7 +45,7 @@ class Base64FieldTest extends Field_Framework_TestCase
|
||||
|
||||
public function testRequiredEmpty()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("PresenceOf");
|
||||
$field = new Base64Field();
|
||||
$field->setRequired("Y");
|
||||
|
||||
@ -50,7 +50,7 @@ class BooleanFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testShouldNotBeANumber()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("Regex");
|
||||
$field = new BooleanField();
|
||||
$field->setValue("90");
|
||||
@ -61,7 +61,7 @@ class BooleanFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testShouldNotBeAString()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("Regex");
|
||||
$field = new BooleanField();
|
||||
$field->setValue("xx");
|
||||
@ -73,7 +73,7 @@ class BooleanFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testRequiredEmpty()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("PresenceOf");
|
||||
$field = new BooleanField();
|
||||
$field->setRequired("Y");
|
||||
|
||||
@ -83,7 +83,7 @@ class CertificateFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testSelectSetWithUnknownValue()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("CsvListValidator");
|
||||
// init field
|
||||
$field = new CertificateField();
|
||||
@ -112,7 +112,7 @@ class CertificateFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testSelectSetOnSingleValue()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("InclusionIn");
|
||||
// init field
|
||||
$field = new CertificateField();
|
||||
|
||||
@ -50,7 +50,7 @@ class CountryFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testRequiredEmpty()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("PresenceOf");
|
||||
$field = new CountryField();
|
||||
$field->eventPostLoading();
|
||||
@ -101,7 +101,7 @@ class CountryFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testSelectSetWithUnknownValue()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("CsvListValidator");
|
||||
// init field
|
||||
$field = new CountryField();
|
||||
@ -144,7 +144,7 @@ class CountryFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testSelectSetOnSingleValue()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("InclusionIn");
|
||||
// init field
|
||||
$field = new CountryField();
|
||||
|
||||
@ -37,7 +37,7 @@ class Field_Framework_TestCase extends \PHPUnit\Framework\TestCase
|
||||
/**
|
||||
* Validate and throw exception
|
||||
* @param string $field field type
|
||||
* @throws \Phalcon\Filter\Validation\Exception
|
||||
* @throws \OPNsense\Base\ValidationException
|
||||
*/
|
||||
public function validateThrow($field)
|
||||
{
|
||||
@ -49,7 +49,7 @@ class Field_Framework_TestCase extends \PHPUnit\Framework\TestCase
|
||||
$messages = $validation->validate(array("testfield" => (string)$field));
|
||||
if (count($messages)) {
|
||||
foreach ($messages as $message) {
|
||||
throw new \Phalcon\Filter\Validation\Exception($message->getType());
|
||||
throw new \OPNsense\Base\ValidationException($message->getType());
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
@ -45,7 +45,7 @@ class HostnameFieldTest extends Field_Framework_TestCase
|
||||
|
||||
public function testRequiredEmpty()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("PresenceOf");
|
||||
$field = new HostnameField();
|
||||
$field->setRequired("Y");
|
||||
|
||||
@ -45,7 +45,7 @@ class IPPortFieldTest extends Field_Framework_TestCase
|
||||
|
||||
public function testRequiredEmpty()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("PresenceOf");
|
||||
$field = new IPPortField();
|
||||
$field->setRequired("Y");
|
||||
@ -100,7 +100,7 @@ class IPPortFieldTest extends Field_Framework_TestCase
|
||||
|
||||
public function testInvalidValueIpv4()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$field = new IPPortField();
|
||||
$field->setValue("abcdefg");
|
||||
$this->validateThrow($field);
|
||||
@ -108,7 +108,7 @@ class IPPortFieldTest extends Field_Framework_TestCase
|
||||
|
||||
public function testInvalidValueAsListIpv4()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$field = new IPPortField();
|
||||
$field->setAsList("Y");
|
||||
$field->setValue("127.0.0.1:2056,abcdefg");
|
||||
@ -117,7 +117,7 @@ class IPPortFieldTest extends Field_Framework_TestCase
|
||||
|
||||
public function testInvalidValueIpv6()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$field = new IPPortField();
|
||||
$field->setValue("[::1]");
|
||||
$this->validateThrow($field);
|
||||
@ -125,7 +125,7 @@ class IPPortFieldTest extends Field_Framework_TestCase
|
||||
|
||||
public function testInvalidValueAsListIpv6()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$field = new IPPortField();
|
||||
$field->setAsList("Y");
|
||||
$field->setValue("[::1]:2056,[fe80::]");
|
||||
@ -134,7 +134,7 @@ class IPPortFieldTest extends Field_Framework_TestCase
|
||||
|
||||
public function testAddressFamilyIpv4()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$field = new IPPortField();
|
||||
$field->setAddressFamily("ipv4");
|
||||
$field->setValue("[::1]:2056");
|
||||
@ -143,7 +143,7 @@ class IPPortFieldTest extends Field_Framework_TestCase
|
||||
|
||||
public function testAddressFamilyIpv6()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$field = new IPPortField();
|
||||
$field->setAddressFamily("ipv6");
|
||||
$field->setValue("192.168.1.1:1111");
|
||||
|
||||
@ -50,7 +50,7 @@ class IntegerFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testValueLargerThenMax()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("MinMaxValidator");
|
||||
$field = new IntegerField();
|
||||
$field->setMaximumValue(100);
|
||||
@ -64,7 +64,7 @@ class IntegerFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testValueSmallerThenMin()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("MinMaxValidator");
|
||||
$field = new IntegerField();
|
||||
$field->setMaximumValue(100);
|
||||
@ -104,7 +104,7 @@ class IntegerFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testRequiredEmpty()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("PresenceOf");
|
||||
$field = new IntegerField();
|
||||
$field->setRequired("Y");
|
||||
|
||||
@ -70,7 +70,7 @@ class InterfaceFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testSelectHasNoParents()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("InclusionIn");
|
||||
// init field
|
||||
$field = new InterfaceField();
|
||||
@ -111,7 +111,7 @@ class InterfaceFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testSelectSetWithUnknownValue()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("CsvListValidator");
|
||||
// init field
|
||||
$field = new InterfaceField();
|
||||
@ -140,7 +140,7 @@ class InterfaceFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testSelectSetOnSingleValue()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("InclusionIn");
|
||||
// init field
|
||||
$field = new InterfaceField();
|
||||
|
||||
@ -50,7 +50,7 @@ class OptionFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testRequiredEmpty()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("PresenceOf");
|
||||
$field = new OptionField();
|
||||
$field->setRequired("Y");
|
||||
|
||||
@ -50,7 +50,7 @@ class PortFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testRequiredEmpty()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("PresenceOf");
|
||||
$field = new PortField();
|
||||
$field->setRequired("Y");
|
||||
|
||||
@ -50,7 +50,7 @@ class ProtocolFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testRequiredEmpty()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("PresenceOf");
|
||||
$field = new ProtocolField();
|
||||
$field->eventPostLoading();
|
||||
|
||||
@ -128,7 +128,7 @@ class TextFieldTest extends Field_Framework_TestCase
|
||||
*/
|
||||
public function testRequiredEmpty()
|
||||
{
|
||||
$this->expectException(\Phalcon\Filter\Validation\Exception::class);
|
||||
$this->expectException(\OPNsense\Base\ValidationException::class);
|
||||
$this->expectExceptionMessage("PresenceOf");
|
||||
$field = new TextField();
|
||||
$field->setRequired("Y");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user