diff --git a/app/code/Magento/Captcha/Model/DefaultModel.php b/app/code/Magento/Captcha/Model/DefaultModel.php index fadc92ba55ec9..a977ad6923611 100644 --- a/app/code/Magento/Captcha/Model/DefaultModel.php +++ b/app/code/Magento/Captcha/Model/DefaultModel.php @@ -6,11 +6,11 @@ namespace Magento\Captcha\Model; /** - * Implementation of \Zend_Captcha + * Implementation of \Zend\Captcha\Image * * @author Magento Core Team */ -class DefaultModel extends \Zend_Captcha_Image implements \Magento\Captcha\Model\CaptchaInterface +class DefaultModel extends \Zend\Captcha\Image implements \Magento\Captcha\Model\CaptchaInterface { /** * Key in session for captcha code @@ -30,49 +30,50 @@ class DefaultModel extends \Zend_Captcha_Image implements \Magento\Captcha\Model /** * @var \Magento\Captcha\Helper\Data */ - protected $_captchaData; + protected $captchaData; /** * Captcha expire time * @var int */ - protected $_expiration; + protected $expiration; /** * Override default value to prevent a captcha cut off * @var int - * @see \Zend_Captcha_Image::$_fsize + * @see \Zend\Captcha\Image::$fsize */ - protected $_fsize = 22; + protected $fsize = 22; /** * Captcha form id * @var string */ - protected $_formId; + protected $formId; /** * @var \Magento\Captcha\Model\ResourceModel\LogFactory */ - protected $_resLogFactory; + protected $resLogFactory; /** * Overrides parent parameter as session comes in constructor. * * @var bool */ - protected $_keepSession = true; + protected $keepSession = true; /** * @var \Magento\Framework\Session\SessionManagerInterface */ - protected $_session; + protected $session; /** * @param \Magento\Framework\Session\SessionManagerInterface $session * @param \Magento\Captcha\Helper\Data $captchaData - * @param \Magento\Captcha\Model\ResourceModel\LogFactory $resLogFactory + * @param ResourceModel\LogFactory $resLogFactory * @param string $formId + * @throws \Zend\Captcha\Exception\ExtensionNotLoadedException */ public function __construct( \Magento\Framework\Session\SessionManagerInterface $session, @@ -80,10 +81,11 @@ public function __construct( \Magento\Captcha\Model\ResourceModel\LogFactory $resLogFactory, $formId ) { - $this->_session = $session; - $this->_captchaData = $captchaData; - $this->_resLogFactory = $resLogFactory; - $this->_formId = $formId; + parent::__construct(); + $this->session = $session; + $this->captchaData = $captchaData; + $this->resLogFactory = $resLogFactory; + $this->formId = $formId; } /** @@ -92,9 +94,9 @@ public function __construct( * @param string $key * @return string */ - protected function _getFormIdKey($key) + private function getFormIdKey($key) { - return $this->_formId . '_' . $key; + return $this->formId . '_' . $key; } /** @@ -115,19 +117,21 @@ public function getBlockName() */ public function isRequired($login = null) { - if ($this->_isUserAuth() && !$this->isShownToLoggedInUser() || !$this->_isEnabled() || !in_array( - $this->_formId, - $this->_getTargetForms() - ) + if ( + $this->isUserAuth() + && !$this->isShownToLoggedInUser() + || !$this->isEnabled() + || !in_array( + $this->formId, + $this->getTargetForms() + ) ) { return false; } - return $this->_isShowAlways() || $this->_isOverLimitAttempts( - $login - ) || $this->_session->getData( - $this->_getFormIdKey('show_captcha') - ); + return $this->isShowAlways() + || $this->isOverLimitAttempts($login) + || $this->session->getData($this->getFormIdKey('show_captcha')); } /** @@ -137,9 +141,9 @@ public function isRequired($login = null) */ public function isShownToLoggedInUser() { - $forms = (array)$this->_captchaData->getConfig('shown_to_logged_in_user'); + $forms = (array)$this->captchaData->getConfig('shown_to_logged_in_user'); foreach ($forms as $formId => $isShownToLoggedIn) { - if ($isShownToLoggedIn && $this->_formId == $formId) { + if ($isShownToLoggedIn && $this->formId == $formId) { return true; } } @@ -152,9 +156,9 @@ public function isShownToLoggedInUser() * @param string $login * @return bool */ - protected function _isOverLimitAttempts($login) + private function isOverLimitAttempts($login) { - return $this->_isOverLimitIpAttempt() || $this->_isOverLimitLoginAttempts($login); + return $this->isOverLimitIpAttempt() || $this->isOverLimitLoginAttempts($login); } /** @@ -162,9 +166,9 @@ protected function _isOverLimitAttempts($login) * * @return int */ - protected function _getAllowedAttemptsForSameLogin() + private function getAllowedAttemptsForSameLogin() { - return (int)$this->_captchaData->getConfig('failed_attempts_login'); + return (int)$this->captchaData->getConfig('failed_attempts_login'); } /** @@ -172,20 +176,20 @@ protected function _getAllowedAttemptsForSameLogin() * * @return int */ - protected function _getAllowedAttemptsFromSameIp() + private function getAllowedAttemptsFromSameIp() { - return (int)$this->_captchaData->getConfig('failed_attempts_ip'); + return (int)$this->captchaData->getConfig('failed_attempts_ip'); } /** - * Check is overlimit saved attempts from one ip + * Check is over limit saved attempts from one ip * * @return bool */ - protected function _isOverLimitIpAttempt() + private function isOverLimitIpAttempt() { - $countAttemptsByIp = $this->_getResourceModel()->countAttemptsByRemoteAddress(); - return $countAttemptsByIp >= $this->_getAllowedAttemptsFromSameIp(); + $countAttemptsByIp = $this->getResourceModel()->countAttemptsByRemoteAddress(); + return $countAttemptsByIp >= $this->getAllowedAttemptsFromSameIp(); } /** @@ -194,11 +198,11 @@ protected function _isOverLimitIpAttempt() * @param string $login * @return bool */ - protected function _isOverLimitLoginAttempts($login) + private function isOverLimitLoginAttempts($login) { if ($login != false) { - $countAttemptsByLogin = $this->_getResourceModel()->countAttemptsByUserLogin($login); - return $countAttemptsByLogin >= $this->_getAllowedAttemptsForSameLogin(); + $countAttemptsByLogin = $this->getResourceModel()->countAttemptsByUserLogin($login); + return $countAttemptsByLogin >= $this->getAllowedAttemptsForSameLogin(); } return false; } @@ -208,9 +212,9 @@ protected function _isOverLimitLoginAttempts($login) * * @return bool */ - protected function _isUserAuth() + private function isUserAuth() { - return $this->_session->isLoggedIn(); + return $this->session->isLoggedIn(); } /** @@ -220,7 +224,7 @@ protected function _isUserAuth() */ public function isCaseSensitive() { - return (string)$this->_captchaData->getConfig('case_sensitive'); + return (string)$this->captchaData->getConfig('case_sensitive'); } /** @@ -230,8 +234,8 @@ public function isCaseSensitive() */ public function getFont() { - $font = (string)$this->_captchaData->getConfig('font'); - $fonts = $this->_captchaData->getFonts(); + $font = (string)$this->captchaData->getConfig('font'); + $fonts = $this->captchaData->getFonts(); if (isset($fonts[$font])) { $fontPath = $fonts[$font]['path']; @@ -250,14 +254,14 @@ public function getFont() */ public function getExpiration() { - if (!$this->_expiration) { + if (!$this->expiration) { /** * as "timeout" configuration parameter specifies timeout in minutes - we multiply it on 60 to set * expiration in seconds */ - $this->_expiration = (int)$this->_captchaData->getConfig('timeout') * 60; + $this->expiration = (int)$this->captchaData->getConfig('timeout') * 60; } - return $this->_expiration; + return $this->expiration; } /** @@ -277,7 +281,7 @@ public function getTimeout() */ public function getImgDir() { - return $this->_captchaData->getImgDir(); + return $this->captchaData->getImgDir(); } /** @@ -287,7 +291,7 @@ public function getImgDir() */ public function getImgUrl() { - return $this->_captchaData->getImgUrl(); + return $this->captchaData->getImgUrl(); } /** @@ -299,7 +303,7 @@ public function getImgUrl() public function isCorrect($word) { $storedWord = $this->getWord(); - $this->_clearWord(); + $this->clearWord(); if (!$word || !$storedWord) { return false; @@ -330,9 +334,9 @@ public function getImgSrc() */ public function logAttempt($login) { - if ($this->_isEnabled() && in_array($this->_formId, $this->_getTargetForms())) { - $this->_getResourceModel()->logAttempt($login); - if ($this->_isOverLimitLoginAttempts($login)) { + if ($this->isEnabled() && in_array($this->formId, $this->getTargetForms())) { + $this->getResourceModel()->logAttempt($login); + if ($this->isOverLimitLoginAttempts($login)) { $this->setShowCaptchaInSession(true); } } @@ -351,19 +355,20 @@ public function setShowCaptchaInSession($value = true) $value = false; } - $this->_session->setData($this->_getFormIdKey('show_captcha'), $value); + $this->session->setData($this->getFormIdKey('show_captcha'), $value); } /** * Generate word used for captcha render * * @return string + * @throws \Magento\Framework\Exception\LocalizedException */ - protected function _generateWord() + protected function generateWord() { $word = ''; - $symbols = $this->_getSymbols(); - $wordLen = $this->_getWordLen(); + $symbols = $this->getSymbols(); + $wordLen = $this->getWordLen(); for ($i = 0; $i < $wordLen; $i++) { $word .= $symbols[array_rand($symbols)]; } @@ -375,21 +380,22 @@ protected function _generateWord() * * @return array */ - protected function _getSymbols() + private function getSymbols() { - return str_split((string)$this->_captchaData->getConfig('symbols')); + return str_split((string)$this->captchaData->getConfig('symbols')); } /** * Returns length for generating captcha word. This value may be dynamic. * * @return int + * @throws \Magento\Framework\Exception\LocalizedException */ - protected function _getWordLen() + public function getWordLen() { $from = 0; $to = 0; - $length = (string)$this->_captchaData->getConfig('length'); + $length = (string)$this->captchaData->getConfig('length'); if (!is_numeric($length)) { if (preg_match('/(\d+)-(\d+)/', $length, $matches)) { $from = (int)$matches[1]; @@ -413,22 +419,22 @@ protected function _getWordLen() * * @return bool */ - protected function _isShowAlways() + private function isShowAlways() { - if ((string)$this->_captchaData->getConfig('mode') == \Magento\Captcha\Helper\Data::MODE_ALWAYS) { + if ((string)$this->captchaData->getConfig('mode') == \Magento\Captcha\Helper\Data::MODE_ALWAYS) { return true; } - if ((string)$this->_captchaData->getConfig( - 'mode' - ) == \Magento\Captcha\Helper\Data::MODE_AFTER_FAIL && $this->_getAllowedAttemptsForSameLogin() == 0 + if ( + (string)$this->captchaData->getConfig('mode') == \Magento\Captcha\Helper\Data::MODE_AFTER_FAIL + && $this->getAllowedAttemptsForSameLogin() == 0 ) { return true; } - $alwaysFor = $this->_captchaData->getConfig('always_for'); + $alwaysFor = $this->captchaData->getConfig('always_for'); foreach ($alwaysFor as $nodeFormId => $isAlwaysFor) { - if ($isAlwaysFor && $this->_formId == $nodeFormId) { + if ($isAlwaysFor && $this->formId == $nodeFormId) { return true; } } @@ -441,9 +447,9 @@ protected function _isShowAlways() * * @return bool */ - protected function _isEnabled() + private function isEnabled() { - return (string)$this->_captchaData->getConfig('enable'); + return (string)$this->captchaData->getConfig('enable'); } /** @@ -453,9 +459,9 @@ protected function _isEnabled() * * @return array */ - protected function _getTargetForms() + private function getTargetForms() { - $formsString = (string)$this->_captchaData->getConfig('forms'); + $formsString = (string)$this->captchaData->getConfig('forms'); return explode(',', $formsString); } @@ -466,7 +472,7 @@ protected function _getTargetForms() */ public function getWord() { - $sessionData = $this->_session->getData($this->_getFormIdKey(self::SESSION_WORD)); + $sessionData = $this->session->getData($this->getFormIdKey(self::SESSION_WORD)); return time() < $sessionData['expires'] ? $sessionData['data'] : null; } @@ -476,13 +482,13 @@ public function getWord() * @param string $word * @return $this */ - protected function _setWord($word) + protected function setWord($word) { - $this->_session->setData( - $this->_getFormIdKey(self::SESSION_WORD), + $this->session->setData( + $this->getFormIdKey(self::SESSION_WORD), ['data' => $word, 'expires' => time() + $this->getTimeout()] ); - $this->_word = $word; + $this->word = $word; return $this; } @@ -491,20 +497,21 @@ protected function _setWord($word) * * @return $this */ - protected function _clearWord() + private function clearWord() { - $this->_session->unsetData($this->_getFormIdKey(self::SESSION_WORD)); - $this->_word = null; + $this->session->unsetData($this->getFormIdKey(self::SESSION_WORD)); + $this->word = null; return $this; } /** * Override function to generate less curly captcha that will not cut off * - * @see \Zend_Captcha_Image::_randomSize() + * @see \Zend\Captcha\Image::_randomSize() * @return int + * @throws \Magento\Framework\Exception\LocalizedException */ - protected function _randomSize() + protected function randomSize() { return \Magento\Framework\Math\Random::getRandomNumber(280, 300) / 100; } @@ -516,8 +523,11 @@ protected function _randomSize() * * Now deleting old captcha images make crontab script * @see \Magento\Captcha\Cron\DeleteExpiredImages::execute + * + * Added SuppressWarnings since this method is declared in parent class and we can not use other method name. + * @SuppressWarnings(PHPMD.ShortMethodName) */ - protected function _gc() + protected function gc() { //do nothing } @@ -527,8 +537,8 @@ protected function _gc() * * @return \Magento\Captcha\Model\ResourceModel\Log */ - protected function _getResourceModel() + private function getResourceModel() { - return $this->_resLogFactory->create(); + return $this->resLogFactory->create(); } } diff --git a/app/code/Magento/Captcha/composer.json b/app/code/Magento/Captcha/composer.json index d474e5c879749..1dca5eaf33cf6 100644 --- a/app/code/Magento/Captcha/composer.json +++ b/app/code/Magento/Captcha/composer.json @@ -8,7 +8,8 @@ "magento/module-checkout": "100.2.*", "magento/module-backend": "100.2.*", "magento/framework": "100.2.*", - "zendframework/zend-db": "~2.4.6" + "zendframework/zend-db": "~2.4.6", + "zendframework/zend-captcha": "~2.4.6" }, "type": "magento2-module", "version": "100.2.0-dev", diff --git a/composer.json b/composer.json index 32e01fbd4df0b..e6333de61266c 100644 --- a/composer.json +++ b/composer.json @@ -32,6 +32,7 @@ "zendframework/zend-log": "~2.4.6", "zendframework/zend-http": "~2.4.6", "zendframework/zend-db": "~2.4.6", + "zendframework/zend-captcha": "~2.4.6", "magento/zendframework1": "~1.12.16", "colinmollenhour/credis": "1.6", "colinmollenhour/php-redis-session-abstract": "1.2", diff --git a/composer.lock b/composer.lock index 0e37e08a9cbd9..0f58efd376c8d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "19f69b22940e467182c3276cb21d25c2", - "content-hash": "63dfc7237cae2286c4d8f36d66ddde03", + "content-hash": "19534d1bf1acb6c766cc19f77935d02b", "packages": [ { "name": "braintree/braintree_php", @@ -52,7 +51,7 @@ } ], "description": "Braintree PHP Client Library", - "time": "2015-11-19 19:14:47" + "time": "2015-11-19T19:14:47+00:00" }, { "name": "colinmollenhour/cache-backend-file", @@ -88,7 +87,7 @@ ], "description": "The stock Zend_Cache_Backend_File backend has extremely poor performance for cleaning by tags making it become unusable as the number of cached items increases. This backend makes many changes resulting in a huge performance boost, especially for tag cleaning.", "homepage": "https://github.com/colinmollenhour/Cm_Cache_Backend_File", - "time": "2016-05-02 16:24:47" + "time": "2016-05-02T16:24:47+00:00" }, { "name": "colinmollenhour/cache-backend-redis", @@ -124,7 +123,7 @@ ], "description": "Zend_Cache backend using Redis with full support for tags.", "homepage": "https://github.com/colinmollenhour/Cm_Cache_Backend_Redis", - "time": "2016-05-02 16:23:36" + "time": "2016-05-02T16:23:36+00:00" }, { "name": "colinmollenhour/credis", @@ -163,7 +162,7 @@ ], "description": "Credis is a lightweight interface to the Redis key-value store which wraps the phpredis library when available for better performance.", "homepage": "https://github.com/colinmollenhour/credis", - "time": "2015-11-28 01:20:04" + "time": "2015-11-28T01:20:04+00:00" }, { "name": "colinmollenhour/php-redis-session-abstract", @@ -201,7 +200,7 @@ ], "description": "A Redis-based session handler with optimistic locking", "homepage": "https://github.com/colinmollenhour/php-redis-session-abstract", - "time": "2016-08-04 18:05:51" + "time": "2016-08-04T18:05:51+00:00" }, { "name": "composer/composer", @@ -276,7 +275,7 @@ "dependency", "package" ], - "time": "2016-03-03 15:15:10" + "time": "2016-03-03T15:15:10+00:00" }, { "name": "composer/semver", @@ -338,7 +337,7 @@ "validation", "versioning" ], - "time": "2016-08-30 16:08:34" + "time": "2016-08-30T16:08:34+00:00" }, { "name": "composer/spdx-licenses", @@ -399,7 +398,7 @@ "spdx", "validator" ], - "time": "2016-09-28 07:17:45" + "time": "2016-09-28T07:17:45+00:00" }, { "name": "justinrainbow/json-schema", @@ -465,7 +464,7 @@ "json", "schema" ], - "time": "2016-01-25 15:43:01" + "time": "2016-01-25T15:43:01+00:00" }, { "name": "league/climate", @@ -514,7 +513,7 @@ "php", "terminal" ], - "time": "2015-01-18 14:31:58" + "time": "2015-01-18T14:31:58+00:00" }, { "name": "magento/composer", @@ -550,7 +549,7 @@ "AFL-3.0" ], "description": "Magento composer library helps to instantiate Composer application and run composer commands.", - "time": "2017-02-07 21:59:01" + "time": "2017-02-07T21:59:01+00:00" }, { "name": "magento/magento-composer-installer", @@ -629,7 +628,7 @@ "composer-installer", "magento" ], - "time": "2016-10-06 16:05:07" + "time": "2016-10-06T16:05:07+00:00" }, { "name": "magento/zendframework1", @@ -676,7 +675,7 @@ "ZF1", "framework" ], - "time": "2017-01-17 16:40:08" + "time": "2017-01-17T16:40:08+00:00" }, { "name": "monolog/monolog", @@ -754,7 +753,7 @@ "logging", "psr-3" ], - "time": "2016-11-26 00:15:39" + "time": "2016-11-26T00:15:39+00:00" }, { "name": "oyejorge/less.php", @@ -816,7 +815,7 @@ "php", "stylesheet" ], - "time": "2015-12-30 05:47:36" + "time": "2015-12-30T05:47:36+00:00" }, { "name": "paragonie/random_compat", @@ -864,7 +863,7 @@ "pseudorandom", "random" ], - "time": "2016-11-07 23:38:38" + "time": "2016-11-07T23:38:38+00:00" }, { "name": "pelago/emogrifier", @@ -920,7 +919,7 @@ ], "description": "Converts CSS styles into inline style attributes in your HTML code", "homepage": "http://www.pelagodesign.com/sidecar/emogrifier/", - "time": "2015-05-15 11:37:51" + "time": "2015-05-15T11:37:51+00:00" }, { "name": "phpseclib/phpseclib", @@ -1012,7 +1011,7 @@ "x.509", "x509" ], - "time": "2016-10-04 00:57:04" + "time": "2016-10-04T00:57:04+00:00" }, { "name": "psr/log", @@ -1059,7 +1058,7 @@ "psr", "psr-3" ], - "time": "2016-10-10 12:19:37" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "ramsey/uuid", @@ -1139,7 +1138,7 @@ "identifier", "uuid" ], - "time": "2016-04-24 00:08:55" + "time": "2016-04-24T00:08:55+00:00" }, { "name": "seld/cli-prompt", @@ -1187,7 +1186,7 @@ "input", "prompt" ], - "time": "2016-04-18 09:31:41" + "time": "2016-04-18T09:31:41+00:00" }, { "name": "seld/jsonlint", @@ -1233,7 +1232,7 @@ "parser", "validator" ], - "time": "2016-11-14 17:59:58" + "time": "2016-11-14T17:59:58+00:00" }, { "name": "seld/phar-utils", @@ -1277,7 +1276,7 @@ "keywords": [ "phra" ], - "time": "2015-10-13 18:44:15" + "time": "2015-10-13T18:44:15+00:00" }, { "name": "sjparkinson/static-review", @@ -1330,7 +1329,7 @@ } ], "description": "An extendable framework for version control hooks.", - "time": "2014-09-22 08:40:36" + "time": "2014-09-22T08:40:36+00:00" }, { "name": "symfony/console", @@ -1391,7 +1390,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-02-06 12:04:06" + "time": "2017-02-06T12:04:06+00:00" }, { "name": "symfony/debug", @@ -1448,7 +1447,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-07-30 07:22:48" + "time": "2016-07-30T07:22:48+00:00" }, { "name": "symfony/event-dispatcher", @@ -1508,7 +1507,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-01-02 20:30:24" + "time": "2017-01-02T20:30:24+00:00" }, { "name": "symfony/filesystem", @@ -1557,7 +1556,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-01-08 20:47:33" + "time": "2017-01-08T20:47:33+00:00" }, { "name": "symfony/finder", @@ -1606,7 +1605,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-01-02 20:32:22" + "time": "2017-01-02T20:32:22+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -1665,7 +1664,7 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2016-11-14T01:06:16+00:00" }, { "name": "symfony/process", @@ -1714,7 +1713,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-02-03 12:08:06" + "time": "2017-02-03T12:08:06+00:00" }, { "name": "tedivm/jshrink", @@ -1760,7 +1759,7 @@ "javascript", "minifier" ], - "time": "2014-11-11 03:54:14" + "time": "2014-11-11T03:54:14+00:00" }, { "name": "tubalmartin/cssmin", @@ -1804,7 +1803,65 @@ "minify", "yui" ], - "time": "2014-09-22 08:08:50" + "time": "2014-09-22T08:08:50+00:00" + }, + { + "name": "zendframework/zend-captcha", + "version": "2.4.11", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-captcha.git", + "reference": "ba8ec60bbad38d233b0336293a332b2f8b53a134" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-captcha/zipball/ba8ec60bbad38d233b0336293a332b2f8b53a134", + "reference": "ba8ec60bbad38d233b0336293a332b2f8b53a134", + "shasum": "" + }, + "require": { + "php": ">=5.3.23", + "zendframework/zend-math": "~2.4.0", + "zendframework/zend-stdlib": "~2.4.0" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", + "zendframework/zend-session": "~2.4.0", + "zendframework/zend-text": "~2.4.0", + "zendframework/zend-validator": "~2.4.0", + "zendframework/zendservice-recaptcha": "*" + }, + "suggest": { + "zendframework/zend-resources": "Translations of captcha messages", + "zendframework/zend-session": "Zend\\Session component", + "zendframework/zend-text": "Zend\\Text component", + "zendframework/zend-validator": "Zend\\Validator component", + "zendframework/zendservice-recaptcha": "ZendService\\ReCaptcha component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev", + "dev-develop": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Captcha\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-captcha", + "keywords": [ + "captcha", + "zf2" + ], + "time": "2015-11-23T15:35:19+00:00" }, { "name": "zendframework/zend-code", @@ -1857,7 +1914,7 @@ "code", "zf2" ], - "time": "2015-05-11 16:17:05" + "time": "2015-05-11T16:17:05+00:00" }, { "name": "zendframework/zend-config", @@ -1914,7 +1971,7 @@ "config", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-console", @@ -1964,7 +2021,7 @@ "console", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-crypt", @@ -2016,7 +2073,7 @@ "crypt", "zf2" ], - "time": "2015-11-23 16:33:27" + "time": "2015-11-23T16:33:27+00:00" }, { "name": "zendframework/zend-db", @@ -2069,7 +2126,7 @@ "db", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-di", @@ -2120,7 +2177,7 @@ "di", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-escaper", @@ -2165,7 +2222,7 @@ "escaper", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-eventmanager", @@ -2211,7 +2268,7 @@ "eventmanager", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-filter", @@ -2267,7 +2324,7 @@ "filter", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-form", @@ -2338,7 +2395,7 @@ "form", "zf2" ], - "time": "2015-09-09 19:11:05" + "time": "2015-09-09T19:11:05+00:00" }, { "name": "zendframework/zend-http", @@ -2389,7 +2446,7 @@ "http", "zf2" ], - "time": "2015-09-14 16:11:20" + "time": "2015-09-14T16:11:20+00:00" }, { "name": "zendframework/zend-i18n", @@ -2453,7 +2510,7 @@ "i18n", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-inputfilter", @@ -2504,7 +2561,7 @@ "inputfilter", "zf2" ], - "time": "2015-09-09 15:44:54" + "time": "2015-09-09T15:44:54+00:00" }, { "name": "zendframework/zend-json", @@ -2558,7 +2615,7 @@ "json", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-loader", @@ -2603,7 +2660,7 @@ "loader", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-log", @@ -2665,7 +2722,7 @@ "logging", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-math", @@ -2716,7 +2773,7 @@ "math", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-modulemanager", @@ -2774,7 +2831,7 @@ "modulemanager", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-mvc", @@ -2862,7 +2919,7 @@ "mvc", "zf2" ], - "time": "2015-09-14 16:32:50" + "time": "2015-09-14T16:32:50+00:00" }, { "name": "zendframework/zend-serializer", @@ -2915,7 +2972,7 @@ "serializer", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-server", @@ -2962,7 +3019,7 @@ "server", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-servicemanager", @@ -3012,7 +3069,7 @@ "servicemanager", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-soap", @@ -3064,7 +3121,7 @@ "soap", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-stdlib", @@ -3119,7 +3176,7 @@ "stdlib", "zf2" ], - "time": "2015-07-21 13:55:46" + "time": "2015-07-21T13:55:46+00:00" }, { "name": "zendframework/zend-text", @@ -3166,7 +3223,7 @@ "text", "zf2" ], - "time": "2015-05-07 14:55:31" + "time": "2015-05-07T14:55:31+00:00" }, { "name": "zendframework/zend-uri", @@ -3214,7 +3271,7 @@ "uri", "zf2" ], - "time": "2015-09-14 16:17:10" + "time": "2015-09-14T16:17:10+00:00" }, { "name": "zendframework/zend-validator", @@ -3279,7 +3336,7 @@ "validator", "zf2" ], - "time": "2015-09-08 21:04:17" + "time": "2015-09-08T21:04:17+00:00" }, { "name": "zendframework/zend-view", @@ -3356,7 +3413,7 @@ "view", "zf2" ], - "time": "2015-06-16 15:22:37" + "time": "2015-06-16T15:22:37+00:00" } ], "packages-dev": [ @@ -3412,7 +3469,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -3470,7 +3527,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2016-12-01 00:05:05" + "time": "2016-12-01T00:05:05+00:00" }, { "name": "lusitanian/oauth", @@ -3537,7 +3594,7 @@ "oauth", "security" ], - "time": "2015-10-07 00:20:04" + "time": "2015-10-07T00:20:04+00:00" }, { "name": "pdepend/pdepend", @@ -3577,7 +3634,7 @@ "BSD-3-Clause" ], "description": "Official version of pdepend to be handled with Composer", - "time": "2017-01-10 13:45:16" + "time": "2017-01-10T13:45:16+00:00" }, { "name": "phpmd/phpmd", @@ -3642,7 +3699,7 @@ "phpmd", "pmd" ], - "time": "2016-11-23 20:33:32" + "time": "2016-11-23T20:33:32+00:00" }, { "name": "phpunit/php-code-coverage", @@ -3704,7 +3761,7 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2015-10-06T15:47:00+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3749,7 +3806,7 @@ "filesystem", "iterator" ], - "time": "2013-10-10 15:34:57" + "time": "2013-10-10T15:34:57+00:00" }, { "name": "phpunit/php-text-template", @@ -3790,7 +3847,7 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", @@ -3834,7 +3891,7 @@ "keywords": [ "timer" ], - "time": "2016-05-12 18:03:57" + "time": "2016-05-12T18:03:57+00:00" }, { "name": "phpunit/php-token-stream", @@ -3883,7 +3940,7 @@ "keywords": [ "tokenizer" ], - "time": "2016-11-15 14:06:22" + "time": "2016-11-15T14:06:22+00:00" }, { "name": "phpunit/phpunit", @@ -3957,7 +4014,7 @@ "testing", "xunit" ], - "time": "2014-05-02 07:13:40" + "time": "2014-05-02T07:13:40+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -4013,7 +4070,7 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2015-10-02T06:51:40+00:00" }, { "name": "sebastian/comparator", @@ -4077,7 +4134,7 @@ "compare", "equality" ], - "time": "2017-01-29 09:50:25" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", @@ -4129,7 +4186,7 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2015-12-08T07:14:41+00:00" }, { "name": "sebastian/environment", @@ -4179,7 +4236,7 @@ "environment", "hhvm" ], - "time": "2016-08-18 05:49:44" + "time": "2016-08-18T05:49:44+00:00" }, { "name": "sebastian/exporter", @@ -4246,7 +4303,7 @@ "export", "exporter" ], - "time": "2016-06-17 09:04:28" + "time": "2016-06-17T09:04:28+00:00" }, { "name": "sebastian/finder-facade", @@ -4285,7 +4342,7 @@ ], "description": "FinderFacade is a convenience wrapper for Symfony's Finder component.", "homepage": "https://github.com/sebastianbergmann/finder-facade", - "time": "2016-02-17 07:02:23" + "time": "2016-02-17T07:02:23+00:00" }, { "name": "sebastian/phpcpd", @@ -4336,7 +4393,7 @@ ], "description": "Copy/Paste Detector (CPD) for PHP code.", "homepage": "https://github.com/sebastianbergmann/phpcpd", - "time": "2013-11-08 09:05:42" + "time": "2013-11-08T09:05:42+00:00" }, { "name": "sebastian/recursion-context", @@ -4389,7 +4446,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11 19:50:13" + "time": "2015-11-11T19:50:13+00:00" }, { "name": "sebastian/version", @@ -4424,7 +4481,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2015-06-21T13:59:46+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -4499,7 +4556,7 @@ "phpcs", "standards" ], - "time": "2014-05-01 03:07:07" + "time": "2014-05-01T03:07:07+00:00" }, { "name": "symfony/config", @@ -4555,7 +4612,7 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-02-06 12:04:21" + "time": "2017-02-06T12:04:21+00:00" }, { "name": "symfony/dependency-injection", @@ -4615,7 +4672,7 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-01-28 00:04:57" + "time": "2017-01-28T00:04:57+00:00" }, { "name": "symfony/stopwatch", @@ -4664,7 +4721,7 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2017-01-02 20:32:22" + "time": "2017-01-02T20:32:22+00:00" }, { "name": "symfony/yaml", @@ -4713,7 +4770,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-01-21 16:40:50" + "time": "2017-01-21T16:40:50+00:00" }, { "name": "theseer/fdomdocument", @@ -4753,7 +4810,7 @@ ], "description": "The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.", "homepage": "https://github.com/theseer/fDOMDocument", - "time": "2015-05-27 22:58:02" + "time": "2015-05-27T22:58:02+00:00" } ], "aliases": [], diff --git a/dev/tests/integration/etc/di/preferences/ce.php b/dev/tests/integration/etc/di/preferences/ce.php index b22e8c4dbedee..a01ac8caaf977 100644 --- a/dev/tests/integration/etc/di/preferences/ce.php +++ b/dev/tests/integration/etc/di/preferences/ce.php @@ -23,4 +23,5 @@ \Magento\TestFramework\Db\ConnectionAdapter::class, \Magento\Framework\Filesystem\DriverInterface::class => \Magento\Framework\Filesystem\Driver\File::class, \Magento\Framework\App\Config\ScopeConfigInterface::class => \Magento\TestFramework\App\Config::class, + \Magento\Captcha\Model\DefaultModel::class => \Magento\TestFramework\Captcha\DefaultModel::class, ]; diff --git a/dev/tests/integration/framework/Magento/TestFramework/Captcha/DefaultModel.php b/dev/tests/integration/framework/Magento/TestFramework/Captcha/DefaultModel.php new file mode 100644 index 0000000000000..34d8be7aae0d6 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Captcha/DefaultModel.php @@ -0,0 +1,34 @@ + + */ +class DefaultModel extends \Magento\Captcha\Model\DefaultModel +{ + /** + * Do not pass onto the parent constructor as imageftbbox is not initialized on travis + * + * @param \Magento\Framework\Session\SessionManagerInterface $session + * @param \Magento\Captcha\Helper\Data $captchaData + * @param \Magento\Captcha\Model\ResourceModel\LogFactory $resLogFactory + * @param string $formId + */ + public function __construct( + \Magento\Framework\Session\SessionManagerInterface $session, + \Magento\Captcha\Helper\Data $captchaData, + \Magento\Captcha\Model\ResourceModel\LogFactory $resLogFactory, + $formId + ) { + $this->session = $session; + $this->captchaData = $captchaData; + $this->resLogFactory = $resLogFactory; + $this->formId = $formId; + } +}