6
6
7
7
namespace Magento \FunctionalTestingFramework \Util ;
8
8
9
- use Magento \FunctionalTestingFramework \DataGenerator \Handlers \CredentialStore ;
10
- use Magento \FunctionalTestingFramework \DataGenerator \Handlers \PersistedObjectHandler ;
11
- use Magento \FunctionalTestingFramework \DataGenerator \Objects \EntityDataObject ;
12
9
use Magento \FunctionalTestingFramework \Exceptions \TestFrameworkException ;
13
- use Magento \FunctionalTestingFramework \Exceptions \TestReferenceException ;
14
- use Magento \FunctionalTestingFramework \Suite \Handlers \SuiteObjectHandler ;
15
10
use Magento \FunctionalTestingFramework \Test \Handlers \ActionGroupObjectHandler ;
16
- use Magento \FunctionalTestingFramework \Test \Handlers \TestObjectHandler ;
17
11
use Magento \FunctionalTestingFramework \Test \Objects \ActionGroupObject ;
18
- use Magento \FunctionalTestingFramework \Test \Objects \ActionObject ;
19
- use Magento \FunctionalTestingFramework \DataGenerator \Handlers \DataObjectHandler ;
20
- use Magento \FunctionalTestingFramework \Test \Objects \TestHookObject ;
21
12
use Magento \FunctionalTestingFramework \Test \Objects \TestObject ;
22
- use Magento \FunctionalTestingFramework \Util \Logger \LoggingUtil ;
23
- use Magento \FunctionalTestingFramework \Util \Manifest \BaseTestManifest ;
24
- use Magento \FunctionalTestingFramework \Util \Manifest \TestManifestFactory ;
25
- use Magento \FunctionalTestingFramework \Test \Util \ActionObjectExtractor ;
26
- use Magento \FunctionalTestingFramework \Test \Util \TestObjectExtractor ;
27
- use Magento \FunctionalTestingFramework \Util \Filesystem \DirSetupUtil ;
13
+
28
14
29
15
/**
30
16
* Class TestGenerator
@@ -44,6 +30,8 @@ class DocGenerator
44
30
const ANNOTATION_MODULE = "" ;
45
31
const ANNOTATION_PAGE = "page " ;
46
32
const ANNOTATION_DESCRIPTION = "description " ;
33
+ const FILENAMES = "filenames " ;
34
+ const ARGUMENTS = "arguments " ;
47
35
48
36
/**
49
37
* Single instance of class var
@@ -112,10 +100,12 @@ public function createDocumentation($annotatedObjects, $outputDir, $clean)
112
100
foreach ($ annotatedObjects as $ name => $ object ) {
113
101
$ annotations = $ object ->getAnnotations ();
114
102
$ filenames = $ this ->flattenArray ($ object ->getFileNames ());
103
+ $ arguments = $ object ->getArguments ();
115
104
116
105
$ info = [
117
106
self ::ANNOTATION_DESCRIPTION => $ annotations [self ::ANNOTATION_DESCRIPTION ] ?? 'NO_DESCRIPTION_SPECIFIED ' ,
118
- 'filenames ' => $ filenames
107
+ self ::FILENAMES => $ filenames ,
108
+ self ::ARGUMENTS => $ arguments
119
109
];
120
110
$ pageGroups = array_merge_recursive (
121
111
$ pageGroups ,
@@ -144,21 +134,44 @@ public function createDocumentation($annotatedObjects, $outputDir, $clean)
144
134
*/
145
135
private function transformToMarkdown ($ annotationList )
146
136
{
147
- $ markdown = "" ;
137
+ $ markdown = "#Action Group Information " . PHP_EOL ;
138
+ $ markdown .= "This documentation contains a list of all " .
139
+ " action groups on the pages on which they start " .
140
+ PHP_EOL .
141
+ PHP_EOL ;
148
142
143
+ $ markdown .= "##List of Pages " . PHP_EOL ;
149
144
foreach ($ annotationList as $ group => $ objects )
150
145
{
151
- $ markdown .= "### $ group " . PHP_EOL . PHP_EOL ;
146
+ $ markdown .= "- [ $ group ](# $ group) " . PHP_EOL ;
147
+ }
148
+ $ markdown .= "--- " . PHP_EOL ;
149
+ foreach ($ annotationList as $ group => $ objects )
150
+ {
151
+ $ markdown .= "<a name= \"$ group \"></a> " . PHP_EOL ;
152
+ $ markdown .= "## $ group " . PHP_EOL . PHP_EOL ;
152
153
foreach ($ objects as $ name => $ annotations )
153
154
{
154
- $ markdown .= "#### $ name " . PHP_EOL ;
155
+ $ markdown .= "### $ name " . PHP_EOL ;
155
156
$ markdown .= $ annotations [self ::ANNOTATION_DESCRIPTION ] . PHP_EOL . PHP_EOL ;
157
+ if (!empty ($ annotations [self ::ARGUMENTS ])) {
158
+ $ markdown .= "Action Group Arguments: " . PHP_EOL . PHP_EOL ;
159
+ $ markdown .= "| Name | Type | " . PHP_EOL ;
160
+ $ markdown .= "| --- | --- | " . PHP_EOL ;
161
+ foreach ($ annotations [self ::ARGUMENTS ] as $ argument ) {
162
+ $ argumentName = $ argument ->getName ();
163
+ $ argumentType = $ argument ->getDataType ();
164
+ $ markdown .= "| $ argumentName | $ argumentType | " . PHP_EOL ;
165
+ }
166
+ $ markdown .= PHP_EOL ;
167
+ }
156
168
$ markdown .= "Located in: " . PHP_EOL ;
157
- foreach ($ annotations [' filenames ' ] as $ filename )
169
+ foreach ($ annotations [self :: FILENAMES ] as $ filename )
158
170
{
159
- $ markdown .= "- $ filename " ;
171
+ $ relativeFilename = str_replace (MAGENTO_BP . DIRECTORY_SEPARATOR , "" , $ filename );
172
+ $ markdown .= "- $ relativeFilename " ;
160
173
}
161
- $ markdown .= PHP_EOL . PHP_EOL ;
174
+ $ markdown .= PHP_EOL . " *** " . PHP_EOL ;
162
175
}
163
176
}
164
177
return $ markdown ;
0 commit comments