@@ -64,7 +64,9 @@ describe('PHPYoshi', () => {
64
64
. resolves ( buildGitHubFileRaw ( '0.1.2' ) ) ;
65
65
getFileStub
66
66
. withArgs ( 'Client1/composer.json' , 'main' )
67
- . resolves ( buildGitHubFileRaw ( '{"name": "google/client1"}' ) ) ;
67
+ . resolves (
68
+ buildGitHubFileRaw ( '{"name": "google/client1", "version": "1.2.3"}' )
69
+ ) ;
68
70
getFileStub
69
71
. withArgs ( 'Client2/composer.json' , 'main' )
70
72
. resolves ( buildGitHubFileRaw ( '{"name": "google/client2"}' ) ) ;
@@ -164,8 +166,15 @@ describe('PHPYoshi', () => {
164
166
) ;
165
167
const updates = release ! . updates ;
166
168
assertHasUpdate ( updates , 'Client1/VERSION' , DefaultUpdater ) ;
169
+ assertHasUpdate (
170
+ updates ,
171
+ 'Client1/composer.json' ,
172
+ RootComposerUpdatePackages
173
+ ) ;
167
174
assertHasUpdate ( updates , 'Client2/VERSION' , DefaultUpdater ) ;
175
+ assertHasUpdate ( updates , 'Client2/composer.json' ) ;
168
176
assertHasUpdate ( updates , 'Client3/VERSION' , DefaultUpdater ) ;
177
+ assertHasUpdate ( updates , 'Client3/composer.json' ) ;
169
178
assertHasUpdate ( updates , 'Client3/src/Entry.php' , PHPClientVersion ) ;
170
179
} ) ;
171
180
it ( 'ignores non client top level directories' , async ( ) => {
@@ -194,10 +203,41 @@ describe('PHPYoshi', () => {
194
203
) ;
195
204
const updates = release ! . updates ;
196
205
assertHasUpdate ( updates , 'Client1/VERSION' , DefaultUpdater ) ;
206
+ assertHasUpdate (
207
+ updates ,
208
+ 'Client1/composer.json' ,
209
+ RootComposerUpdatePackages
210
+ ) ;
197
211
assertHasUpdate ( updates , 'Client2/VERSION' , DefaultUpdater ) ;
212
+ assertHasUpdate ( updates , 'Client2/composer.json' ) ;
198
213
assertHasUpdate ( updates , 'Client3/VERSION' , DefaultUpdater ) ;
214
+ assertHasUpdate ( updates , 'Client3/composer.json' ) ;
199
215
assertHasUpdate ( updates , 'Client3/src/Entry.php' , PHPClientVersion ) ;
200
216
} ) ;
217
+ it ( 'updates component composer version' , async ( ) => {
218
+ const strategy = new PHPYoshi ( {
219
+ targetBranch : 'main' ,
220
+ github,
221
+ } ) ;
222
+ const latestRelease = undefined ;
223
+ const release = await strategy . buildReleasePullRequest (
224
+ commits ,
225
+ latestRelease
226
+ ) ;
227
+ const updates = release ! . updates ;
228
+ assertHasUpdate (
229
+ updates ,
230
+ 'Client1/composer.json' ,
231
+ RootComposerUpdatePackages
232
+ ) ;
233
+ const client1Composer = updates . find ( update => {
234
+ return update . path === 'Client1/composer.json' ;
235
+ } ) ;
236
+ const newContent = client1Composer ! . updater . updateContent (
237
+ '{"name":"google/client1","version":"1.2.3"}'
238
+ ) ;
239
+ expect ( newContent ) . to . eql ( '{"name":"google/client1","version":"1.2.4"}' ) ;
240
+ } ) ;
201
241
} ) ;
202
242
describe ( 'buildRelease' , ( ) => {
203
243
it ( 'parses the release notes' , async ( ) => {
0 commit comments