Skip to content

Commit 10ecf09

Browse files
committed
MAGETWO-86864: Stabilize functional tests
- Update MFTF tests to be compliant with new version - Remove references to other modules in PublicCodeTest
1 parent b99f6f7 commit 10ecf09

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Page/CmsNewBlockPage.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
11-
<page name="CmsNewBlock" url="admin/cms/block/new" area="admin" module="Magento_Cms">
11+
<page name="CmsNewBlock" area="admin" url="/cms/block/new" module="Magento_Cms">
1212
<section name="CmsNewBlockBlockActionsSection"/>
1313
<section name="CmsNewBlockBlockBasicFieldsSection"/>
1414
</page>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewBlockBlockBasicFieldsSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
<section name="CmsNewBlockBlockBasicFieldsSection">
1212
<element name="title" type="input" selector="input[name=title]"/>
1313
<element name="identifier" type="input" selector="input[name=identifier]"/>
14-
<element name="wysiwyg_hr_element" type="input" selector="#cms_block_form_content_hr"/>
14+
<element name="content_textarea" type="input" selector="#cms_block_form_content"/>
1515
</section>
1616
</sections>

dev/tests/static/testsuite/Magento/Test/Integrity/PublicCodeTest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,24 @@ class PublicCodeTest extends \PHPUnit\Framework\TestCase
3131
*/
3232
public function testAllBlocksReferencedInLayoutArePublic($layoutFile)
3333
{
34+
// A block can be whitelisted and thus not be required to be public
35+
$whiteListFiles = str_replace('\\', '/', realpath(__DIR__))
36+
. '/_files/whitelist/public_code*.txt';
37+
$whiteListBlocks = [];
38+
foreach (glob($whiteListFiles) as $fileName) {
39+
$whiteListBlocks = array_merge(
40+
$whiteListBlocks,
41+
file($fileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)
42+
);
43+
}
44+
3445
$nonPublishedBlocks = [];
3546
$xml = simplexml_load_file($layoutFile);
3647
$elements = $xml->xpath('//block | //referenceBlock') ?: [];
3748
/** @var $node \SimpleXMLElement */
3849
foreach ($elements as $node) {
3950
$class = (string) $node['class'];
40-
if ($class && \class_exists($class)) {
51+
if ($class && \class_exists($class) && !in_array($class, $whiteListBlocks)) {
4152
$reflection = (new \ReflectionClass($class));
4253
if (strpos($reflection->getDocComment(), '@api') === false) {
4354
$nonPublishedBlocks[] = $class;

0 commit comments

Comments
 (0)