+ */
+ public function provideData(): Iterator
+ {
+ return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ }
+
+ public function provideConfigFilePath(): string
+ {
+ return __DIR__ . '/config/configured_rule.php';
+ }
+}
diff --git a/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/already-escaped-ouput.php.inc b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/already-escaped-ouput.php.inc
new file mode 100644
index 00000000..555eddf4
--- /dev/null
+++ b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/already-escaped-ouput.php.inc
@@ -0,0 +1,11 @@
+escapeHtml($productName);
+
+?>
+-----
+escapeHtml($productName);
+
+?>
diff --git a/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/complex-phtml-code-mix.php.inc b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/complex-phtml-code-mix.php.inc
new file mode 100644
index 00000000..28dd2cc2
--- /dev/null
+++ b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/complex-phtml-code-mix.php.inc
@@ -0,0 +1,27 @@
+getAllItems();
+?>
+
+ 0): ?>
+
= __('Total %1 items found', count($items)) ?>
+
+
= $item->getName(); ?>
+
+
+ = __('No items found.'); ?>
+
+
+-----
+getAllItems();
+?>
+
diff --git a/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/function-call.php.inc b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/function-call.php.inc
new file mode 100644
index 00000000..32107eb3
--- /dev/null
+++ b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/function-call.php.inc
@@ -0,0 +1,11 @@
+getName();
+echo __('Something');
+?>
+-----
+escapeHtml($customer->getName());
+echo $escaper->escapeHtml(__('Something'));
+?>
diff --git a/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/message-string-contains-html.php.inc b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/message-string-contains-html.php.inc
new file mode 100644
index 00000000..9335a5e1
--- /dev/null
+++ b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/message-string-contains-html.php.inc
@@ -0,0 +1 @@
+= __('Total %1 items found',count($items))?>
diff --git a/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/method-that-return-html.php.inc b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/method-that-return-html.php.inc
new file mode 100644
index 00000000..973e025f
--- /dev/null
+++ b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/method-that-return-html.php.inc
@@ -0,0 +1,3 @@
+= $block->getChildHtml(); ?>
+= $block->getToolBarHtml();?>
+= $block->getChildBlock('toolbar')->setIsBottom(true)->toHtml() ?>
diff --git a/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/simple-echo.php.inc b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/simple-echo.php.inc
new file mode 100644
index 00000000..8bb9d442
--- /dev/null
+++ b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/simple-echo.php.inc
@@ -0,0 +1,11 @@
+
+-----
+escapeHtml($productName);
+
+?>
diff --git a/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/skip-escaped-output-using-secure-renderer.php.inc b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/skip-escaped-output-using-secure-renderer.php.inc
new file mode 100644
index 00000000..45db5f32
--- /dev/null
+++ b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/skip-escaped-output-using-secure-renderer.php.inc
@@ -0,0 +1,4 @@
+= $secureRenderer->renderStyleAsTag(
+ $position,
+ 'product-item-info_' . $_product->getId() . ' div.actions-primary'
+) ?>
diff --git a/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/skip-output-of-count-function.php.inc b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/skip-output-of-count-function.php.inc
new file mode 100644
index 00000000..7dd0e4c6
--- /dev/null
+++ b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/skip-output-of-count-function.php.inc
@@ -0,0 +1,3 @@
+= count($items); ?>
+= (int)$items ?>
+= (bool)$items ?>
diff --git a/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/skip-with-no-escape-annotation.php.inc b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/skip-with-no-escape-annotation.php.inc
new file mode 100644
index 00000000..2696f4c3
--- /dev/null
+++ b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/skip-with-no-escape-annotation.php.inc
@@ -0,0 +1,3 @@
+= /* @noEscape */ $block->getProductPrice($_product) ?>
+= /* @noEscape */ $price ?>
+= /* @noEscape */ trim($price) ?>
diff --git a/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/ternary-condition.php.inc b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/ternary-condition.php.inc
new file mode 100644
index 00000000..20d7451d
--- /dev/null
+++ b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/Fixture/ternary-condition.php.inc
@@ -0,0 +1,11 @@
+canShowInfo() ? $escaper->escapeHtml($block->getInfo()) : __('Nothing to show');
+
+?>
+-----
+canShowInfo() ? $escaper->escapeHtml($block->getInfo()) : $escaper->escapeHtml(__('Nothing to show'));
+
+?>
diff --git a/Magento2/Rector/Tests/AddHtmlEscaperToOutput/config/configured_rule.php b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/config/configured_rule.php
new file mode 100644
index 00000000..e8366789
--- /dev/null
+++ b/Magento2/Rector/Tests/AddHtmlEscaperToOutput/config/configured_rule.php
@@ -0,0 +1,13 @@
+rule(\Magento2\Rector\Src\AddHtmlEscaperToOutput::class);
+};