Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace obsolete "$this" with "$block" in shipment inventory template. #1409

Closed
nmalevanec opened this issue Jun 22, 2018 · 1 comment
Closed
Assignees

Comments

@nmalevanec
Copy link
Contributor

nmalevanec commented Jun 22, 2018

Preconditions

  1. Magento with MSI

Steps to reproduce

  1. Observe https://github.com/magento-engcom/msi/blob/14f70cd6393c62b0a821cd7d77bff5673871eb01/app/code/Magento/InventoryShippingAdminUi/view/adminhtml/templates/shipment/inventory.phtml#L19-L22

Expected result

  1. As access to members and methods of Block class through $this is obsolete in phtml templates, on line 21 should be ...$block->getSourceName($sourceCode)...

Actual result

  1. On line 21 used $this->getSourceName($sourceCode)

Data set: app/code/Magento/InventoryShippingAdminUi/view/adminhtml/templates/shipment/inventory.phtml
Access to members and methods of Block class through $this is obsolete in phtml templates. Use only $block instead of $this.
Failed asserting that '<?php\n

/**\n
 * Copyright © Magento, Inc. All rights reserved.\n
 * See COPYING.txt for license details.\n
 */\n
\n
// @codingStandardsIgnoreFile\n
\n
/** @var \Magento\InventoryShippingAdminUi\Block\Adminhtml\Shipment\Inventory $block */\n
\n
$sourceCode = $block->getSourceCode();\n
?>\n
\n
<?php if ($sourceCode): ?>\n
<section class="admin__page-section inventory">\n
    <div class="admin__page-section-title">\n
        <span class="title"><?= $block->escapeHtml(__('Inventory')) ?></span>\n
    </div>\n
    <div class="admin__page-section-content">\n
        <?= $block->escapeHtml(__('Source:')) ?>\n
        <?= $block->escapeHtml($this->getSourceName($sourceCode)) ?>\n
    </div>\n
</section>\n
<input name="sourceCode" type="hidden" value="<?= /* @escapeNotVerified */ $sourceCode ?>">\n
<?php endif; ?>\n

' does not match PCRE pattern "/this->(?!helper)\S*/iS".
/var/www/html/dev/tests/static/testsuite/Magento/Test/Legacy/PhtmlTemplateTest.php:26
/var/www/html/lib/internal/Magento/Framework/App/Utility/AggregateInvoker.php:56
/var/www/html/dev/tests/static/testsuite/Magento/Test/Legacy/PhtmlTemplateTest.php:29

/var/www/html/lib/internal/Magento/Framework/App/Utility/AggregateInvoker.php:115
/var/www/html/lib/internal/Magento/Framework/App/Utility/AggregateInvoker.php:70
/var/www/html/dev/tests/static/testsuite/Magento/Test/Legacy/PhtmlTemplateTest.php:29

@naydav
Copy link

naydav commented Jun 30, 2018

#1414

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants