Skip to content

Commit 6235795

Browse files
committed
MQE-1367: [SPIKE] Investigate Self-Documentation for MFTF
- Correcting Build failures, correcting object instantiation
1 parent 4a6d39d commit 6235795

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

dev/tests/unit/Magento/FunctionalTestFramework/Util/DocGeneratorTest.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public function testBasicCreateDocumentation()
3030
->withAnnotations($annotations)
3131
->withFilenames(["filename"])
3232
->build();
33-
DocGenerator::getInstance()->createDocumentation(
33+
$docGenerator = new DocGenerator();
34+
$docGenerator->createDocumentation(
3435
[$actionGroupUnderTest->getName() => $actionGroupUnderTest],
3536
DOCS_OUTPUT_DIR,
3637
true
@@ -61,7 +62,8 @@ public function testCreateDocumentationWithOverwrite()
6162
->withAnnotations($annotations)
6263
->withFilenames(["filename"])
6364
->build();
64-
DocGenerator::getInstance()->createDocumentation(
65+
$docGenerator = new DocGenerator();
66+
$docGenerator->createDocumentation(
6567
[$actionGroupUnderTest->getName() => $actionGroupUnderTest],
6668
DOCS_OUTPUT_DIR,
6769
true
@@ -75,7 +77,8 @@ public function testCreateDocumentationWithOverwrite()
7577
->withAnnotations($annotations)
7678
->withFilenames(["filename"])
7779
->build();
78-
DocGenerator::getInstance()->createDocumentation(
80+
$docGenerator = new DocGenerator();
81+
$docGenerator->createDocumentation(
7982
[$actionGroupUnderTest->getName() => $actionGroupUnderTest],
8083
DOCS_OUTPUT_DIR,
8184
true
@@ -106,7 +109,8 @@ public function testCreateDocumentationNotCleanException()
106109
->withAnnotations($annotations)
107110
->withFilenames(["filename"])
108111
->build();
109-
DocGenerator::getInstance()->createDocumentation(
112+
$docGenerator = new DocGenerator();
113+
$docGenerator->createDocumentation(
110114
[$actionGroupUnderTest->getName() => $actionGroupUnderTest],
111115
DOCS_OUTPUT_DIR,
112116
true
@@ -117,7 +121,8 @@ public function testCreateDocumentationNotCleanException()
117121
$this->expectException(TestFrameworkException::class);
118122
$this->expectExceptionMessage("$docFile already exists, please add --clean if you want to overwrite it.");
119123

120-
DocGenerator::getInstance()->createDocumentation(
124+
$docGenerator = new DocGenerator();
125+
$docGenerator->createDocumentation(
121126
[$actionGroupUnderTest->getName() => $actionGroupUnderTest],
122127
DOCS_OUTPUT_DIR,
123128
false

src/Magento/FunctionalTestingFramework/Console/GenerateDocsCommand.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
1212
use Magento\FunctionalTestingFramework\Test\Handlers\ActionGroupObjectHandler;
1313
use Magento\FunctionalTestingFramework\Util\DocGenerator;
14+
use PhpParser\Comment\Doc;
1415
use Symfony\Component\Console\Command\Command;
1516
use Symfony\Component\Console\Input\InputInterface;
1617
use Symfony\Component\Console\Input\InputOption;
@@ -38,11 +39,11 @@ protected function configure()
3839
InputOption::VALUE_NONE,
3940
'Clean Output Directory'
4041
)->addOption(
41-
"force",
42-
'f',
43-
InputOption::VALUE_NONE,
44-
'Force Document Generation For All Action Groups'
45-
);
42+
"force",
43+
'f',
44+
InputOption::VALUE_NONE,
45+
'Force Document Generation For All Action Groups'
46+
);
4647
}
4748

4849
/**
@@ -70,8 +71,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
7071
);
7172

7273
$allActionGroups = ActionGroupObjectHandler::getInstance()->getAllObjects();
73-
74-
DocGenerator::createDocumentation($allActionGroups, $config, $clean);
74+
$docGenerator = new DocGenerator();
75+
$docGenerator->createDocumentation($allActionGroups, $config, $clean);
7576

7677
$output->writeln("Generate Docs Command Run");
7778
}

src/Magento/FunctionalTestingFramework/Util/DocGenerator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ class DocGenerator
3535
* DocGenerator constructor.
3636
*
3737
*/
38-
private function __construct()
38+
public function __construct()
3939
{
40-
// private constructor for factory
4140
}
4241

4342
/**

0 commit comments

Comments
 (0)