66
77namespace Magento \FunctionalTestingFramework \Util ;
88
9- use Magento \FunctionalTestingFramework \DataGenerator \Handlers \CredentialStore ;
10- use Magento \FunctionalTestingFramework \DataGenerator \Handlers \PersistedObjectHandler ;
11- use Magento \FunctionalTestingFramework \DataGenerator \Objects \EntityDataObject ;
129use Magento \FunctionalTestingFramework \Exceptions \TestFrameworkException ;
13- use Magento \FunctionalTestingFramework \Exceptions \TestReferenceException ;
14- use Magento \FunctionalTestingFramework \Suite \Handlers \SuiteObjectHandler ;
1510use Magento \FunctionalTestingFramework \Test \Handlers \ActionGroupObjectHandler ;
16- use Magento \FunctionalTestingFramework \Test \Handlers \TestObjectHandler ;
1711use 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 ;
2112use 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+
2814
2915/**
3016 * Class TestGenerator
@@ -44,6 +30,8 @@ class DocGenerator
4430 const ANNOTATION_MODULE = "" ;
4531 const ANNOTATION_PAGE = "page " ;
4632 const ANNOTATION_DESCRIPTION = "description " ;
33+ const FILENAMES = "filenames " ;
34+ const ARGUMENTS = "arguments " ;
4735
4836 /**
4937 * Single instance of class var
@@ -112,10 +100,12 @@ public function createDocumentation($annotatedObjects, $outputDir, $clean)
112100 foreach ($ annotatedObjects as $ name => $ object ) {
113101 $ annotations = $ object ->getAnnotations ();
114102 $ filenames = $ this ->flattenArray ($ object ->getFileNames ());
103+ $ arguments = $ object ->getArguments ();
115104
116105 $ info = [
117106 self ::ANNOTATION_DESCRIPTION => $ annotations [self ::ANNOTATION_DESCRIPTION ] ?? 'NO_DESCRIPTION_SPECIFIED ' ,
118- 'filenames ' => $ filenames
107+ self ::FILENAMES => $ filenames ,
108+ self ::ARGUMENTS => $ arguments
119109 ];
120110 $ pageGroups = array_merge_recursive (
121111 $ pageGroups ,
@@ -144,21 +134,44 @@ public function createDocumentation($annotatedObjects, $outputDir, $clean)
144134 */
145135 private function transformToMarkdown ($ annotationList )
146136 {
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 ;
148142
143+ $ markdown .= "##List of Pages " . PHP_EOL ;
149144 foreach ($ annotationList as $ group => $ objects )
150145 {
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 ;
152153 foreach ($ objects as $ name => $ annotations )
153154 {
154- $ markdown .= "#### $ name " . PHP_EOL ;
155+ $ markdown .= "### $ name " . PHP_EOL ;
155156 $ 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+ }
156168 $ markdown .= "Located in: " . PHP_EOL ;
157- foreach ($ annotations [' filenames ' ] as $ filename )
169+ foreach ($ annotations [self :: FILENAMES ] as $ filename )
158170 {
159- $ markdown .= "- $ filename " ;
171+ $ relativeFilename = str_replace (MAGENTO_BP . DIRECTORY_SEPARATOR , "" , $ filename );
172+ $ markdown .= "- $ relativeFilename " ;
160173 }
161- $ markdown .= PHP_EOL . PHP_EOL ;
174+ $ markdown .= PHP_EOL . " *** " . PHP_EOL ;
162175 }
163176 }
164177 return $ markdown ;
0 commit comments