Skip to content

Commit 53c203e

Browse files
authored
Merge branch '2.4-develop' into B2B-2659
2 parents 13baa6c + 9c0e123 commit 53c203e

File tree

4 files changed

+63
-10
lines changed

4 files changed

+63
-10
lines changed

app/code/Magento/Backend/Test/Mftf/ActionGroup/SecondaryGridActionGroup.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
<waitForPageLoad stepKey="waitForTaxRateLoad"/>
2828

2929
<!-- delete the rule -->
30+
<waitForElementVisible selector="{{AdminStoresMainActionsSection.deleteButton}}" stepKey="waitForDelete"/>
3031
<click stepKey="clickDelete" selector="{{AdminStoresMainActionsSection.deleteButton}}"/>
32+
<waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForConfirmationModal"/>
3133
<click stepKey="clickOk" selector="{{AdminConfirmationModalSection.ok}}"/>
32-
<see stepKey="seeSuccess" selector="{{AdminMessagesSection.success}}" userInput="deleted"/>
34+
<waitForText stepKey="seeSuccess" selector="{{AdminMessagesSection.success}}" userInput="deleted"/>
3335
</actionGroup>
3436
</actionGroups>

app/code/Magento/OfflineShipping/Test/Mftf/Test/StorefrontFreeShippingShouldNotApplyIfOtherDiscountAppliedTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
</actionGroup>
6868
<waitForElement time="30" selector="{{CheckoutCartSummarySection.estimateShippingAndTaxForm}}" stepKey="waitForEstimateShippingAndTaxFormAfterCouponApplied"/>
6969
<waitForElement time="30" selector="{{CheckoutCartSummarySection.shippingMethodForm}}" stepKey="waitForShippingMethodFormAfterCouponApplied"/>
70+
<!-- Sometimes the shipping loading masks are not done loading -->
71+
<waitForPageLoad stepKey="waitForShippingLoaded"/>
7072
<see selector="{{CheckoutCartSummarySection.shippingPrice}}" userInput="$5.00" stepKey="seeFlatShippingPrice"/>
7173
</test>
7274
</tests>

app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToGroupedProductWithInvisibleIndividualProductTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@
7979
</actionGroup>
8080
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/>
8181
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
82+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
83+
<argument name="indices" value=""/>
84+
</actionGroup>
8285
</after>
8386
<!-- Start to create new cart price rule via Category conditions -->
8487
<actionGroup ref="AdminCreateCartPriceRuleWithConditionIsCategoryActionGroup" stepKey="createCartPriceRuleWithCondition">

lib/internal/Magento/Framework/Filter/Template.php

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ public function getTemplateProcessor()
189189
*
190190
* @param string $value
191191
* @return string
192+
*
192193
* @throws \Exception
193194
*/
194195
public function filter($value)
@@ -203,19 +204,21 @@ public function filter($value)
203204
$this->filteringDepthMeter->descend();
204205

205206
// Processing of template directives.
206-
$templateDirectivesResults = $this->processDirectives($value);
207+
$templateDirectivesResults = array_unique(
208+
$this->processDirectives($value),
209+
SORT_REGULAR
210+
);
207211

208-
foreach ($templateDirectivesResults as $result) {
209-
$value = str_replace($result['directive'], $result['output'], $value);
210-
}
212+
$value = $this->applyDirectivesResults($value, $templateDirectivesResults);
211213

212214
// Processing of deferred directives received from child templates
213215
// or nested directives.
214-
$deferredDirectivesResults = $this->processDirectives($value, true);
216+
$deferredDirectivesResults = array_unique(
217+
$this->processDirectives($value, true),
218+
SORT_REGULAR
219+
);
215220

216-
foreach ($deferredDirectivesResults as $result) {
217-
$value = str_replace($result['directive'], $result['output'], $value);
218-
}
221+
$value = $this->applyDirectivesResults($value, $deferredDirectivesResults);
219222

220223
if ($this->filteringDepthMeter->showMark() > 1) {
221224
// Signing own deferred directives (if any).
@@ -271,17 +274,60 @@ private function processDirectives($value, $isSigned = false): array
271274
foreach ($constructions as $construction) {
272275
$replacedValue = $directiveProcessor->process($construction, $this, $this->templateVars);
273276

274-
$results[] = [
277+
$result = [
275278
'directive' => $construction[0],
276279
'output' => $replacedValue
277280
];
281+
282+
if (count($this->afterFilterCallbacks) > 0) {
283+
$result['callbacks'] = $this->afterFilterCallbacks;
284+
285+
$this->resetAfterFilterCallbacks();
286+
}
287+
288+
$results[] = $result;
278289
}
279290
}
280291
}
281292

282293
return $results;
283294
}
284295

296+
/**
297+
* Applies results produced by directives.
298+
*
299+
* @param string $value
300+
* @param array $results
301+
*
302+
* @return string
303+
*/
304+
private function applyDirectivesResults(string $value, array $results): string
305+
{
306+
$processedResults = [];
307+
308+
foreach ($results as $result) {
309+
foreach ($processedResults as $processedResult) {
310+
$result['directive'] = str_replace(
311+
$processedResult['directive'],
312+
$processedResult['output'],
313+
$result['directive']
314+
);
315+
}
316+
317+
$value = str_replace($result['directive'], $result['output'], $value);
318+
319+
if (isset($result['callbacks'])) {
320+
foreach ($result['callbacks'] as $callback) {
321+
$this->addAfterFilterCallback($callback);
322+
}
323+
}
324+
325+
$processedResults[] = $result;
326+
}
327+
328+
return $value;
329+
}
330+
285331
/**
286332
* Modifies given regular expression pattern to be able to recognize signed directives.
287333
*

0 commit comments

Comments
 (0)