From 279384498d1381a0b5e34f4e88c080b83ecd3cbb Mon Sep 17 00:00:00 2001 From: Willian Keller Date: Fri, 27 Jul 2018 08:53:11 -0300 Subject: [PATCH 001/912] Add Brazilian Credit Cards Support Add Brazilian Credit Cards Support #1 --- app/code/Magento/Payment/etc/payment.xml | 9 +++++++++ .../Payment/view/base/web/images/cc/au.png | Bin 0 -> 1791 bytes .../Payment/view/base/web/images/cc/elo.png | Bin 0 -> 1397 bytes .../Payment/view/base/web/images/cc/hc.png | Bin 0 -> 1427 bytes 4 files changed, 9 insertions(+) create mode 100644 app/code/Magento/Payment/view/base/web/images/cc/au.png create mode 100644 app/code/Magento/Payment/view/base/web/images/cc/elo.png create mode 100644 app/code/Magento/Payment/view/base/web/images/cc/hc.png diff --git a/app/code/Magento/Payment/etc/payment.xml b/app/code/Magento/Payment/etc/payment.xml index 19b5eb709c649..4afb6b01b366c 100644 --- a/app/code/Magento/Payment/etc/payment.xml +++ b/app/code/Magento/Payment/etc/payment.xml @@ -41,5 +41,14 @@ + + + + + + + + + diff --git a/app/code/Magento/Payment/view/base/web/images/cc/au.png b/app/code/Magento/Payment/view/base/web/images/cc/au.png new file mode 100644 index 0000000000000000000000000000000000000000..04cb2df8fa332127111138efe7499c74dea562bb GIT binary patch literal 1791 zcmVBW zK~z}7)tG&3U1c4|KfmWW=iGbS+ioq)Fxr*j*3FGD%%%Bk!1o$8i(;n8WJ&G5^2oS}VR}VF_ZTn3e{O2O(HFn{gnPDUd zvV7%sooP7rbl32+UAtJf?hr(vg;Fx0m~12k1h9Yq3hvx+H<_w%hTa!uWV#V041HdF zZY%4qKZNE=N|zKK;jRVHKDchpVO~DC1uKd%Zbt5!k>c&A>-qW4M_Jg|jt-Zlaw-Il z0S%!pljDiUx6yX$;+es7y3jNz28Th3#V{xVy(UAaWcl2eTlmDaZ$L)CGiYRS10G4Q zPtp~TbO*RW52prF2C@QKSaIbEHr)3d@48xgO@={}A`}aNEy+iD^#qDnwQpfMh|9bUEXG61|OE46nP{MB{5GfiJtKwKWQ^YGZTz0HS(gef_nkXbP zx-UkNK*2A?f&pZDT^xcpPH8FYTyqAOGsS?&I81}XG#9YVA$DPiy)44aaY$W^nWadT zLyQ}{iHV-oBHv=>5wy?Zx-G8VBRS!d91lqT9pFy-&{eeBq!sFtqG4qLZ*X|T0tIjd zgJd0ML4;jaz*|wkE()=ihnNo~n5-M?B^{7VP)N(3wXAZM!^47j4zC)RTb6ZfnT-X( zbyF|3RHw) zo2I2>2?q|Z;=qwrw6ray-)7GmM$R(8m*zp&Fv!+HsFwecNwUwRlDyy5s5f`r$9`QO%1UKRI7hYhKay_y170KDtSF{^nNI z1YP)ry}I?WyYTh>C;74}N(& z5Bzi^N1nQcS+)IKQrE@rUbvopEmt8jRqLaZ&zxf5-JUu8@xZ6~!y_AMs_CGqs$=W} zAO7_4M(+6TL#+SIGi?6qle~4hfz@|BNpoWx)#+gtH@4Cr{Ee#q%ND zzV6Sw^yYHzdE^0Bf8;d^QHsmvcCfgijkfknnY*lWY%rPNadA1(No^BBtzeu(U1j5( zH4v5BFCQZHP$zgM!HC1DLE=(H^##K5m0CO@avrK+CBcfri6HS*e-BKj`2R5(E=ZCK hRdK~!h%iBg{{f~>4i{y7PpAL@002ovPDHLkV1ifUU4sAs literal 0 HcmV?d00001 diff --git a/app/code/Magento/Payment/view/base/web/images/cc/elo.png b/app/code/Magento/Payment/view/base/web/images/cc/elo.png new file mode 100644 index 0000000000000000000000000000000000000000..eba0296a09104b059809ff2beea5ce501dab24e4 GIT binary patch literal 1397 zcmV-*1&aEKP)(lr0Rd#KBdHf=K;tl)tQ zmwSG{%jceZ&iDL|*r+r*l!motnn4Hz5(|(JYXVpb;1g3J1OTqJXxC_ZNUT88XFtoa=Abf*RNm4$jHdQ{5T17fd)^r30vNh2u}$N{~X01_fh~8 zt5)b`e~Z~{=KlTr8488?vfa6Jhiz?b)HE%#e%G#D8NbKldFg$El^YHG=6DeoW-Me% zk_kbk1erAO%J)TVe6N5~>IjHsQ)O9jo6W`x7cOumJ9FmDs=$R%?Cr6W3mQ46kui`I zWD?|@Aft+NkBsd2w2*+J5F&qYr4&z{I+X=DG&IDnt}Y%rbclgKAj@~`*s)ba9JJbu zd~mmr$r(M*e`n)?&q{dw>-7xXw=q2nre_5iGt*UFKtNkE^2>r(S66d>ex4*5iA31Z z(ecWf?(Xgk7D7Ze!Sf8I*Q6d477 z{l!W^c%$6Idu7e^m29PgTr!dd zgON8z%wz;)OwZbFmi)m72M03%m6eqQz=nnf`u%<;lgTXL(a}-v*|R5Ss#NGqd{XA+ zQ-_!S4ewGXauuFp*8wA$068o9`GLZm;5p^cYPDwWw{PE$zP>(qJf6(6hYufOcz75- zpAUY&e_7cwD+QSbq!gG)E+Cyl?SzmRf1m@91Vjo}o629uCnqN}P2}9Ua}duP!}$0( zPM$o8OP4O;=FOWqo6L*$G?heJ0%;IilnD@viNaU(J&kv20f;034U^$y{%4ho7cV}K zf&fX3jg6tby&ao3Z^nreClCk(GX9n9Q6h#vnFK-9>k83mvVm%;<0>&UtZ+A22q=lc zpO}9Gs;a7DFc{>(zyMoYTUlIOOq0o!@t2mCva_?3PNy?#--|ik+1Z)d^O3cJ@roUs zc6d2a?&XexV(R5Ts#0UH@MFuyMJbj#wzm~!sm{weo^t|HN};^G9HCGMi9`aYPoG9p zQxk6Az73@m+-^5&YHD!p+BLMav>+S~FHR>lHJQH=jYbg&1aRcY5&UrZGWynUL#y77 z2vUfX_$~Deo7e%jiX18A|8(; znoeP0;R&QBQ6w~&r4BkJkrG6Raa>8x;)}U4j4sSBs(cPBk!tnBvejxuMMVW{HXBG{ zYHA7-6BCF;B02Zi?RMDhb_9dLY(-ZlbIP+K!E?_dQ}jp(;M*@P>u9Pg{X|F00000NkvXXu0mjf DE(3;T literal 0 HcmV?d00001 diff --git a/app/code/Magento/Payment/view/base/web/images/cc/hc.png b/app/code/Magento/Payment/view/base/web/images/cc/hc.png new file mode 100644 index 0000000000000000000000000000000000000000..203e0b7e305c16191909dc552f26e7e2c76afa49 GIT binary patch literal 1427 zcmV;E1#J3>P)s_c}|bbeS$9rE~*}#h`#j5JZhgh(`YqF(9sq8c-zB#P~x@ zfQS+|BoPx)W0a7f;u19&1S>`f5&>BPrGR$Yf>XN8^4`qbu0I9}qy8}dFeT~vch7zA z-0z-q?m730&&x+kEAHapcvn)K*1R;jhZZe7QIQTgm z-*JWobOE@Z&C_o3nnkv|8@qpi^s)8}0n)U>O-K-$icr-H-Vp+X7}5zv zL1-F6$uC9aPPogBFP(G>tP~Zv*KQ8Q)BxbQI3OAlc41rPHP$v;Y+|XK?20 zZ;+mMk;kP(FE2-ngsHu6A(P*Hoyi;CpmF(9G94!YXnuM*k>*Awu3CYjX`~JxVeH~X z)XbYp)tpZ>xncs(6VX;Qi5k$T)Ac?PBP8l{$I)V^x!)#siVh8 z?EH>!eI0cVE~b3?^-Ns#JZ>t3UOI{iE1o6yM}pL`V+2Z~Sn)Xcexb+p@-n0^IkI9E ze#XSJb4+^mCG0Z^^jHPbbKSp&m z$wP+`2o%G>s3<4f(?e+7IQA}nh22GEV(1uEF{J0A zmzAOzMTBa{V8y%O++jB=W2i+2MO9Ulw6-Aa9Eopt5@~KE+HwW<*|P+qQOwSG-Z4P~ zt+*IP4^VU09U#E&>mTyCmah;hS|mc>PrH$>3xFC9W5wfSPMpN3tl;dAyQ!IX8@}Uk z)oW`}LqU$OTTiB=gZ5X}G5(pS$h4mTRpsdFHTaH0wz~%<807eC>uGrWF^tMeoW4Fz zz5Om;Hp`@!*N{APn8E!A@G>Um$y2zg6u#rowPh={3l~s!?NnULWbnX2JS&^8Hh?() zbW?*tr03z=_E33LgGIRM3~DHd8VWJ(!}s{*ktMjvG`?-)rqf8@M`#*aaRh`wIxcQH zjT#K%=W_Wfpa=rRQBW0R&c@AT(29!@0SzyeM$rwtoQ0z6cvg0(hXjfvNGb753!$p{ z{&G%+4(G*60O@(S=}dkuV-g&F8PajcC3B4Va7pH%qKC(_O_)raAG}#=J*{frx+m%9m0iT^A(~7#85#zuut`h+zUfavvW7 h9|0f6qKQis{7;G9J|AYPA143+002ovPDHLkV1hClmmvTE literal 0 HcmV?d00001 From f281a053938504331a277e83a7a1152dc5143636 Mon Sep 17 00:00:00 2001 From: Riccardo Tempesta Date: Tue, 7 Aug 2018 10:11:54 +0200 Subject: [PATCH 002/912] Support for non-FQN classes on web-API interfaces. This commit provides a support for "use" statement in web-API interfaces and the usage of non-FQN class names in doctypes. It also provides a fix for MSI-1524 and MSI-1537. --- .../Test/Unit/TypeProcessorTest.php | 3 +- .../Framework/Reflection/TypeProcessor.php | 71 ++++++++++++++++++- .../Webapi/ServiceInputProcessor.php | 12 +++- 3 files changed, 80 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php b/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php index 86a4693d9e5b6..b3fff04d756eb 100644 --- a/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php +++ b/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php @@ -8,6 +8,7 @@ use Magento\Framework\Exception\SerializationException; use Magento\Framework\Reflection\Test\Unit\Fixture\TSample; +use Magento\Framework\Reflection\Test\Unit\Fixture\TSampleInterface; use Magento\Framework\Reflection\TypeProcessor; use Zend\Code\Reflection\ClassReflection; @@ -278,7 +279,7 @@ public function arrayParamTypeDataProvider() { return [ ['method name' => 'addData', 'type' => 'array[]'], - ['method name' => 'addObjectList', 'type' => 'TSampleInterface[]'] + ['method name' => 'addObjectList', 'type' => TSampleInterface::class . '[]'] ]; } diff --git a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php index d7206032c68c7..9bfeef83c9f6c 100644 --- a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php +++ b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php @@ -6,6 +6,7 @@ namespace Magento\Framework\Reflection; +use Doctrine\Common\Annotations\TokenParser; use Magento\Framework\Exception\SerializationException; use Magento\Framework\Phrase; use Zend\Code\Reflection\ClassReflection; @@ -512,7 +513,7 @@ public function processSimpleAndAnyType($value, $type) public function getParamType(ParameterReflection $param) { $type = $param->detectType(); - if ($type == 'null') { + if ($type === 'null') { throw new \LogicException(sprintf( '@param annotation is incorrect for the parameter "%s" in the method "%s:%s".' . ' First declared type should not be null. E.g. string|null', @@ -521,14 +522,78 @@ public function getParamType(ParameterReflection $param) $param->getDeclaringFunction()->name )); } - if ($type == 'array') { + if ($type === 'array') { // try to determine class, if it's array of objects $paramDocBlock = $this->getParamDocBlockTag($param); $paramTypes = $paramDocBlock->getTypes(); $paramType = array_shift($paramTypes); + + $paramType = $this->resolveFullyQualifiedClassName($param->getDeclaringClass(), $paramType); + return strpos($paramType, '[]') !== false ? $paramType : "{$paramType}[]"; } - return $type; + + return $this->resolveFullyQualifiedClassName($param->getDeclaringClass(), $type); + } + + /** + * Resolve fully qualified type name in the class alias context + * @param ClassReflection $sourceClass + * @param string $typeName + * @return string + */ + public function resolveFullyQualifiedClassName(ClassReflection $sourceClass, string $typeName): string + { + $typeName = trim($typeName); + + // Not a class, but a basic type + if ((strtolower($typeName[0])) === $typeName[0]) { + return $typeName; + } + + // Split array suffix + if (preg_match('/^(.+?)\[\]$/', $typeName, $matches)) { + $typeName = $matches[1]; + $arraySuffix = '[]'; + } else { + $arraySuffix = ''; + } + + // If class exists, then return it + try { + new ClassReflection($typeName); + return $typeName . $arraySuffix; + } catch (\ReflectionException $e) { + unset($e); + } + + // Resolve fully qualified name + $sourceFileName = $sourceClass->getDeclaringFile(); + $source = $sourceFileName->getContents(); + $parser = new TokenParser($source); + + $namespace = $sourceClass->getNamespaceName(); + $aliases = $parser->parseUseStatements($namespace); + + $pos = strpos($typeName, '\\'); + if ($pos === 0) { + return substr($typeName, 1); + } + + if ($pos === false) { + $namespacePrefix = $typeName; + $partialClassName = ''; + } else { + $namespacePrefix = substr($typeName, 0, $pos); + $partialClassName = substr($typeName, $pos); + } + + $namespacePrefix = strtolower($namespacePrefix); + if (isset($aliases[$namespacePrefix])) { + return $aliases[$namespacePrefix] . $partialClassName . $arraySuffix; + } + + return $namespace . '\\' . $typeName . $arraySuffix; } /** diff --git a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php index 26102f008c7c3..f1a2e4f2bc704 100644 --- a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php +++ b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php @@ -175,7 +175,7 @@ private function getConstructorData(string $className, array $data): array $preferenceClass = $this->config->getPreference($className); $class = new ClassReflection($preferenceClass ?: $className); - $constructor = $class->getConstructor(); + $constructor = $class->getMethod('__construct'); if ($constructor === null) { return []; } @@ -184,7 +184,15 @@ private function getConstructorData(string $className, array $data): array $parameters = $constructor->getParameters(); foreach ($parameters as $parameter) { if (isset($data[$parameter->getName()])) { - $res[$parameter->getName()] = $data[$parameter->getName()]; + $parameterType = $this->typeProcessor->getParamType($parameter); + + try { + $res[$parameter->getName()] = $this->convertValue($data[$parameter->getName()], $parameterType); + } catch (\ReflectionException $e) { + // Parameter was not correclty declared or the class is uknown. + // By not returing the contructor value, we will automatically fall back to the "setters" way. + continue; + } } } From 6c1b1442e16e32e7af5cd0951000732e5564afb5 Mon Sep 17 00:00:00 2001 From: Willian Keller Date: Tue, 7 Aug 2018 15:52:47 -0300 Subject: [PATCH 003/912] Add Brazilian Credit Cards regex #1 --- .../credit-card-type.js | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js b/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js index 3ac67f6f31002..b438371cc24a5 100644 --- a/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js +++ b/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js @@ -110,6 +110,39 @@ define([ name: 'CVC', size: 3 } + }, + { + title: 'Hipercard', + type: 'HC', + pattern: '^((606282)|(637095)|(637568)|(637599)|(637609)|(637612))\\d*$', + gaps: [4, 8, 12], + lengths: [13, 16], + code: { + name: 'CVC', + size: 3 + } + }, + { + title: 'Elo', + type: 'ELO', + pattern: '^((509091)|(636368)|(636297)|(504175)|(438935)|(40117[8-9])|(45763[1-2])|(457393)|(431274)|(50990[0-2])|(5099[7-9][0-9])|(50996[4-9])|(509[1-8][0-9][0-9])|(5090(0[0-2]|0[4-9]|1[2-9]|[24589][0-9]|3[1-9]|6[0-46-9]|7[0-24-9]))|(5067(0[0-24-8]|1[0-24-9]|2[014-9]|3[0-379]|4[0-9]|5[0-3]|6[0-5]|7[0-8]))|(6504(0[5-9]|1[0-9]|2[0-9]|3[0-9]))|(6504(8[5-9]|9[0-9])|6505(0[0-9]|1[0-9]|2[0-9]|3[0-8]))|(6505(4[1-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-8]))|(6507(0[0-9]|1[0-8]))|(65072[0-7])|(6509(0[1-9]|1[0-9]|20))|(6516(5[2-9]|6[0-9]|7[0-9]))|(6550(0[0-9]|1[0-9]))|(6550(2[1-9]|3[0-9]|4[0-9]|5[0-8])))\\d*$', + gaps: [4, 8, 12], + lengths: [16], + code: { + name: 'CVC', + size: 3 + } + }, + { + title: 'Aura', + type: 'AU', + pattern: '^5078\\d*$', + gaps: [4, 8, 12], + lengths: [19], + code: { + name: 'CVC', + size: 3 + } } ]; From a0379a4bb36486ac26aaabaff969923b01a665f0 Mon Sep 17 00:00:00 2001 From: Riccardo Tempesta Date: Fri, 17 Aug 2018 17:34:27 +0200 Subject: [PATCH 004/912] Removed doctrine dependency --- .../Framework/Reflection/TypeProcessor.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php index 9bfeef83c9f6c..5ac88a6171b5d 100644 --- a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php +++ b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php @@ -6,7 +6,6 @@ namespace Magento\Framework\Reflection; -use Doctrine\Common\Annotations\TokenParser; use Magento\Framework\Exception\SerializationException; use Magento\Framework\Phrase; use Zend\Code\Reflection\ClassReflection; @@ -567,13 +566,22 @@ public function resolveFullyQualifiedClassName(ClassReflection $sourceClass, str unset($e); } - // Resolve fully qualified name + // Extract alias mapping $sourceFileName = $sourceClass->getDeclaringFile(); - $source = $sourceFileName->getContents(); - $parser = new TokenParser($source); + $aliases = []; + foreach ($sourceFileName->getUses() as $use) { + if ($use['as'] !== null) { + $aliases[$use['as']] = $use['use']; + } else { + $pos = strrpos($use['use'], '\\'); + + $aliasName = substr($use['use'], $pos + 1); + $aliases[$aliasName] = $use['use']; + } + } + // Resolve FQN $namespace = $sourceClass->getNamespaceName(); - $aliases = $parser->parseUseStatements($namespace); $pos = strpos($typeName, '\\'); if ($pos === 0) { @@ -588,7 +596,6 @@ public function resolveFullyQualifiedClassName(ClassReflection $sourceClass, str $partialClassName = substr($typeName, $pos); } - $namespacePrefix = strtolower($namespacePrefix); if (isset($aliases[$namespacePrefix])) { return $aliases[$namespacePrefix] . $partialClassName . $arraySuffix; } From 8832267ac724434fc661ab71f59429cbc62d0e7b Mon Sep 17 00:00:00 2001 From: Volodymyr Kublytskyi Date: Thu, 13 Sep 2018 18:03:30 +0300 Subject: [PATCH 005/912] magento/payment-improvements#1: Add Brazilian Credit Cards Support - formatting of pattern to match code style requirements --- .../credit-card-number-validator/credit-card-type.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js b/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js index b438371cc24a5..1b387b384104f 100644 --- a/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js +++ b/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js @@ -125,7 +125,16 @@ define([ { title: 'Elo', type: 'ELO', - pattern: '^((509091)|(636368)|(636297)|(504175)|(438935)|(40117[8-9])|(45763[1-2])|(457393)|(431274)|(50990[0-2])|(5099[7-9][0-9])|(50996[4-9])|(509[1-8][0-9][0-9])|(5090(0[0-2]|0[4-9]|1[2-9]|[24589][0-9]|3[1-9]|6[0-46-9]|7[0-24-9]))|(5067(0[0-24-8]|1[0-24-9]|2[014-9]|3[0-379]|4[0-9]|5[0-3]|6[0-5]|7[0-8]))|(6504(0[5-9]|1[0-9]|2[0-9]|3[0-9]))|(6504(8[5-9]|9[0-9])|6505(0[0-9]|1[0-9]|2[0-9]|3[0-8]))|(6505(4[1-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-8]))|(6507(0[0-9]|1[0-8]))|(65072[0-7])|(6509(0[1-9]|1[0-9]|20))|(6516(5[2-9]|6[0-9]|7[0-9]))|(6550(0[0-9]|1[0-9]))|(6550(2[1-9]|3[0-9]|4[0-9]|5[0-8])))\\d*$', + pattern: '^((509091)|(636368)|(636297)|(504175)|(438935)|(40117[8-9])|(45763[1-2])|' + + '(457393)|(431274)|(50990[0-2])|(5099[7-9][0-9])|(50996[4-9])|(509[1-8][0-9][0-9])|' + + '(5090(0[0-2]|0[4-9]|1[2-9]|[24589][0-9]|3[1-9]|6[0-46-9]|7[0-24-9]))|' + + '(5067(0[0-24-8]|1[0-24-9]|2[014-9]|3[0-379]|4[0-9]|5[0-3]|6[0-5]|7[0-8]))|' + + '(6504(0[5-9]|1[0-9]|2[0-9]|3[0-9]))|' + + '(6504(8[5-9]|9[0-9])|6505(0[0-9]|1[0-9]|2[0-9]|3[0-8]))|' + + '(6505(4[1-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-8]))|' + + '(6507(0[0-9]|1[0-8]))|(65072[0-7])|(6509(0[1-9]|1[0-9]|20))|' + + '(6516(5[2-9]|6[0-9]|7[0-9]))|(6550(0[0-9]|1[0-9]))|' + + '(6550(2[1-9]|3[0-9]|4[0-9]|5[0-8])))\\d*$', gaps: [4, 8, 12], lengths: [16], code: { From 6ffb464c3e8a11791aea875a2e8cb6629c7ac51e Mon Sep 17 00:00:00 2001 From: Volodymyr Kublytskyi Date: Thu, 13 Sep 2018 18:14:27 +0300 Subject: [PATCH 006/912] magento/payment-improvements#1: Add Brazilian Credit Cards Support - added patterns for Brazilian cards to validator --- app/code/Magento/Payment/Model/Method/Cc.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index c23ad5b535dd8..06661469014a5 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -148,6 +148,22 @@ public function validate() 'JCB' => '/^35(2[8-9][0-9]{12,15}|[3-8][0-9]{13,16})/', 'MI' => '/^(5(0|[6-9])|63|67(?!59|6770|6774))\d*$/', 'MD' => '/^(6759(?!24|38|40|6[3-9]|70|76)|676770|676774)\d*$/', + + //Hipercard + 'HC' => '/^((606282)|(637095)|(637568)|(637599)|(637609)|(637612))\d*$/', + //Elo + 'ELO' => '/^((509091)|(636368)|(636297)|(504175)|(438935)|(40117[8-9])|(45763[1-2])|' . + '(457393)|(431274)|(50990[0-2])|(5099[7-9][0-9])|(50996[4-9])|(509[1-8][0-9][0-9])|' . + '(5090(0[0-2]|0[4-9]|1[2-9]|[24589][0-9]|3[1-9]|6[0-46-9]|7[0-24-9]))|' . + '(5067(0[0-24-8]|1[0-24-9]|2[014-9]|3[0-379]|4[0-9]|5[0-3]|6[0-5]|7[0-8]))|' . + '(6504(0[5-9]|1[0-9]|2[0-9]|3[0-9]))|' . + '(6504(8[5-9]|9[0-9])|6505(0[0-9]|1[0-9]|2[0-9]|3[0-8]))|' . + '(6505(4[1-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-8]))|' . + '(6507(0[0-9]|1[0-8]))|(65072[0-7])|(6509(0[1-9]|1[0-9]|20))|' . + '(6516(5[2-9]|6[0-9]|7[0-9]))|(6550(0[0-9]|1[0-9]))|' . + '(6550(2[1-9]|3[0-9]|4[0-9]|5[0-8])))\d*$/', + //Aura + 'AU' => '/^5078\d*$/' ]; $ccNumAndTypeMatches = isset( From 9532df60963c9fceeff5884b8e805c694b2a2393 Mon Sep 17 00:00:00 2001 From: Dzmitry Tabusheu Date: Fri, 21 Sep 2018 13:53:49 +0300 Subject: [PATCH 007/912] MAGETWO-91631: [Magento Cloud]Prefix in checkout not starting with blank value - Changed attribute validation class retrieving algorithm --- app/code/Magento/Customer/Block/Widget/Name.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Customer/Block/Widget/Name.php b/app/code/Magento/Customer/Block/Widget/Name.php index d50045f4a4092..6f1b051af7465 100644 --- a/app/code/Magento/Customer/Block/Widget/Name.php +++ b/app/code/Magento/Customer/Block/Widget/Name.php @@ -55,7 +55,7 @@ public function __construct( } /** - * @return void + * @inheritdoc */ public function _construct() { @@ -245,10 +245,13 @@ public function getStoreLabel($attributeCode) */ public function getAttributeValidationClass($attributeCode) { - return $this->_addressHelper->getAttributeValidationClass($attributeCode); + $attributeMetadata = $this->_getAttribute($attributeCode); + return $attributeMetadata ? $attributeMetadata->getFrontendClass() : ''; } /** + * Check if attribute is required + * * @param string $attributeCode * @return bool */ @@ -259,6 +262,8 @@ private function _isAttributeRequired($attributeCode) } /** + * Check if attribute is visible + * * @param string $attributeCode * @return bool */ From 1530c69c642797ae87c68292559422b1fede627e Mon Sep 17 00:00:00 2001 From: Riccardo Tempesta Date: Mon, 8 Oct 2018 15:01:36 +0200 Subject: [PATCH 008/912] Unhandled refrelction exception when __construct method is missing --- .../Magento/Framework/Webapi/ServiceInputProcessor.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php index f1a2e4f2bc704..45d6b8ad91e62 100644 --- a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php +++ b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php @@ -175,7 +175,12 @@ private function getConstructorData(string $className, array $data): array $preferenceClass = $this->config->getPreference($className); $class = new ClassReflection($preferenceClass ?: $className); - $constructor = $class->getMethod('__construct'); + try { + $constructor = $class->getMethod('__construct'); + } catch (\ReflectionException $e) { + $constructor = null; + } + if ($constructor === null) { return []; } From 3d0cb544198b74e1294ebc5bee1f995dcde101b1 Mon Sep 17 00:00:00 2001 From: Riccardo Tempesta Date: Tue, 9 Oct 2018 14:02:07 +0200 Subject: [PATCH 009/912] FIX CS: missing phpdoc --- lib/internal/Magento/Framework/Reflection/TypeProcessor.php | 1 + .../Magento/Framework/Webapi/ServiceInputProcessor.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php index 5ac88a6171b5d..ada061d933afe 100644 --- a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php +++ b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php @@ -537,6 +537,7 @@ public function getParamType(ParameterReflection $param) /** * Resolve fully qualified type name in the class alias context + * * @param ClassReflection $sourceClass * @param string $typeName * @return string diff --git a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php index 45d6b8ad91e62..a9b553f6dd6f9 100644 --- a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php +++ b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php @@ -165,10 +165,13 @@ public function process($serviceClassName, $serviceMethodName, array $inputArray } /** + * Retrieve constructor data + * * @param string $className * @param array $data * @return array * @throws \ReflectionException + * @throws \Magento\Framework\Exception\LocalizedException */ private function getConstructorData(string $className, array $data): array { From 22a40ccdbcd699fcc61be1330611f70126744f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karla=20Saarem=C3=A4e?= Date: Fri, 19 Oct 2018 19:29:10 +0300 Subject: [PATCH 010/912] text showing feature added feature to show text when icon is set to false --- lib/web/css/source/lib/_icons.less | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/lib/web/css/source/lib/_icons.less b/lib/web/css/source/lib/_icons.less index d113935e2b1cd..08e4798426343 100644 --- a/lib/web/css/source/lib/_icons.less +++ b/lib/web/css/source/lib/_icons.less @@ -25,9 +25,12 @@ @_icon-font-text-hide: @icon-font__text-hide, @_icon-font-display: @icon-font__display ) when (@_icon-font-position = before) { - ._lib-icon-text-hide(@_icon-font-text-hide); .lib-css(display, @_icon-font-display); - text-decoration: none; + text-decoration: none; + + & when not (@_icon-font-content = false) { + ._lib-icon-text-hide(@_icon-font-text-hide); + } &:before { ._lib-icon-font( @@ -68,10 +71,13 @@ @_icon-font-text-hide: @icon-font__text-hide, @_icon-font-display: @icon-font__display ) when (@_icon-font-position = after) { - ._lib-icon-text-hide(@_icon-font-text-hide); .lib-css(display, @_icon-font-display); text-decoration: none; - + + & when not (@_icon-font-content = false) { + ._lib-icon-text-hide(@_icon-font-text-hide); + } + &:after { ._lib-icon-font( @_icon-font-content, @@ -151,8 +157,11 @@ @_icon-image-text-hide: @icon__text-hide ) when (@_icon-image-position = before) { display: inline-block; - ._lib-icon-text-hide(@_icon-image-text-hide); - + + & when not (@_icon-image = false) { + ._lib-icon-text-hide(@_icon-font-text-hide); + } + &:before { ._lib-icon-image( @_icon-image, @@ -179,7 +188,10 @@ @_icon-image-text-hide: @icon__text-hide ) when (@_icon-image-position = after) { display: inline-block; - ._lib-icon-text-hide(@_icon-image-text-hide); + + & when not (@_icon-image = false) { + ._lib-icon-text-hide(@_icon-font-text-hide); + } &:after { ._lib-icon-image( From 2232338efacc5288dcc3c0dcaa6e00f204e93762 Mon Sep 17 00:00:00 2001 From: Eugene Shakhsuvarov Date: Sun, 21 Oct 2018 16:29:46 +0200 Subject: [PATCH 011/912] FIX resolveFullyQualifiedClassName as private method Co-Authored-By: phoenix128 --- lib/internal/Magento/Framework/Reflection/TypeProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php index ada061d933afe..b7db1deb131b4 100644 --- a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php +++ b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php @@ -542,7 +542,7 @@ public function getParamType(ParameterReflection $param) * @param string $typeName * @return string */ - public function resolveFullyQualifiedClassName(ClassReflection $sourceClass, string $typeName): string + private function resolveFullyQualifiedClassName(ClassReflection $sourceClass, string $typeName): string { $typeName = trim($typeName); From 4b9b8a3f533c017ab7ba9c8ac2f52bb47777a6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karla=20Saarem=C3=A4e?= Date: Tue, 23 Oct 2018 20:05:05 +0300 Subject: [PATCH 012/912] Update _icons.less fix typo --- lib/web/css/source/lib/_icons.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/css/source/lib/_icons.less b/lib/web/css/source/lib/_icons.less index 08e4798426343..abb8b43368f13 100644 --- a/lib/web/css/source/lib/_icons.less +++ b/lib/web/css/source/lib/_icons.less @@ -159,7 +159,7 @@ display: inline-block; & when not (@_icon-image = false) { - ._lib-icon-text-hide(@_icon-font-text-hide); + ._lib-icon-text-hide(@_icon-image-text-hide); } &:before { From e858f36eb99de3d78129cc1916c4c2b6d64caaca Mon Sep 17 00:00:00 2001 From: Riccardo Tempesta Date: Wed, 24 Oct 2018 12:58:03 +0200 Subject: [PATCH 013/912] resolveFullyQualifiedClassName refactor and test coverage --- .../Unit/Fixture/UseClasses/SampleOne.php | 13 ++ .../UseClasses/SampleOne/SampleThree.php | 13 ++ .../Unit/Fixture/UseClasses/SampleTwo.php | 13 ++ .../UseClasses/SampleTwo/SampleFour.php | 13 ++ .../Test/Unit/Fixture/UseSample.php | 16 ++ .../Test/Unit/TypeProcessorTest.php | 167 ++++++++++++++++++ .../Framework/Reflection/TypeProcessor.php | 140 +++++++++++---- 7 files changed, 336 insertions(+), 39 deletions(-) create mode 100644 lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/UseClasses/SampleOne.php create mode 100644 lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/UseClasses/SampleOne/SampleThree.php create mode 100644 lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/UseClasses/SampleTwo.php create mode 100644 lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/UseClasses/SampleTwo/SampleFour.php create mode 100644 lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/UseSample.php diff --git a/lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/UseClasses/SampleOne.php b/lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/UseClasses/SampleOne.php new file mode 100644 index 0000000000000..6382f4b247072 --- /dev/null +++ b/lib/internal/Magento/Framework/Reflection/Test/Unit/Fixture/UseClasses/SampleOne.php @@ -0,0 +1,13 @@ +getMethod('getName'); $this->typeProcessor->getGetterReturnType($methodReflection); } + + /** + * Simple and complex data provider + * + * @return array + */ + public function simpleAndComplexDataProvider(): array + { + return [ + ['string', true], + ['array', true], + ['int', true], + ['SomeClass', false], + ['\\My\\Namespace\\Model\\Class', false], + ['Some\\Other\\Class', false], + ]; + } + + /** + * Test simple type detection method + * + * @dataProvider simpleAndComplexDataProvider + * @param string $type + * @param bool $expectedValue + */ + public function testIsSimpleType(string $type, bool $expectedValue) + { + self::assertEquals($expectedValue, $this->typeProcessor->isSimpleType($type)); + } + + /** + * Simple and complex data provider + * + * @return array + */ + public function basicClassNameProvider(): array + { + return [ + ['SomeClass[]', 'SomeClass'], + ['\\My\\Namespace\\Model\\Class[]', '\\My\\Namespace\\Model\\Class'], + ['Some\\Other\\Class[]', 'Some\\Other\\Class'], + ['SomeClass', 'SomeClass'], + ['\\My\\Namespace\\Model\\Class', '\\My\\Namespace\\Model\\Class'], + ['Some\\Other\\Class', 'Some\\Other\\Class'], + ]; + } + + /** + * Extract basic class name + * + * @dataProvider basicClassNameProvider + * @param string $type + * @param string $expectedValue + */ + public function testBasicClassName(string $type, string $expectedValue) + { + self::assertEquals($expectedValue, $this->typeProcessor->getBasicClassName($type)); + } + + /** + * Fully qualified class names data provider + * + * @return array + */ + public function isFullyQualifiedClassNamesDataProvider(): array + { + return [ + ['SomeClass', false], + ['\\My\\Namespace\\Model\\Class', true], + ['Some\\Other\\Class', false], + ]; + } + + /** + * Test fully qualified class name detector + * + * @dataProvider isFullyQualifiedClassNamesDataProvider + * @param string $type + * @param bool $expectedValue + */ + public function testIsFullyQualifiedClassName(string $type, bool $expectedValue) + { + self::assertEquals($expectedValue, $this->typeProcessor->isFullyQualifiedClassName($type)); + } + + /** + * Test alias mapping + */ + public function testGetAliasMapping() + { + $sourceClass = new ClassReflection(UseSample::class); + $aliasMap = $this->typeProcessor->getAliasMapping($sourceClass); + + self::assertEquals([ + 'SampleOne' => SampleOne::class, + 'Sample2' => SampleTwo::class, + ], $aliasMap); + } + + /** + * Resolve fully qualified class names data provider + * + * @return array + */ + public function resolveFullyQualifiedClassNamesDataProvider(): array + { + return [ + [UseSample::class, 'string', 'string'], + [UseSample::class, 'string[]', 'string[]'], + + [UseSample::class, 'SampleOne', SampleOne::class], + [UseSample::class, 'Sample2', SampleTwo::class], + [UseSample::class, '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\SampleOne', SampleOne::class], + [UseSample::class, '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\SampleTwo', SampleTwo::class], + [UseSample::class, 'UseClasses\\SampleOne', SampleOne::class], + [UseSample::class, 'UseClasses\\SampleTwo', SampleTwo::class], + + [UseSample::class, 'SampleOne[]', SampleOne::class . '[]'], + [UseSample::class, 'Sample2[]', SampleTwo::class . '[]'], + [UseSample::class, '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\SampleOne[]', SampleOne::class . '[]'], + [UseSample::class, '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\SampleTwo[]', SampleTwo::class . '[]'], + [UseSample::class, 'UseClasses\\SampleOne[]', SampleOne::class . '[]'], + [UseSample::class, 'UseClasses\\SampleTwo[]', SampleTwo::class . '[]'], + + [UseSample::class, 'SampleOne\SampleThree', SampleThree::class], + [UseSample::class, 'SampleOne\SampleThree[]', SampleThree::class . '[]'], + + [UseSample::class, 'Sample2\SampleFour', SampleFour::class], + [UseSample::class, 'Sample2\SampleFour[]', SampleFour::class . '[]'], + + [UseSample::class, 'Sample2\NotExisting', 'Sample2\NotExisting'], + [UseSample::class, 'Sample2\NotExisting[]', 'Sample2\NotExisting[]'], + + [ + UseSample::class, + '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\NotExisting', + 'Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\NotExisting' + ], + [ + UseSample::class, + '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\NotExisting[]', + 'Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\NotExisting[]' + ], + ]; + } + + /** + * Resolve fully qualified class names + * + * @dataProvider resolveFullyQualifiedClassNamesDataProvider + * @param string $className + * @param string $type + * @param string $expectedValue + * @throws \ReflectionException + */ + public function testResolveFullyQualifiedClassNames(string $className, string $type, string $expectedValue) + { + $sourceClass = new ClassReflection($className); + $fullyQualified = $this->typeProcessor->resolveFullyQualifiedClassName($sourceClass, $type); + + self::assertEquals($expectedValue, $fullyQualified); + } } diff --git a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php index b7db1deb131b4..c3c44109b7849 100644 --- a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php +++ b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php @@ -536,38 +536,13 @@ public function getParamType(ParameterReflection $param) } /** - * Resolve fully qualified type name in the class alias context + * Get alias mapping for source class * * @param ClassReflection $sourceClass - * @param string $typeName - * @return string + * @return array */ - private function resolveFullyQualifiedClassName(ClassReflection $sourceClass, string $typeName): string + public function getAliasMapping(ClassReflection $sourceClass): array { - $typeName = trim($typeName); - - // Not a class, but a basic type - if ((strtolower($typeName[0])) === $typeName[0]) { - return $typeName; - } - - // Split array suffix - if (preg_match('/^(.+?)\[\]$/', $typeName, $matches)) { - $typeName = $matches[1]; - $arraySuffix = '[]'; - } else { - $arraySuffix = ''; - } - - // If class exists, then return it - try { - new ClassReflection($typeName); - return $typeName . $arraySuffix; - } catch (\ReflectionException $e) { - unset($e); - } - - // Extract alias mapping $sourceFileName = $sourceClass->getDeclaringFile(); $aliases = []; foreach ($sourceFileName->getUses() as $use) { @@ -581,27 +556,114 @@ private function resolveFullyQualifiedClassName(ClassReflection $sourceClass, st } } - // Resolve FQN - $namespace = $sourceClass->getNamespaceName(); + return $aliases; + } - $pos = strpos($typeName, '\\'); - if ($pos === 0) { - return substr($typeName, 1); - } + /** + * Return true if the passed type is a simple type + * + * eg.: + * Return true with; array, string, ... + * Return false with: SomeClassName + * + * @param string $typeName + * @return bool + */ + public function isSimpleType(string $typeName): bool + { + return strtolower($typeName) === $typeName; + } + + /** + * Get basic type for a class name + * + * eg.: + * SomeClassName[] => SomeClassName + * + * @param string $className + * @return string + */ + public function getBasicClassName(string $className): string + { + $pos = strpos($className, '['); + return ($pos === false) ? $className : substr($className, 0, $pos); + } + + /** + * Return true if it is a FQ class name + * + * eg.: + * SomeClassName => false + * \My\NameSpace\SomeClassName => true + * + * @param string $className + * @return bool + */ + public function isFullyQualifiedClassName(string $className): bool + { + return strpos($className, '\\') === 0; + } + /** + * Get aliased class name + * + * @param string $className + * @param string $namespace + * @param array $aliases + * @return string + */ + private function getAliasedClassName(string $className, string $namespace, array $aliases): string + { + $pos = strpos($className, '\\'); if ($pos === false) { - $namespacePrefix = $typeName; + $namespacePrefix = $className; $partialClassName = ''; } else { - $namespacePrefix = substr($typeName, 0, $pos); - $partialClassName = substr($typeName, $pos); + $namespacePrefix = substr($className, 0, $pos); + $partialClassName = substr($className, $pos); } if (isset($aliases[$namespacePrefix])) { - return $aliases[$namespacePrefix] . $partialClassName . $arraySuffix; + return $aliases[$namespacePrefix] . $partialClassName; + } + + return $namespace . '\\' . $className; + } + + /** + * Resolve fully qualified type name in the class alias context + * + * @param ClassReflection $sourceClass + * @param string $typeName + * @return string + */ + public function resolveFullyQualifiedClassName(ClassReflection $sourceClass, string $typeName): string + { + $typeName = trim($typeName); + + // Simple way to understand it is a basic type or a class name + if ($this->isSimpleType($typeName)) { + return $typeName; + } + + $basicTypeName = $this->getBasicClassName($typeName); + + // Already a FQN class name + if ($this->isFullyQualifiedClassName($basicTypeName)) { + return substr($typeName, 1); } - return $namespace . '\\' . $typeName . $arraySuffix; + $isArray = $this->isArrayType($typeName); + $aliases = $this->getAliasMapping($sourceClass); + + $namespace = $sourceClass->getNamespaceName(); + $fqClassName = $this->getAliasedClassName($basicTypeName, $namespace, $aliases); + + if (class_exists($fqClassName)) { + return $fqClassName . ($isArray ? '[]' : ''); + } + + return $typeName; } /** From 13353c84e3476a2be67521028a1b1c63a9f79cd1 Mon Sep 17 00:00:00 2001 From: Riccardo Tempesta Date: Wed, 24 Oct 2018 17:12:23 +0200 Subject: [PATCH 014/912] Missing check with interface --- lib/internal/Magento/Framework/Reflection/TypeProcessor.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php index c3c44109b7849..6e99d8137f22b 100644 --- a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php +++ b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php @@ -657,9 +657,9 @@ public function resolveFullyQualifiedClassName(ClassReflection $sourceClass, str $aliases = $this->getAliasMapping($sourceClass); $namespace = $sourceClass->getNamespaceName(); - $fqClassName = $this->getAliasedClassName($basicTypeName, $namespace, $aliases); + $fqClassName = '\\' . $this->getAliasedClassName($basicTypeName, $namespace, $aliases); - if (class_exists($fqClassName)) { + if (interface_exists($fqClassName) || class_exists($fqClassName)) { return $fqClassName . ($isArray ? '[]' : ''); } From 25a5e5be1aac07521317ab891cfcb7eaf407fa37 Mon Sep 17 00:00:00 2001 From: Riccardo Tempesta Date: Wed, 24 Oct 2018 17:12:36 +0200 Subject: [PATCH 015/912] Missing FQ class names support for return types --- .../Webapi/ServiceOutputProcessor.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Webapi/ServiceOutputProcessor.php b/lib/internal/Magento/Framework/Webapi/ServiceOutputProcessor.php index cdb6ed799aade..224421d6561c8 100644 --- a/lib/internal/Magento/Framework/Webapi/ServiceOutputProcessor.php +++ b/lib/internal/Magento/Framework/Webapi/ServiceOutputProcessor.php @@ -7,8 +7,11 @@ use Magento\Framework\Api\AbstractExtensibleObject; use Magento\Framework\Api\ExtensibleDataObjectConverter; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Reflection\DataObjectProcessor; use Magento\Framework\Reflection\MethodsMap; +use Magento\Framework\Reflection\TypeProcessor; +use Zend\Code\Reflection\ClassReflection; /** * Data object converter @@ -27,16 +30,24 @@ class ServiceOutputProcessor implements ServicePayloadConverterInterface */ protected $methodsMapProcessor; + /** + * @var TypeProcessor|null + */ + private $typeProcessor; + /** * @param DataObjectProcessor $dataObjectProcessor * @param MethodsMap $methodsMapProcessor + * @param TypeProcessor|null $typeProcessor */ public function __construct( DataObjectProcessor $dataObjectProcessor, - MethodsMap $methodsMapProcessor + MethodsMap $methodsMapProcessor, + TypeProcessor $typeProcessor = null ) { $this->dataObjectProcessor = $dataObjectProcessor; $this->methodsMapProcessor = $methodsMapProcessor; + $this->typeProcessor = $typeProcessor ?: ObjectManager::getInstance()->get(TypeProcessor::class); } /** @@ -57,6 +68,12 @@ public function process($data, $serviceClassName, $serviceMethodName) { /** @var string $dataType */ $dataType = $this->methodsMapProcessor->getMethodReturnType($serviceClassName, $serviceMethodName); + + if (class_exists($serviceClassName) || interface_exists($serviceClassName)) { + $sourceClass = new ClassReflection($serviceClassName); + $dataType = $this->typeProcessor->resolveFullyQualifiedClassName($sourceClass, $dataType); + } + return $this->convertValue($data, $dataType); } From 229a29aff8bd66d5ad18090a7478608c7d0ab753 Mon Sep 17 00:00:00 2001 From: Riccardo Tempesta Date: Thu, 25 Oct 2018 09:45:48 +0200 Subject: [PATCH 016/912] Missing prefix "\" for FQ class names --- .../Test/Unit/TypeProcessorTest.php | 54 ++++++++++++------- .../Framework/Reflection/TypeProcessor.php | 2 +- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php b/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php index 0036066543d37..a2f9eb5474da3 100644 --- a/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php +++ b/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php @@ -284,7 +284,7 @@ public function arrayParamTypeDataProvider() { return [ ['method name' => 'addData', 'type' => 'array[]'], - ['method name' => 'addObjectList', 'type' => TSampleInterface::class . '[]'] + ['method name' => 'addObjectList', 'type' => '\\' . TSampleInterface::class . '[]'] ]; } @@ -470,25 +470,41 @@ public function resolveFullyQualifiedClassNamesDataProvider(): array [UseSample::class, 'string', 'string'], [UseSample::class, 'string[]', 'string[]'], - [UseSample::class, 'SampleOne', SampleOne::class], - [UseSample::class, 'Sample2', SampleTwo::class], - [UseSample::class, '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\SampleOne', SampleOne::class], - [UseSample::class, '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\SampleTwo', SampleTwo::class], - [UseSample::class, 'UseClasses\\SampleOne', SampleOne::class], - [UseSample::class, 'UseClasses\\SampleTwo', SampleTwo::class], + [UseSample::class, 'SampleOne', '\\' . SampleOne::class], + [UseSample::class, 'Sample2', '\\' . SampleTwo::class], + [ + UseSample::class, + '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\SampleOne', + '\\' . SampleOne::class + ], + [ + UseSample::class, + '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\SampleTwo', + '\\' . SampleTwo::class + ], + [UseSample::class, 'UseClasses\\SampleOne', '\\' . SampleOne::class], + [UseSample::class, 'UseClasses\\SampleTwo', '\\' . SampleTwo::class], - [UseSample::class, 'SampleOne[]', SampleOne::class . '[]'], - [UseSample::class, 'Sample2[]', SampleTwo::class . '[]'], - [UseSample::class, '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\SampleOne[]', SampleOne::class . '[]'], - [UseSample::class, '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\SampleTwo[]', SampleTwo::class . '[]'], - [UseSample::class, 'UseClasses\\SampleOne[]', SampleOne::class . '[]'], - [UseSample::class, 'UseClasses\\SampleTwo[]', SampleTwo::class . '[]'], + [UseSample::class, 'SampleOne[]', '\\' . SampleOne::class . '[]'], + [UseSample::class, 'Sample2[]', '\\' . SampleTwo::class . '[]'], + [ + UseSample::class, + '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\SampleOne[]', + '\\' . SampleOne::class . '[]' + ], + [ + UseSample::class, + '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\SampleTwo[]', + '\\' . SampleTwo::class . '[]' + ], + [UseSample::class, 'UseClasses\\SampleOne[]', '\\' . SampleOne::class . '[]'], + [UseSample::class, 'UseClasses\\SampleTwo[]', '\\' . SampleTwo::class . '[]'], - [UseSample::class, 'SampleOne\SampleThree', SampleThree::class], - [UseSample::class, 'SampleOne\SampleThree[]', SampleThree::class . '[]'], + [UseSample::class, 'SampleOne\SampleThree', '\\' . SampleThree::class], + [UseSample::class, 'SampleOne\SampleThree[]', '\\' . SampleThree::class . '[]'], - [UseSample::class, 'Sample2\SampleFour', SampleFour::class], - [UseSample::class, 'Sample2\SampleFour[]', SampleFour::class . '[]'], + [UseSample::class, 'Sample2\SampleFour', '\\' . SampleFour::class], + [UseSample::class, 'Sample2\SampleFour[]', '\\' . SampleFour::class . '[]'], [UseSample::class, 'Sample2\NotExisting', 'Sample2\NotExisting'], [UseSample::class, 'Sample2\NotExisting[]', 'Sample2\NotExisting[]'], @@ -496,12 +512,12 @@ public function resolveFullyQualifiedClassNamesDataProvider(): array [ UseSample::class, '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\NotExisting', - 'Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\NotExisting' + '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\NotExisting' ], [ UseSample::class, '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\NotExisting[]', - 'Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\NotExisting[]' + '\\Magento\\Framework\\Reflection\\Test\\Unit\\Fixture\\UseClasses\\NotExisting[]' ], ]; } diff --git a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php index 6e99d8137f22b..b9f8ed6050708 100644 --- a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php +++ b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php @@ -650,7 +650,7 @@ public function resolveFullyQualifiedClassName(ClassReflection $sourceClass, str // Already a FQN class name if ($this->isFullyQualifiedClassName($basicTypeName)) { - return substr($typeName, 1); + return '\\' . substr($typeName, 1); } $isArray = $this->isArrayType($typeName); From 5e7e1daa5581a08623b1c4bafd9e41e15165d501 Mon Sep 17 00:00:00 2001 From: eugene-shab Date: Fri, 26 Oct 2018 14:10:39 +0300 Subject: [PATCH 017/912] addConfigurableProductsToCart --- .../AddConfigurableProductsToCart.php | 89 +++++++++++++++++++ .../etc/schema.graphqls | 35 ++++++++ 2 files changed, 124 insertions(+) create mode 100644 app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/AddConfigurableProductsToCart.php diff --git a/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/AddConfigurableProductsToCart.php b/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/AddConfigurableProductsToCart.php new file mode 100644 index 0000000000000..5b908835adbe8 --- /dev/null +++ b/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/AddConfigurableProductsToCart.php @@ -0,0 +1,89 @@ +arrayManager = $arrayManager; + $this->getCartForUser = $getCartForUser; + $this->addProductsToCart = $addProductsToCart; + $this->extractDataFromCart = $extractDataFromCart; + } + + /** + * @inheritdoc + */ + public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) + { + $cartHash = $this->arrayManager->get('input/cart_id', $args); + $cartItems = $this->arrayManager->get('input/cartItems', $args); + + if (!isset($cartHash)) { + throw new GraphQlInputException(__('Missing key "cart_id" in cart data')); + } + + if (!isset($cartItems) || !is_array($cartItems) || empty($cartItems)) { + throw new GraphQlInputException(__('Missing key "cartItems" in cart data')); + } + + $currentUserId = $context->getUserId(); + $cart = $this->getCartForUser->execute((string)$cartHash, $currentUserId); + + $this->addProductsToCart->execute($cart, $cartItems); + $cartData = $this->extractDataFromCart->execute($cart); + + return [ + 'cart' => $cartData, + ]; + } +} diff --git a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls index 267a94a1d434e..44ba8e7a957f6 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls +++ b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls @@ -1,5 +1,8 @@ # Copyright © Magento, Inc. All rights reserved. # See COPYING.txt for license details. +type Mutation { + addConfigurableProductsToCart(input: AddConfigurableProductsToCartInput): AddConfigurableProductsToCartOutput @resolver(class: "Magento\\ConfigurableProductGraphQl\\Model\\Resolver\\AddConfigurableProductsToCart") +} type ConfigurableProduct implements ProductInterface, PhysicalProductInterface, CustomizableProductInterface @doc(description: "ConfigurableProduct defines basic features of a configurable product and its simple product variants") { variants: [ConfigurableVariant] @doc(description: "An array of variants of products") @resolver(class: "Magento\\ConfigurableProductGraphQl\\Model\\Resolver\\ConfigurableVariant") @@ -35,3 +38,35 @@ type ConfigurableProductOptionsValues @doc(description: "ConfigurableProductOpti store_label: String @doc(description: "The label of the product on the current store") use_default_value: Boolean @doc(description: "Indicates whether to use the default_label") } + +input AddConfigurableProductsToCartInput { + cart_id: String! + cartItems: [ConfigurableProductCartItemInput!]! +} + +type AddConfigurableProductsToCartOutput { + cart: Cart! +} + +input ConfigurableProductCartItemInput { + data: CartItemDetailsInput! + variant_sku: String! + customizable_options:[CustomizableOptionInput!] +} + +type ConfigurableCartItem implements CartItemInterface { + customizable_options: [SelectedCustomizableOption]! + configurable_options: [SelectedConfigurableOption!]! +} + +type SelectedConfigurableOption { + id: Int! + option_label: String! + value_id: Int! + value_label: String! +} + +input CartItemDetailsInput { + sku: String! + qty: Float! +} From d5bece530c0b76c8a8bd97e1b0031b2c082a6fe5 Mon Sep 17 00:00:00 2001 From: eugene-shab Date: Fri, 26 Oct 2018 15:01:13 +0300 Subject: [PATCH 018/912] Updated PHPDoc Comments --- app/code/Magento/QuoteGraphQl/Model/Cart/AddProductsToCart.php | 2 ++ .../Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php | 1 + 2 files changed, 3 insertions(+) diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/AddProductsToCart.php b/app/code/Magento/QuoteGraphQl/Model/Cart/AddProductsToCart.php index 96259f2264943..005cf3a10ca80 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/AddProductsToCart.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/AddProductsToCart.php @@ -45,6 +45,8 @@ public function __construct( * @param Quote $cart * @param array $cartItems * @throws GraphQlInputException + * @throws \Magento\Framework\Exception\LocalizedException + * @throws \Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException */ public function execute(Quote $cart, array $cartItems): void { diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php b/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php index aa5b41daebdc3..2303d2aa14f03 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php @@ -61,6 +61,7 @@ public function __construct( * @return void * @throws GraphQlNoSuchEntityException * @throws GraphQlInputException + * @throws \Magento\Framework\Exception\LocalizedException */ public function execute(Quote $cart, array $cartItemData): void { From 109a44b7565641e42522c1fb1a77510a5d4b8ad9 Mon Sep 17 00:00:00 2001 From: eugene-shab Date: Fri, 26 Oct 2018 15:07:27 +0300 Subject: [PATCH 019/912] Move CartItemDetailsInput to quote scheme. --- .../Magento/ConfigurableProductGraphQl/etc/schema.graphqls | 5 ----- app/code/Magento/QuoteGraphQl/etc/schema.graphqls | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls index 44ba8e7a957f6..12841a6e45101 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls +++ b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls @@ -65,8 +65,3 @@ type SelectedConfigurableOption { value_id: Int! value_label: String! } - -input CartItemDetailsInput { - sku: String! - qty: Float! -} diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index f692aa57b2180..763f4031c7c33 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -94,3 +94,8 @@ type CartItemSelectedOptionValuePrice { units: String! type: PriceTypeEnum! } + +input CartItemDetailsInput { + sku: String! + qty: Float! +} From a8f662ebe2ed6a190ea34d407a6085678add93f0 Mon Sep 17 00:00:00 2001 From: Wiard van Rij Date: Sat, 27 Oct 2018 03:08:48 +0200 Subject: [PATCH 020/912] Changes log info on varnish purges --- .../Magento/CacheInvalidate/Model/PurgeCache.php | 14 ++++++++++++-- .../Magento/Framework/Cache/InvalidateLogger.php | 6 ++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php index 727e18280d76f..293f82ef67f7d 100644 --- a/app/code/Magento/CacheInvalidate/Model/PurgeCache.php +++ b/app/code/Magento/CacheInvalidate/Model/PurgeCache.php @@ -118,6 +118,7 @@ private function splitTags($tagsPattern) private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedTagsChunk) { $headers = [self::HEADER_X_MAGENTO_TAGS_PATTERN => $formattedTagsChunk]; + $unresponsiveServerCount = 0; foreach ($servers as $server) { $headers['Host'] = $server->getHost(); try { @@ -131,10 +132,19 @@ private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedT $socketAdapter->read(); $socketAdapter->close(); } catch (\Exception $e) { - $this->logger->critical($e->getMessage(), compact('server', 'formattedTagsChunk')); - return false; + $unresponsiveServerCount++; + if ($unresponsiveServerCount == count($servers)) { + $this->logger->critical('Available cache server(s) are unresponsive: ' . $e->getMessage(), compact('server', + 'formattedTagsChunk')); + return false; + } else { + $this->logger->warning('Unresponsive cache server hit, yet more cache servers are available: ' . + $e->getMessage(), compact('server', 'formattedTagsChunk')); + continue; + } } } + $this->logger->execute(compact('servers', 'formattedTagsChunk')); return true; } diff --git a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php index 10886f911e295..c440d3c03ecc5 100644 --- a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php +++ b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php @@ -65,4 +65,10 @@ public function critical($message, $params) { $this->logger->critical($message, $this->makeParams($params)); } + + public function warning($message, $params) + { + $this->logger->warning($message, $this->makeParams($params)); + } + } From 04aa94e7062eab740d88c814277e08e0458596a1 Mon Sep 17 00:00:00 2001 From: Wiard van Rij Date: Sat, 27 Oct 2018 03:10:31 +0200 Subject: [PATCH 021/912] Add docblock --- lib/internal/Magento/Framework/Cache/InvalidateLogger.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php index c440d3c03ecc5..60817c281880d 100644 --- a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php +++ b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php @@ -66,6 +66,13 @@ public function critical($message, $params) $this->logger->critical($message, $this->makeParams($params)); } + /** + * Log warning + * + * @param string $message + * @param mixed $params + * @return void + */ public function warning($message, $params) { $this->logger->warning($message, $this->makeParams($params)); From 583ac3683361b823757d2ce1221825bff4a8aa61 Mon Sep 17 00:00:00 2001 From: eugene-shab Date: Mon, 29 Oct 2018 14:39:45 +0200 Subject: [PATCH 022/912] Fix hard depends. --- app/code/Magento/ConfigurableProductGraphQl/composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/ConfigurableProductGraphQl/composer.json b/app/code/Magento/ConfigurableProductGraphQl/composer.json index a22df27734b76..0f0bd5d70a4c2 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/composer.json +++ b/app/code/Magento/ConfigurableProductGraphQl/composer.json @@ -7,6 +7,7 @@ "magento/module-catalog": "*", "magento/module-configurable-product": "*", "magento/module-catalog-graph-ql": "*", + "magento/module-quote-graph-ql": "*", "magento/framework": "*" }, "license": [ From c0df2e42bdd4d30c1db58d62bfba2b2781531c27 Mon Sep 17 00:00:00 2001 From: Denis Papec Date: Wed, 31 Oct 2018 21:30:42 +0000 Subject: [PATCH 023/912] Fix for currency update in crontab area --- app/code/Magento/Directory/Model/CurrencyConfig.php | 2 +- .../Directory/Test/Unit/Model/CurrencyConfigTest.php | 5 +++-- .../Magento/Directory/Model/CurrencyConfigTest.php | 12 ++++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Directory/Model/CurrencyConfig.php b/app/code/Magento/Directory/Model/CurrencyConfig.php index fdb561c224170..f7230df6e86ea 100644 --- a/app/code/Magento/Directory/Model/CurrencyConfig.php +++ b/app/code/Magento/Directory/Model/CurrencyConfig.php @@ -57,7 +57,7 @@ public function __construct( */ public function getConfigCurrencies(string $path) { - $result = $this->appState->getAreaCode() === Area::AREA_ADMINHTML + $result = in_array($this->appState->getAreaCode(), [Area::AREA_ADMINHTML, Area::AREA_CRONTAB]) ? $this->getConfigForAllStores($path) : $this->getConfigForCurrentStore($path); sort($result); diff --git a/app/code/Magento/Directory/Test/Unit/Model/CurrencyConfigTest.php b/app/code/Magento/Directory/Test/Unit/Model/CurrencyConfigTest.php index 9b52bae26f90f..e594be90b26dd 100644 --- a/app/code/Magento/Directory/Test/Unit/Model/CurrencyConfigTest.php +++ b/app/code/Magento/Directory/Test/Unit/Model/CurrencyConfigTest.php @@ -68,7 +68,7 @@ protected function setUp() } /** - * Test get currency config for admin and storefront areas. + * Test get currency config for admin, crontab and storefront areas. * * @dataProvider getConfigCurrenciesDataProvider * @return void @@ -91,7 +91,7 @@ public function testGetConfigCurrencies(string $areCode) ->method('getCode') ->willReturn('testCode'); - if ($areCode === Area::AREA_ADMINHTML) { + if (in_array($areCode, [Area::AREA_ADMINHTML, Area::AREA_CRONTAB])) { $this->storeManager->expects(self::once()) ->method('getStores') ->willReturn([$store]); @@ -121,6 +121,7 @@ public function getConfigCurrenciesDataProvider() { return [ ['areaCode' => Area::AREA_ADMINHTML], + ['areaCode' => Area::AREA_CRONTAB], ['areaCode' => Area::AREA_FRONTEND], ]; } diff --git a/dev/tests/integration/testsuite/Magento/Directory/Model/CurrencyConfigTest.php b/dev/tests/integration/testsuite/Magento/Directory/Model/CurrencyConfigTest.php index b620d9097b4be..10f2749ddace1 100644 --- a/dev/tests/integration/testsuite/Magento/Directory/Model/CurrencyConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Directory/Model/CurrencyConfigTest.php @@ -56,7 +56,7 @@ protected function setUp() } /** - * Test get currency config for admin and storefront areas. + * Test get currency config for admin, crontab and storefront areas. * * @dataProvider getConfigCurrenciesDataProvider * @magentoDataFixture Magento/Store/_files/store.php @@ -77,7 +77,7 @@ public function testGetConfigCurrencies(string $areaCode, array $expected) $storeManager = Bootstrap::getObjectManager()->get(StoreManagerInterface::class); $storeManager->setCurrentStore($store->getId()); - if ($areaCode === Area::AREA_ADMINHTML) { + if (in_array($areaCode, [Area::AREA_ADMINHTML, Area::AREA_CRONTAB])) { self::assertEquals($expected['allowed'], $this->currency->getConfigAllowCurrencies()); self::assertEquals($expected['base'], $this->currency->getConfigBaseCurrencies()); self::assertEquals($expected['default'], $this->currency->getConfigDefaultCurrencies()); @@ -118,6 +118,14 @@ public function getConfigCurrenciesDataProvider() 'default' => ['BDT', 'USD'], ], ], + [ + 'areaCode' => Area::AREA_CRONTAB, + 'expected' => [ + 'allowed' => ['BDT', 'BNS', 'BTD', 'EUR', 'USD'], + 'base' => ['BDT', 'USD'], + 'default' => ['BDT', 'USD'], + ], + ], [ 'areaCode' => Area::AREA_FRONTEND, 'expected' => [ From e6ed16bec356c52697b6c85582554ca7e3263c75 Mon Sep 17 00:00:00 2001 From: Dzmitry Tabusheu Date: Thu, 1 Nov 2018 11:08:00 +0300 Subject: [PATCH 024/912] MAGETWO-95811: Cannot translate specific admin sections with inline translation - Added translate tags to templates --- app/code/Magento/Ui/view/base/web/js/grid/search/search.js | 2 +- .../base/web/templates/grid/controls/bookmarks/bookmarks.html | 2 +- .../view/base/web/templates/grid/controls/bookmarks/view.html | 2 +- .../Magento/Ui/view/base/web/templates/grid/search/search.html | 3 ++- app/code/Magento/Ui/view/base/web/templates/grid/submenu.html | 2 +- .../Ui/view/base/web/templates/grid/tree-massactions.html | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/grid/search/search.js b/app/code/Magento/Ui/view/base/web/js/grid/search/search.js index fa445a2577adb..be825a391cf07 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/search/search.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/search/search.js @@ -18,7 +18,7 @@ define([ return Element.extend({ defaults: { template: 'ui/grid/search/search', - placeholder: $t('Search by keyword'), + placeholder: 'Search by keyword', label: $t('Keyword'), value: '', previews: [], diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/bookmarks.html b/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/bookmarks.html index 3ef64fd4b5371..36a3232c3e61a 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/bookmarks.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/bookmarks.html @@ -6,7 +6,7 @@ -->
    diff --git a/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/view.html b/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/view.html index b52669e2cd28d..521ce9fc806ac 100644 --- a/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/view.html +++ b/app/code/Magento/Ui/view/base/web/templates/grid/controls/bookmarks/view.html @@ -30,7 +30,7 @@
- +