diff --git a/lib/modules/manager/composer/artifacts.spec.ts b/lib/modules/manager/composer/artifacts.spec.ts index 779ac1bdf5dff6e93d0729f716d941a27ce8605e..7ad1a8bc212fc6aca67e9dac48a35e12eb57119f 100644 --- a/lib/modules/manager/composer/artifacts.spec.ts +++ b/lib/modules/manager/composer/artifacts.spec.ts @@ -92,14 +92,17 @@ describe('modules/manager/composer/artifacts', () => { expect( await composer.updateArtifacts({ packageFileName: 'composer.json', - updatedDeps: [{ depName: 'foo' }, { depName: 'bar' }], + updatedDeps: [ + { depName: 'foo', newVersion: '1.0.0' }, + { depName: 'bar', newVersion: '2.0.0' }, + ], newPackageFileContent: '{}', config, }) ).toBeNull(); expect(execSnapshots).toMatchObject([ { - cmd: 'composer update foo bar --with-dependencies --ignore-platform-reqs --no-ansi --no-interaction', + cmd: 'composer update foo:1.0.0 bar:2.0.0 --with-dependencies --ignore-platform-reqs --no-ansi --no-interaction', options: { cwd: '/tmp/github/some/repo', env: { @@ -1146,14 +1149,17 @@ describe('modules/manager/composer/artifacts', () => { expect( await composer.updateArtifacts({ packageFileName: 'composer.json', - updatedDeps: [{ depName: 'foo' }, { depName: 'bar' }], + updatedDeps: [ + { depName: 'foo', newVersion: '1.0.0' }, + { depName: 'bar', newVersion: '2.0.0' }, + ], newPackageFileContent: '{}', config, }) ).toBeNull(); expect(execSnapshots).toMatchObject([ { - cmd: 'composer update foo bar --with-dependencies --ignore-platform-reqs --no-ansi --no-interaction --no-scripts --no-autoloader', + cmd: 'composer update foo:1.0.0 bar:2.0.0 --with-dependencies --ignore-platform-reqs --no-ansi --no-interaction --no-scripts --no-autoloader', options: { cwd: '/tmp/github/some/repo' }, }, ]); @@ -1183,4 +1189,26 @@ describe('modules/manager/composer/artifacts', () => { }, ]); }); + + it('includes new dependency version in update command', async () => { + fs.readLocalFile.mockResolvedValueOnce('{}'); + const execSnapshots = mockExecAll(); + fs.readLocalFile.mockResolvedValueOnce('{}'); + git.getRepoStatus.mockResolvedValueOnce(repoStatus); + + expect( + await composer.updateArtifacts({ + packageFileName: 'composer.json', + updatedDeps: [{ depName: 'foo', newVersion: '1.1.0' }], + newPackageFileContent: '{}', + config, + }) + ).toBeNull(); + expect(execSnapshots).toMatchObject([ + { + cmd: 'composer update foo:1.1.0 --with-dependencies --ignore-platform-reqs --no-ansi --no-interaction --no-scripts --no-autoloader --no-plugins', + options: { cwd: '/tmp/github/some/repo' }, + }, + ]); + }); }); diff --git a/lib/modules/manager/composer/artifacts.ts b/lib/modules/manager/composer/artifacts.ts index 104cbfe0c5e4774a4e3c58575e9c372dc31855c7..74113bff12fc45150bd4c376a5950b18911569f0 100644 --- a/lib/modules/manager/composer/artifacts.ts +++ b/lib/modules/manager/composer/artifacts.ts @@ -179,7 +179,9 @@ export async function updateArtifacts({ ( 'update ' + updatedDeps - .map((dep) => dep.depName) + .map((dep) => + dep.newVersion ? `${dep.depName}:${dep.newVersion}` : dep.depName + ) .filter(is.string) .map((dep) => quote(dep)) .join(' ')