-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflowchart_sync_process.html
More file actions
143 lines (114 loc) · 4.32 KB
/
flowchart_sync_process.html
File metadata and controls
143 lines (114 loc) · 4.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<!DOCTYPE html>
<html>
<head>
<title>Verteller - Story Sync Process</title>
<script type="module">
import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";
mermaid.initialize({ startOnLoad: true });
</script>
<style>
.edgeLabel p {
padding: 4px 8px !important;
margin: 0;
}
</style>
</head>
<body>
<div class="mermaid">
flowchart TD
A[CLI Invoked<br/><code>bin/verteller.php</code>] --> B{Parse Arguments}
B -->| help flag | C[Show Help Text<br/>Exit 0]
B -->| Options parsed | D[Create SyncRunner<br/><code>SyncRunner.php</code>]
D --> E[SyncRunner::run<br/>dryRun, validate, syncHashes]
E --> F[Find Story Files<br/><code>findStoryFiles</code><br/>Scan storyDir for .story files]
F --> G{Story Files Found?}
G -->| No | H[Empty Result<br/>Exit 0]
G -->| Yes | I[Loop: Each Story File]
I --> J[Resolve Test Directory<br/><code>NamespaceResolverInterface</code>]
J --> K[Read Story File Contents]
K --> L[StoryParser::parse<br/><code>StoryParser.php</code>]
L --> M{Scenarios Found?}
M -->| No | N[Add Error<br/>No scenarios in file]
N --> NEXT{More Files?}
M -->| Yes | O[Determine Test File Path<br/>testsDir/StoryNameTest.php]
O --> P{Test File Exists?}
P -->| Yes | R[MethodExtractor::extract<br/><code>MethodExtractor.php</code><br/>Find existing CoversStory methods]
P -->| No | R2[Use Empty Methods Array]
R --> S{syncHashes Mode?}
R2 --> S
S -->| Yes | T[Find Hash Mismatches<br/>Compare scenario.bodyHash vs attribute hash]
T --> U{Mismatches Found?}
U -->| No | NEXT
U -->| Yes | V[Record HashSynced Event]
V --> W{Dry Run?}
W -->| Yes | NEXT
W -->| No | X[TestFileWriter::syncHashes<br/>Update hash values in file]
X --> NEXT
S -->| No | Y[Check Orphan Methods<br/>Warn if method exists but scenario removed]
Y --> Z[For Each Scenario]
Z --> AA{Method Exists?}
AA -->| No | AB[Mark as New Method]
AA -->| Yes | AC[Check Hash Mismatch<br/>Collect if changed]
AC --> AE{Is Outline?}
AE -->| Yes | AF{Provider Changed?}
AF -->| Yes | AG[Mark Provider for Update]
AF -->| No | AH[No Changes Needed]
AE -->| No | AH
AB --> AI{More Scenarios?}
AG --> AI
AH --> AI
AI -->| Yes | Z
AI -->| No | AD[Report Hash Mismatches<br/>Warning or Error in validate mode]
AD --> AJ{Changes Needed?}
AJ -->| No | NEXT
AJ -->| Yes | AK[Record Generated/Updated Event]
AK --> AL{Dry Run?}
AL -->| Yes | AM[Generate Preview<br/>Show new method code]
AM --> NEXT
AL -->| No | AN{File Exists?}
AN -->| No | AO[TestFileWriter::writeNew<br/><code>TestFileWriter.php</code><br/>Create new test class]
AN -->| Yes | AP[TestFileWriter::update<br/>Insert methods, update providers]
AO --> NEXT
AP --> NEXT
NEXT -->| Yes | I
NEXT -->| No | AQ[SyncResult::printSummary<br/><code>SyncResult.php</code>]
AQ --> AR{Validate Mode?}
AR -->| Yes, has changes | AS[Exit 1<br/>Tests out of sync]
AR -->| No | AT{Has Errors?}
AT -->| Yes | AU[Exit 1<br/>Completed with errors]
AT -->| No | AV[Exit 0<br/>Sync complete]
style A fill:#e1f5fe
style C fill:#c8e6c9
style H fill:#c8e6c9
style AS fill:#ffcdd2
style AU fill:#ffcdd2
style AV fill:#c8e6c9
style B fill:#fff8e1
style G fill:#fff8e1
style M fill:#fff8e1
style P fill:#fff8e1
style S fill:#fff8e1
style U fill:#fff8e1
style W fill:#fff8e1
style AA fill:#fff8e1
style AE fill:#fff8e1
style AF fill:#fff8e1
style AI fill:#fff8e1
style AJ fill:#fff8e1
style AL fill:#fff8e1
style AN fill:#fff8e1
style AR fill:#fff8e1
style AT fill:#fff8e1
style NEXT fill:#fff8e1
style N fill:#ffcdd2
style AD fill:#fff3e0
style V fill:#e8f5e9
style AB fill:#e8f5e9
style AG fill:#e8f5e9
style AO fill:#e8f5e9
style AP fill:#e8f5e9
style R fill:#e3f2fd
style R2 fill:#e3f2fd
</div>
</body>
</html>