@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | use Cake\Filesystem\Folder; |
| 7 | 7 | |
| 8 | 8 | if (!defined('DS')) { |
| 9 | - define('DS', DIRECTORY_SEPARATOR); |
|
| 9 | + define('DS', DIRECTORY_SEPARATOR); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | require_once 'vendor' . DS . 'autoload.php'; |
@@ -47,50 +47,50 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | Configure::write('debug', true); |
| 49 | 49 | Configure::write('App', [ |
| 50 | - 'namespace' => 'VatNumberCheck\Test\TestApp', |
|
| 51 | - 'encoding' => 'UTF-8', |
|
| 52 | - 'base' => false, |
|
| 53 | - 'baseUrl' => false, |
|
| 54 | - 'dir' => APP_DIR, |
|
| 55 | - 'webroot' => 'webroot', |
|
| 56 | - 'wwwRoot' => WWW_ROOT, |
|
| 57 | - 'fullBaseUrl' => 'http://localhost', |
|
| 58 | - 'imageBaseUrl' => 'img/', |
|
| 59 | - 'jsBaseUrl' => 'js/', |
|
| 60 | - 'cssBaseUrl' => 'css/', |
|
| 61 | - 'paths' => [ |
|
| 62 | - 'plugins' => [TEST_APP . 'Plugin' . DS], |
|
| 63 | - 'templates' => [APP . 'Template' . DS], |
|
| 64 | - 'locales' => [APP . 'Locale' . DS], |
|
| 65 | - ] |
|
| 50 | + 'namespace' => 'VatNumberCheck\Test\TestApp', |
|
| 51 | + 'encoding' => 'UTF-8', |
|
| 52 | + 'base' => false, |
|
| 53 | + 'baseUrl' => false, |
|
| 54 | + 'dir' => APP_DIR, |
|
| 55 | + 'webroot' => 'webroot', |
|
| 56 | + 'wwwRoot' => WWW_ROOT, |
|
| 57 | + 'fullBaseUrl' => 'http://localhost', |
|
| 58 | + 'imageBaseUrl' => 'img/', |
|
| 59 | + 'jsBaseUrl' => 'js/', |
|
| 60 | + 'cssBaseUrl' => 'css/', |
|
| 61 | + 'paths' => [ |
|
| 62 | + 'plugins' => [TEST_APP . 'Plugin' . DS], |
|
| 63 | + 'templates' => [APP . 'Template' . DS], |
|
| 64 | + 'locales' => [APP . 'Locale' . DS], |
|
| 65 | + ] |
|
| 66 | 66 | ]); |
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | Configure::write('Session', [ |
| 70 | - 'defaults' => 'php' |
|
| 70 | + 'defaults' => 'php' |
|
| 71 | 71 | ]); |
| 72 | 72 | |
| 73 | 73 | Cache::setConfig([ |
| 74 | - 'default' => [ |
|
| 75 | - 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 76 | - 'prefix' => 'default_', |
|
| 77 | - 'serialize' => true |
|
| 78 | - ], |
|
| 79 | - '_cake_core_' => [ |
|
| 80 | - 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 81 | - 'prefix' => 'cake_core_', |
|
| 82 | - 'serialize' => true |
|
| 83 | - ], |
|
| 84 | - '_cake_model_' => [ |
|
| 85 | - 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 86 | - 'prefix' => 'cake_model_', |
|
| 87 | - 'serialize' => true |
|
| 88 | - ], |
|
| 89 | - '_cake_routes_' => [ |
|
| 90 | - 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 91 | - 'prefix' => 'cake_model_', |
|
| 92 | - 'serialize' => true |
|
| 93 | - ], |
|
| 74 | + 'default' => [ |
|
| 75 | + 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 76 | + 'prefix' => 'default_', |
|
| 77 | + 'serialize' => true |
|
| 78 | + ], |
|
| 79 | + '_cake_core_' => [ |
|
| 80 | + 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 81 | + 'prefix' => 'cake_core_', |
|
| 82 | + 'serialize' => true |
|
| 83 | + ], |
|
| 84 | + '_cake_model_' => [ |
|
| 85 | + 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 86 | + 'prefix' => 'cake_model_', |
|
| 87 | + 'serialize' => true |
|
| 88 | + ], |
|
| 89 | + '_cake_routes_' => [ |
|
| 90 | + 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 91 | + 'prefix' => 'cake_model_', |
|
| 92 | + 'serialize' => true |
|
| 93 | + ], |
|
| 94 | 94 | ]); |
| 95 | 95 | |
| 96 | 96 | // Plugin::getCollection()->add(new VatNumberCheck\Plugin()); |
| 97 | 97 | \ No newline at end of file |
@@ -29,53 +29,53 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | class Application extends BaseApplication |
| 31 | 31 | { |
| 32 | - /** |
|
| 33 | - * {@inheritDoc} |
|
| 34 | - */ |
|
| 35 | - public function bootstrap() |
|
| 36 | - { |
|
| 37 | - // Call parent to load bootstrap from files. |
|
| 38 | - parent::bootstrap(); |
|
| 32 | + /** |
|
| 33 | + * {@inheritDoc} |
|
| 34 | + */ |
|
| 35 | + public function bootstrap() |
|
| 36 | + { |
|
| 37 | + // Call parent to load bootstrap from files. |
|
| 38 | + parent::bootstrap(); |
|
| 39 | 39 | |
| 40 | - if (PHP_SAPI === 'cli') { |
|
| 41 | - try { |
|
| 42 | - $this->addPlugin('Bake'); |
|
| 43 | - } catch (MissingPluginException $e) { |
|
| 44 | - unset($e); |
|
| 45 | - } |
|
| 46 | - $this->addPlugin('Migrations'); |
|
| 47 | - } |
|
| 40 | + if (PHP_SAPI === 'cli') { |
|
| 41 | + try { |
|
| 42 | + $this->addPlugin('Bake'); |
|
| 43 | + } catch (MissingPluginException $e) { |
|
| 44 | + unset($e); |
|
| 45 | + } |
|
| 46 | + $this->addPlugin('Migrations'); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - if (Configure::read('debug')) { |
|
| 50 | - $this->addPlugin(\DebugKit\Plugin::class, ['bootstrap' => true]); |
|
| 51 | - } |
|
| 49 | + if (Configure::read('debug')) { |
|
| 50 | + $this->addPlugin(\DebugKit\Plugin::class, ['bootstrap' => true]); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | $this->addPlugin(\VatNumberCheck\Plugin::class, ['routes' => true, 'bootstrap' => false]); |
| 54 | - } |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Setup the middleware queue your application will use. |
|
| 58 | - * |
|
| 59 | - * @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to setup. |
|
| 60 | - * @return \Cake\Http\MiddlewareQueue The updated middleware queue. |
|
| 61 | - */ |
|
| 62 | - public function middleware($middlewareQueue) |
|
| 63 | - { |
|
| 64 | - // @phan-suppress-next-line PhanUndeclaredFunctionInCallable |
|
| 65 | - $middlewareQueue |
|
| 66 | - // Catch any exceptions in the lower layers, |
|
| 67 | - // and make an error page/response |
|
| 68 | - ->add(ErrorHandlerMiddleware::class) |
|
| 56 | + /** |
|
| 57 | + * Setup the middleware queue your application will use. |
|
| 58 | + * |
|
| 59 | + * @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to setup. |
|
| 60 | + * @return \Cake\Http\MiddlewareQueue The updated middleware queue. |
|
| 61 | + */ |
|
| 62 | + public function middleware($middlewareQueue) |
|
| 63 | + { |
|
| 64 | + // @phan-suppress-next-line PhanUndeclaredFunctionInCallable |
|
| 65 | + $middlewareQueue |
|
| 66 | + // Catch any exceptions in the lower layers, |
|
| 67 | + // and make an error page/response |
|
| 68 | + ->add(ErrorHandlerMiddleware::class) |
|
| 69 | 69 | |
| 70 | - // Handle plugin/theme assets like CakePHP normally does. |
|
| 71 | - ->add(AssetMiddleware::class) |
|
| 70 | + // Handle plugin/theme assets like CakePHP normally does. |
|
| 71 | + ->add(AssetMiddleware::class) |
|
| 72 | 72 | |
| 73 | - // Add routing middleware. |
|
| 74 | - // Routes collection cache enabled by default, to disable route caching |
|
| 75 | - // pass null as cacheConfig, example: `new RoutingMiddleware($this)` |
|
| 76 | - // you might want to disable this cache in case your routing is extremely simple |
|
| 77 | - ->add(new RoutingMiddleware($this, '_cake_routes_')); |
|
| 73 | + // Add routing middleware. |
|
| 74 | + // Routes collection cache enabled by default, to disable route caching |
|
| 75 | + // pass null as cacheConfig, example: `new RoutingMiddleware($this)` |
|
| 76 | + // you might want to disable this cache in case your routing is extremely simple |
|
| 77 | + ->add(new RoutingMiddleware($this, '_cake_routes_')); |
|
| 78 | 78 | |
| 79 | - return $middlewareQueue; |
|
| 80 | - } |
|
| 79 | + return $middlewareQueue; |
|
| 80 | + } |
|
| 81 | 81 | } |
@@ -21,19 +21,19 @@ |
||
| 21 | 21 | * You can remove this if you are confident that your PHP version is sufficient. |
| 22 | 22 | */ |
| 23 | 23 | if (version_compare(PHP_VERSION, '5.6.0') < 0) { |
| 24 | - trigger_error('Your PHP version must be equal or higher than 5.6.0 to use CakePHP.' . PHP_EOL, E_USER_ERROR); |
|
| 24 | + trigger_error('Your PHP version must be equal or higher than 5.6.0 to use CakePHP.' . PHP_EOL, E_USER_ERROR); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /* |
| 28 | 28 | * You can remove this if you are confident you have intl installed. |
| 29 | 29 | */ |
| 30 | 30 | if (!extension_loaded('intl')) { |
| 31 | - trigger_error('You must enable the intl extension to use CakePHP.' . PHP_EOL, E_USER_ERROR); |
|
| 31 | + trigger_error('You must enable the intl extension to use CakePHP.' . PHP_EOL, E_USER_ERROR); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /* |
| 35 | 35 | * You can remove this if you are confident you have mbstring installed. |
| 36 | 36 | */ |
| 37 | 37 | if (!extension_loaded('mbstring')) { |
| 38 | - trigger_error('You must enable the mbstring extension to use CakePHP.' . PHP_EOL, E_USER_ERROR); |
|
| 38 | + trigger_error('You must enable the mbstring extension to use CakePHP.' . PHP_EOL, E_USER_ERROR); |
|
| 39 | 39 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | * Use the DS to separate the directories in other defines |
| 17 | 17 | */ |
| 18 | 18 | if (!defined('DS')) { |
| 19 | - define('DS', DIRECTORY_SEPARATOR); |
|
| 19 | + define('DS', DIRECTORY_SEPARATOR); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -37,28 +37,28 @@ discard block |
||
| 37 | 37 | protected $inputClass = 'vat-number-check'; |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * Generates a vat number check form field. |
|
| 41 | - * |
|
| 42 | - * See `FormHelper::control`. |
|
| 43 | - * |
|
| 44 | - * @param string $fieldName This should be `Modelname.fieldname` |
|
| 45 | - * @param array $options Each type of input takes different options |
|
| 46 | - * @return string Html output for a form field |
|
| 47 | - */ |
|
| 48 | - public function input(string $fieldName, array $options = []): string |
|
| 49 | - { |
|
| 50 | - $this->helperCount += 1; |
|
| 51 | - if ($this->helperCount === 1) { |
|
| 52 | - $this->_addJs(); |
|
| 53 | - } |
|
| 54 | - $options = array_merge($options, ['type' => 'text']); |
|
| 55 | - $class = $this->inputClass; |
|
| 56 | - if (empty($options['class'])) { |
|
| 57 | - $options['class'] = $class; |
|
| 58 | - } else { |
|
| 59 | - $options['class'] = sprintf('%s %s', $options['class'], $class); |
|
| 60 | - } |
|
| 61 | - return $this->Form->control($fieldName, $options); |
|
| 40 | + * Generates a vat number check form field. |
|
| 41 | + * |
|
| 42 | + * See `FormHelper::control`. |
|
| 43 | + * |
|
| 44 | + * @param string $fieldName This should be `Modelname.fieldname` |
|
| 45 | + * @param array $options Each type of input takes different options |
|
| 46 | + * @return string Html output for a form field |
|
| 47 | + */ |
|
| 48 | + public function input(string $fieldName, array $options = []): string |
|
| 49 | + { |
|
| 50 | + $this->helperCount += 1; |
|
| 51 | + if ($this->helperCount === 1) { |
|
| 52 | + $this->_addJs(); |
|
| 53 | + } |
|
| 54 | + $options = array_merge($options, ['type' => 'text']); |
|
| 55 | + $class = $this->inputClass; |
|
| 56 | + if (empty($options['class'])) { |
|
| 57 | + $options['class'] = $class; |
|
| 58 | + } else { |
|
| 59 | + $options['class'] = sprintf('%s %s', $options['class'], $class); |
|
| 60 | + } |
|
| 61 | + return $this->Form->control($fieldName, $options); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -66,19 +66,19 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return void |
| 68 | 68 | */ |
| 69 | - protected function _addJs() |
|
| 70 | - { |
|
| 71 | - $checkUrl = $this->Url->build( |
|
| 72 | - // '/vat_number_check/vat_number_checks/check.json' |
|
| 73 | - ['plugin' => 'VatNumberCheck', 'controller' => 'VatNumberChecks', 'action' => 'check', 'ext' => 'json'] |
|
| 69 | + protected function _addJs() |
|
| 70 | + { |
|
| 71 | + $checkUrl = $this->Url->build( |
|
| 72 | + // '/vat_number_check/vat_number_checks/check.json' |
|
| 73 | + ['plugin' => 'VatNumberCheck', 'controller' => 'VatNumberChecks', 'action' => 'check', 'ext' => 'json'] |
|
| 74 | 74 | ); |
| 75 | - $checkImages = [ |
|
| 76 | - 'ok' => $this->Url->build('/vat_number_check/img/ok.png'), |
|
| 77 | - 'failure' => $this->Url->build('/vat_number_check/img/failure.png'), |
|
| 78 | - 'serviceUnavailable' => $this->Url->build('/vat_number_check/img/service-unavailable.png'), |
|
| 75 | + $checkImages = [ |
|
| 76 | + 'ok' => $this->Url->build('/vat_number_check/img/ok.png'), |
|
| 77 | + 'failure' => $this->Url->build('/vat_number_check/img/failure.png'), |
|
| 78 | + 'serviceUnavailable' => $this->Url->build('/vat_number_check/img/service-unavailable.png'), |
|
| 79 | 79 | ]; |
| 80 | 80 | $checkImages = []; |
| 81 | - $script = " |
|
| 81 | + $script = " |
|
| 82 | 82 | /* jshint jquery:true */ |
| 83 | 83 | jQuery.noConflict(); |
| 84 | 84 | (function($) { |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | }); |
| 93 | 93 | })(jQuery); |
| 94 | 94 | "; |
| 95 | - $this->Html->script([ |
|
| 96 | - 'VatNumberCheck.jquery.min', 'VatNumberCheck.klass.min', 'VatNumberCheck.vat_number_check' |
|
| 97 | - ], ['inline' => false, 'once' => true]); |
|
| 98 | - $this->Html->scriptBlock($script, ['inline' => false]); |
|
| 99 | - } |
|
| 95 | + $this->Html->script([ |
|
| 96 | + 'VatNumberCheck.jquery.min', 'VatNumberCheck.klass.min', 'VatNumberCheck.vat_number_check' |
|
| 97 | + ], ['inline' => false, 'once' => true]); |
|
| 98 | + $this->Html->scriptBlock($script, ['inline' => false]); |
|
| 99 | + } |
|
| 100 | 100 | } |
| 101 | 101 | \ No newline at end of file |
@@ -13,115 +13,115 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | class SoapOld { |
| 15 | 15 | |
| 16 | - use InstanceConfigTrait; |
|
| 16 | + use InstanceConfigTrait; |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Description. |
| 20 | 20 | * |
| 21 | 21 | * @var string |
| 22 | 22 | */ |
| 23 | - public $description = 'Soap Client Wrapper'; |
|
| 23 | + public $description = 'Soap Client Wrapper'; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * SoapClient instance. |
| 27 | 27 | * |
| 28 | 28 | * @var SoapClient|null |
| 29 | 29 | */ |
| 30 | - public $client = null; |
|
| 30 | + public $client = null; |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Connection status. |
| 34 | 34 | * |
| 35 | 35 | * @var bool |
| 36 | 36 | */ |
| 37 | - public $connected = false; |
|
| 37 | + public $connected = false; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Default configuration. |
| 41 | 41 | * |
| 42 | 42 | * @var array |
| 43 | 43 | */ |
| 44 | - protected $_defaultConfig = [ |
|
| 45 | - 'wsdl' => null, |
|
| 46 | - 'location' => '', |
|
| 47 | - 'uri' => '', |
|
| 48 | - 'login' => '', |
|
| 49 | - 'password' => '', |
|
| 50 | - 'authentication' => 'SOAP_AUTHENTICATION_BASIC' |
|
| 51 | - ]; |
|
| 44 | + protected $_defaultConfig = [ |
|
| 45 | + 'wsdl' => null, |
|
| 46 | + 'location' => '', |
|
| 47 | + 'uri' => '', |
|
| 48 | + 'login' => '', |
|
| 49 | + 'password' => '', |
|
| 50 | + 'authentication' => 'SOAP_AUTHENTICATION_BASIC' |
|
| 51 | + ]; |
|
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Constructor. |
| 55 | 55 | * |
| 56 | 56 | * @param array $config An array defining the configuration settings |
| 57 | 57 | */ |
| 58 | - public function __construct($config = []) { |
|
| 59 | - $this->setConfig($config); |
|
| 58 | + public function __construct($config = []) { |
|
| 59 | + $this->setConfig($config); |
|
| 60 | 60 | |
| 61 | 61 | $this->connected = $this->connect(); |
| 62 | - } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * Setup Configuration options. |
| 66 | 66 | * |
| 67 | 67 | * @return array|bool Configuration options or false on failure |
| 68 | 68 | */ |
| 69 | - protected function _parseConfig() { |
|
| 70 | - if (!class_exists('SoapClient')) { |
|
| 71 | - $this->showError('Class SoapClient not found, please enable Soap extensions'); |
|
| 72 | - return false; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - $options = ['trace' => Configure::read('debug') > 0]; |
|
| 76 | - if (!empty($this->getConfig('location'))) { |
|
| 77 | - $options['location'] = $this->getConfig('location'); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - if (!empty($this->getConfig('uri'))) { |
|
| 81 | - $options['uri'] = $this->getConfig('uri'); |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - if (!empty($this->getConfig('login'))) { |
|
| 85 | - $options['login'] = $this->getConfig('login'); |
|
| 86 | - $options['password'] = $this->getConfig('password'); |
|
| 87 | - $options['authentication'] = $this->getConfig('authentication'); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - return $options; |
|
| 91 | - } |
|
| 69 | + protected function _parseConfig() { |
|
| 70 | + if (!class_exists('SoapClient')) { |
|
| 71 | + $this->showError('Class SoapClient not found, please enable Soap extensions'); |
|
| 72 | + return false; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + $options = ['trace' => Configure::read('debug') > 0]; |
|
| 76 | + if (!empty($this->getConfig('location'))) { |
|
| 77 | + $options['location'] = $this->getConfig('location'); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + if (!empty($this->getConfig('uri'))) { |
|
| 81 | + $options['uri'] = $this->getConfig('uri'); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + if (!empty($this->getConfig('login'))) { |
|
| 85 | + $options['login'] = $this->getConfig('login'); |
|
| 86 | + $options['password'] = $this->getConfig('password'); |
|
| 87 | + $options['authentication'] = $this->getConfig('authentication'); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + return $options; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * Connects to the SOAP server using the WSDL in the configuration. |
| 95 | 95 | * |
| 96 | 96 | * @return bool True on success, false on failure |
| 97 | 97 | */ |
| 98 | - public function connect() { |
|
| 99 | - $options = $this->_parseConfig(); |
|
| 98 | + public function connect() { |
|
| 99 | + $options = $this->_parseConfig(); |
|
| 100 | 100 | |
| 101 | 101 | $wsdl = $this->getConfig('wsdl'); |
| 102 | - if (!empty($wsdl)) { |
|
| 103 | - try { |
|
| 104 | - $this->client = new SoapClient($wsdl, $options); |
|
| 105 | - return (bool)$this->client; |
|
| 106 | - } catch(SoapFault $fault) { |
|
| 107 | - $this->showError($fault->faultstring); |
|
| 108 | - } |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - return false; |
|
| 112 | - } |
|
| 102 | + if (!empty($wsdl)) { |
|
| 103 | + try { |
|
| 104 | + $this->client = new SoapClient($wsdl, $options); |
|
| 105 | + return (bool)$this->client; |
|
| 106 | + } catch(SoapFault $fault) { |
|
| 107 | + $this->showError($fault->faultstring); |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + return false; |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * Sets the SoapClient instance to null. |
| 116 | 116 | * |
| 117 | 117 | * @return true |
| 118 | 118 | */ |
| 119 | - public function close() { |
|
| 120 | - $this->client = null; |
|
| 121 | - $this->connected = false; |
|
| 119 | + public function close() { |
|
| 120 | + $this->client = null; |
|
| 121 | + $this->connected = false; |
|
| 122 | 122 | |
| 123 | - return true; |
|
| 124 | - } |
|
| 123 | + return true; |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * Returns the available SOAP methods. |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | * @param mixed $data Unused in this class. |
| 130 | 130 | * @return array List of SOAP methods |
| 131 | 131 | */ |
| 132 | - public function listSources($data = null) { |
|
| 133 | - return $this->client->__getFunctions(); |
|
| 134 | - } |
|
| 132 | + public function listSources($data = null) { |
|
| 133 | + return $this->client->__getFunctions(); |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * Query the SOAP server with the given method and parameters. |
@@ -140,40 +140,40 @@ discard block |
||
| 140 | 140 | * @param array $queryData A list with parameters to pass |
| 141 | 141 | * @return mixed Returns the result on success, false on failure |
| 142 | 142 | */ |
| 143 | - public function query($method, $queryData = []) { |
|
| 144 | - if (!$this->connected) { |
|
| 145 | - return false; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - if (!empty($queryData)) { |
|
| 149 | - $queryData = [$queryData]; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - try { |
|
| 153 | - return $this->client->__soapCall($method, $queryData); |
|
| 154 | - } catch (SoapFault $fault) { |
|
| 155 | - $this->showError($fault->faultstring); |
|
| 156 | - return false; |
|
| 157 | - } |
|
| 158 | - } |
|
| 143 | + public function query($method, $queryData = []) { |
|
| 144 | + if (!$this->connected) { |
|
| 145 | + return false; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + if (!empty($queryData)) { |
|
| 149 | + $queryData = [$queryData]; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + try { |
|
| 153 | + return $this->client->__soapCall($method, $queryData); |
|
| 154 | + } catch (SoapFault $fault) { |
|
| 155 | + $this->showError($fault->faultstring); |
|
| 156 | + return false; |
|
| 157 | + } |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | 161 | * Returns the last SOAP response. |
| 162 | 162 | * |
| 163 | 163 | * @return string The last SOAP response |
| 164 | 164 | */ |
| 165 | - public function getResponse() { |
|
| 166 | - return $this->client->__getLastResponse(); |
|
| 167 | - } |
|
| 165 | + public function getResponse() { |
|
| 166 | + return $this->client->__getLastResponse(); |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | 170 | * Returns the last SOAP request. |
| 171 | 171 | * |
| 172 | 172 | * @return string The last SOAP request |
| 173 | 173 | */ |
| 174 | - public function getRequest() { |
|
| 175 | - return $this->client->__getLastRequest(); |
|
| 176 | - } |
|
| 174 | + public function getRequest() { |
|
| 175 | + return $this->client->__getLastRequest(); |
|
| 176 | + } |
|
| 177 | 177 | |
| 178 | 178 | /** |
| 179 | 179 | * Writes an error message to log file. |
@@ -181,9 +181,9 @@ discard block |
||
| 181 | 181 | * @param string $error Error message |
| 182 | 182 | * @return void |
| 183 | 183 | */ |
| 184 | - public function showError($error) { |
|
| 185 | - $message = __d('vat_number_check', 'SOAP Error: %s', $error); |
|
| 186 | - Log::error($message); |
|
| 187 | - } |
|
| 184 | + public function showError($error) { |
|
| 185 | + $message = __d('vat_number_check', 'SOAP Error: %s', $error); |
|
| 186 | + Log::error($message); |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | 189 | } |
@@ -103,7 +103,7 @@ |
||
| 103 | 103 | try { |
| 104 | 104 | $this->client = new SoapClient($wsdl, $options); |
| 105 | 105 | return (bool)$this->client; |
| 106 | - } catch(SoapFault $fault) { |
|
| 106 | + } catch (SoapFault $fault) { |
|
| 107 | 107 | $this->showError($fault->faultstring); |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | const CHECK_VAT_SOAP_ACTION = 'checkVat'; |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Service to check vat numbers. |
|
| 31 | - * |
|
| 32 | - */ |
|
| 29 | + /** |
|
| 30 | + * Service to check vat numbers. |
|
| 31 | + * |
|
| 32 | + */ |
|
| 33 | 33 | const CHECK_VAT_SERVICE = 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'; |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -37,11 +37,11 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @param string $vatNumber A VAT number |
| 39 | 39 | * @return string A (normalized) VAT number |
| 40 | - */ |
|
| 40 | + */ |
|
| 41 | 41 | public function normalize(string $vatNumber) : string |
| 42 | 42 | { |
| 43 | - return preg_replace('/[^A-Z0-9]/', '', strtoupper($vatNumber)); |
|
| 44 | - } |
|
| 43 | + return preg_replace('/[^A-Z0-9]/', '', strtoupper($vatNumber)); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Checks a given VAT number. |
@@ -57,34 +57,34 @@ discard block |
||
| 57 | 57 | $data = compact('countryCode', 'vatNumber'); |
| 58 | 58 | |
| 59 | 59 | if (!$this->getSoapDataSource()->connect()) { |
| 60 | - throw new InternalErrorException('Unable to connect.'); |
|
| 61 | - } |
|
| 60 | + throw new InternalErrorException('Unable to connect.'); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | 63 | $result = $this->soapDataSource->query(static::CHECK_VAT_SOAP_ACTION, $data); |
| 64 | 64 | if (!$result) { |
| 65 | - throw new InternalErrorException('Unable to check data.'); |
|
| 66 | - } |
|
| 65 | + throw new InternalErrorException('Unable to check data.'); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - return $result->valid; |
|
| 68 | + return $result->valid; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Returns an initialized Soap data source. |
|
| 73 | - * |
|
| 74 | - * @return Soap the soap datasource |
|
| 75 | - */ |
|
| 76 | - protected function getSoapDataSource(): Soap |
|
| 77 | - { |
|
| 71 | + /** |
|
| 72 | + * Returns an initialized Soap data source. |
|
| 73 | + * |
|
| 74 | + * @return Soap the soap datasource |
|
| 75 | + */ |
|
| 76 | + protected function getSoapDataSource(): Soap |
|
| 77 | + { |
|
| 78 | 78 | $wsdl = static::CHECK_VAT_SERVICE; |
| 79 | 79 | |
| 80 | - if (!isset($this->soapDataSource)) { |
|
| 80 | + if (!isset($this->soapDataSource)) { |
|
| 81 | 81 | $this->soapDataSource = new Soap(); |
| 82 | 82 | $this->soapDataSource->setWsdl($wsdl); |
| 83 | 83 | $this->soapDataSource->setOptions([ |
| 84 | 84 | 'exceptions' => true |
| 85 | 85 | ]); |
| 86 | - } |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - return $this->soapDataSource; |
|
| 88 | + return $this->soapDataSource; |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | \ No newline at end of file |
@@ -9,158 +9,158 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class Soap |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * SoapClient instance. |
|
| 14 | - * |
|
| 15 | - * @var \SoapClient|null |
|
| 16 | - */ |
|
| 17 | - protected $client = null; |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * URI of the WSDL file or NULL if working in non-WSDL mode. |
|
| 21 | - * |
|
| 22 | - * @var null|string |
|
| 23 | - */ |
|
| 24 | - protected $wsdl = null; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * Options. |
|
| 28 | - * |
|
| 29 | - * @var array |
|
| 30 | - */ |
|
| 31 | - protected $options = []; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * Connection status. |
|
| 35 | - * |
|
| 36 | - * @var bool |
|
| 37 | - */ |
|
| 38 | - protected $connected = false; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * Setter for the `wsdl` property. |
|
| 42 | - * |
|
| 43 | - * @param string $wsdl URI of the WSDL file or NULL if working in non-WSDL mode. |
|
| 44 | - * @return bool |
|
| 45 | - */ |
|
| 46 | - public function setWsdl(string $wsdl): bool |
|
| 47 | - { |
|
| 48 | - $this->wsdl = $wsdl; |
|
| 49 | - |
|
| 50 | - return true; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * Setter for the `options` property. |
|
| 55 | - * |
|
| 56 | - * @param array $options Options |
|
| 57 | - * @return bool |
|
| 58 | - */ |
|
| 59 | - public function setOptions(array $options = []): bool |
|
| 60 | - { |
|
| 61 | - $this->options = $options; |
|
| 62 | - |
|
| 63 | - return true; |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * Get SoapClient instance. |
|
| 68 | - * |
|
| 69 | - * @return \SoapClient|null |
|
| 70 | - */ |
|
| 71 | - public function getClient() |
|
| 72 | - { |
|
| 73 | - return $this->client; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * Connects to the server using the WSDL in the configuration. |
|
| 78 | - * |
|
| 79 | - * @return bool True on success, false on failure |
|
| 80 | - */ |
|
| 81 | - public function connect(): bool |
|
| 82 | - { |
|
| 83 | - if (!empty($this->wsdl)) { |
|
| 84 | - try { |
|
| 85 | - $this->client = new \SoapClient($this->wsdl, $this->options); |
|
| 86 | - $this->connected = (bool)$this->client; |
|
| 87 | - |
|
| 88 | - return $this->connected; |
|
| 89 | - } catch (\SoapFault $e) { |
|
| 90 | - Log::error($e); |
|
| 91 | - } |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - return false; |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * Disconnects to the server. |
|
| 99 | - * |
|
| 100 | - * @return bool True |
|
| 101 | - */ |
|
| 102 | - public function close(): bool |
|
| 103 | - { |
|
| 104 | - $this->client = null; |
|
| 105 | - $this->connected = false; |
|
| 106 | - |
|
| 107 | - return true; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * Query the server with the given method and parameters. |
|
| 112 | - * |
|
| 113 | - * @param string $method Name of method to call |
|
| 114 | - * @param array $data A list with parameters to pass |
|
| 115 | - * @param array $headers A list of headers to set |
|
| 116 | - * @return mixed Returns the result on success, false on failure |
|
| 117 | - */ |
|
| 118 | - public function query(string $method, array $data = [], array $headers = []) |
|
| 119 | - { |
|
| 120 | - if (!$this->connected) { |
|
| 121 | - return false; |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - if (is_null($this->client)) { |
|
| 125 | - return false; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - try { |
|
| 12 | + /** |
|
| 13 | + * SoapClient instance. |
|
| 14 | + * |
|
| 15 | + * @var \SoapClient|null |
|
| 16 | + */ |
|
| 17 | + protected $client = null; |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * URI of the WSDL file or NULL if working in non-WSDL mode. |
|
| 21 | + * |
|
| 22 | + * @var null|string |
|
| 23 | + */ |
|
| 24 | + protected $wsdl = null; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * Options. |
|
| 28 | + * |
|
| 29 | + * @var array |
|
| 30 | + */ |
|
| 31 | + protected $options = []; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * Connection status. |
|
| 35 | + * |
|
| 36 | + * @var bool |
|
| 37 | + */ |
|
| 38 | + protected $connected = false; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * Setter for the `wsdl` property. |
|
| 42 | + * |
|
| 43 | + * @param string $wsdl URI of the WSDL file or NULL if working in non-WSDL mode. |
|
| 44 | + * @return bool |
|
| 45 | + */ |
|
| 46 | + public function setWsdl(string $wsdl): bool |
|
| 47 | + { |
|
| 48 | + $this->wsdl = $wsdl; |
|
| 49 | + |
|
| 50 | + return true; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * Setter for the `options` property. |
|
| 55 | + * |
|
| 56 | + * @param array $options Options |
|
| 57 | + * @return bool |
|
| 58 | + */ |
|
| 59 | + public function setOptions(array $options = []): bool |
|
| 60 | + { |
|
| 61 | + $this->options = $options; |
|
| 62 | + |
|
| 63 | + return true; |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * Get SoapClient instance. |
|
| 68 | + * |
|
| 69 | + * @return \SoapClient|null |
|
| 70 | + */ |
|
| 71 | + public function getClient() |
|
| 72 | + { |
|
| 73 | + return $this->client; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * Connects to the server using the WSDL in the configuration. |
|
| 78 | + * |
|
| 79 | + * @return bool True on success, false on failure |
|
| 80 | + */ |
|
| 81 | + public function connect(): bool |
|
| 82 | + { |
|
| 83 | + if (!empty($this->wsdl)) { |
|
| 84 | + try { |
|
| 85 | + $this->client = new \SoapClient($this->wsdl, $this->options); |
|
| 86 | + $this->connected = (bool)$this->client; |
|
| 87 | + |
|
| 88 | + return $this->connected; |
|
| 89 | + } catch (\SoapFault $e) { |
|
| 90 | + Log::error($e); |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + return false; |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * Disconnects to the server. |
|
| 99 | + * |
|
| 100 | + * @return bool True |
|
| 101 | + */ |
|
| 102 | + public function close(): bool |
|
| 103 | + { |
|
| 104 | + $this->client = null; |
|
| 105 | + $this->connected = false; |
|
| 106 | + |
|
| 107 | + return true; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * Query the server with the given method and parameters. |
|
| 112 | + * |
|
| 113 | + * @param string $method Name of method to call |
|
| 114 | + * @param array $data A list with parameters to pass |
|
| 115 | + * @param array $headers A list of headers to set |
|
| 116 | + * @return mixed Returns the result on success, false on failure |
|
| 117 | + */ |
|
| 118 | + public function query(string $method, array $data = [], array $headers = []) |
|
| 119 | + { |
|
| 120 | + if (!$this->connected) { |
|
| 121 | + return false; |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + if (is_null($this->client)) { |
|
| 125 | + return false; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + try { |
|
| 129 | 129 | if (!empty($data)) { |
| 130 | - $data = [$data]; |
|
| 130 | + $data = [$data]; |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + foreach ($headers as $header) { |
|
| 134 | + $this->client |
|
| 135 | + ->__setSoapHeaders(new \SoapHeader($header['namespace'], $header['name'], $header['data'])); |
|
| 131 | 136 | } |
| 132 | 137 | |
| 133 | - foreach ($headers as $header) { |
|
| 134 | - $this->client |
|
| 135 | - ->__setSoapHeaders(new \SoapHeader($header['namespace'], $header['name'], $header['data'])); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - return $this->client->__soapCall($method, $data); |
|
| 139 | - } catch (\SoapFault $e) { |
|
| 140 | - Log::error($e); |
|
| 141 | - |
|
| 142 | - return false; |
|
| 143 | - } |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * Call methods from the SoapClient class. |
|
| 148 | - * |
|
| 149 | - * @param string $method A method name |
|
| 150 | - * @param array $params Method arguments |
|
| 151 | - * @return mixed Returns the result on success, false on failure |
|
| 152 | - */ |
|
| 153 | - public function __call(string $method, array $params = []) |
|
| 154 | - { |
|
| 155 | - if (is_null($this->client)) { |
|
| 156 | - return false; |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - $callable = [$this->client, sprintf('__%s', $method)]; |
|
| 160 | - if (!is_callable($callable)) { |
|
| 161 | - return false; |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - return call_user_func_array($callable, $params); |
|
| 165 | - } |
|
| 138 | + return $this->client->__soapCall($method, $data); |
|
| 139 | + } catch (\SoapFault $e) { |
|
| 140 | + Log::error($e); |
|
| 141 | + |
|
| 142 | + return false; |
|
| 143 | + } |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * Call methods from the SoapClient class. |
|
| 148 | + * |
|
| 149 | + * @param string $method A method name |
|
| 150 | + * @param array $params Method arguments |
|
| 151 | + * @return mixed Returns the result on success, false on failure |
|
| 152 | + */ |
|
| 153 | + public function __call(string $method, array $params = []) |
|
| 154 | + { |
|
| 155 | + if (is_null($this->client)) { |
|
| 156 | + return false; |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + $callable = [$this->client, sprintf('__%s', $method)]; |
|
| 160 | + if (!is_callable($callable)) { |
|
| 161 | + return false; |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + return call_user_func_array($callable, $params); |
|
| 165 | + } |
|
| 166 | 166 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | use Cake\Filesystem\Folder; |
| 7 | 7 | |
| 8 | 8 | if (!defined('DS')) { |
| 9 | - define('DS', DIRECTORY_SEPARATOR); |
|
| 9 | + define('DS', DIRECTORY_SEPARATOR); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | require_once 'vendor' . DS . 'autoload.php'; |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | // Custom |
| 40 | 40 | $controllers = [ |
| 41 | - 'VatNumberChecks' |
|
| 41 | + 'VatNumberChecks' |
|
| 42 | 42 | ]; |
| 43 | 43 | foreach ($controllers as $controller) { |
| 44 | - $TMP->create(CACHE . 'plugins' . DS . 'VatNumberCheck' . DS . $controller); |
|
| 44 | + $TMP->create(CACHE . 'plugins' . DS . 'VatNumberCheck' . DS . $controller); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | require_once CORE_PATH . 'config' . DS . 'bootstrap.php'; |
@@ -51,58 +51,58 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | Configure::write('debug', true); |
| 53 | 53 | Configure::write('App', [ |
| 54 | - 'namespace' => 'VatNumberCheck\Test\TestApp', |
|
| 55 | - 'encoding' => 'UTF-8', |
|
| 56 | - 'base' => false, |
|
| 57 | - 'baseUrl' => false, |
|
| 58 | - 'dir' => APP_DIR, |
|
| 59 | - 'webroot' => 'webroot', |
|
| 60 | - 'wwwRoot' => WWW_ROOT, |
|
| 61 | - 'fullBaseUrl' => 'http://localhost', |
|
| 62 | - 'imageBaseUrl' => 'img/', |
|
| 63 | - 'jsBaseUrl' => 'js/', |
|
| 64 | - 'cssBaseUrl' => 'css/', |
|
| 65 | - 'paths' => [ |
|
| 66 | - 'plugins' => [TEST_APP . 'Plugin' . DS], |
|
| 67 | - 'templates' => [APP . 'Template' . DS], |
|
| 68 | - 'locales' => [APP . 'Locale' . DS], |
|
| 69 | - ] |
|
| 54 | + 'namespace' => 'VatNumberCheck\Test\TestApp', |
|
| 55 | + 'encoding' => 'UTF-8', |
|
| 56 | + 'base' => false, |
|
| 57 | + 'baseUrl' => false, |
|
| 58 | + 'dir' => APP_DIR, |
|
| 59 | + 'webroot' => 'webroot', |
|
| 60 | + 'wwwRoot' => WWW_ROOT, |
|
| 61 | + 'fullBaseUrl' => 'http://localhost', |
|
| 62 | + 'imageBaseUrl' => 'img/', |
|
| 63 | + 'jsBaseUrl' => 'js/', |
|
| 64 | + 'cssBaseUrl' => 'css/', |
|
| 65 | + 'paths' => [ |
|
| 66 | + 'plugins' => [TEST_APP . 'Plugin' . DS], |
|
| 67 | + 'templates' => [APP . 'Template' . DS], |
|
| 68 | + 'locales' => [APP . 'Locale' . DS], |
|
| 69 | + ] |
|
| 70 | 70 | ]); |
| 71 | 71 | |
| 72 | 72 | Configure::write('Session', [ |
| 73 | - 'defaults' => 'php' |
|
| 73 | + 'defaults' => 'php' |
|
| 74 | 74 | ]); |
| 75 | 75 | |
| 76 | 76 | Cache::setConfig([ |
| 77 | - 'default' => [ |
|
| 78 | - 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 79 | - 'prefix' => 'default_', |
|
| 80 | - 'serialize' => true |
|
| 81 | - ], |
|
| 82 | - '_cake_core_' => [ |
|
| 83 | - 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 84 | - 'prefix' => 'cake_core_', |
|
| 85 | - 'serialize' => true |
|
| 86 | - ], |
|
| 87 | - '_cake_model_' => [ |
|
| 88 | - 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 89 | - 'prefix' => 'cake_model_', |
|
| 90 | - 'serialize' => true |
|
| 91 | - ], |
|
| 92 | - '_cake_routes_' => [ |
|
| 93 | - 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 94 | - 'prefix' => 'cake_model_', |
|
| 95 | - 'serialize' => true |
|
| 96 | - ], |
|
| 77 | + 'default' => [ |
|
| 78 | + 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 79 | + 'prefix' => 'default_', |
|
| 80 | + 'serialize' => true |
|
| 81 | + ], |
|
| 82 | + '_cake_core_' => [ |
|
| 83 | + 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 84 | + 'prefix' => 'cake_core_', |
|
| 85 | + 'serialize' => true |
|
| 86 | + ], |
|
| 87 | + '_cake_model_' => [ |
|
| 88 | + 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 89 | + 'prefix' => 'cake_model_', |
|
| 90 | + 'serialize' => true |
|
| 91 | + ], |
|
| 92 | + '_cake_routes_' => [ |
|
| 93 | + 'engine' => 'Cake\Cache\Engine\FileEngine', |
|
| 94 | + 'prefix' => 'cake_model_', |
|
| 95 | + 'serialize' => true |
|
| 96 | + ], |
|
| 97 | 97 | ]); |
| 98 | 98 | |
| 99 | 99 | if (!getenv('db_dsn')) { |
| 100 | - putenv('db_dsn=sqlite:///:memory:'); |
|
| 100 | + putenv('db_dsn=sqlite:///:memory:'); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $config = [ |
| 104 | - 'url' => getenv('db_dsn'), |
|
| 105 | - 'timezone' => 'UTC', |
|
| 104 | + 'url' => getenv('db_dsn'), |
|
| 105 | + 'timezone' => 'UTC', |
|
| 106 | 106 | ]; |
| 107 | 107 | |
| 108 | 108 | ConnectionManager::setConfig('test', $config); |