diff --git a/images/win/scripts/Installers/Install-PHP.ps1 b/images/win/scripts/Installers/Install-PHP.ps1 index cbd73d5d..40b1bcc0 100644 --- a/images/win/scripts/Installers/Install-PHP.ps1 +++ b/images/win/scripts/Installers/Install-PHP.ps1 @@ -5,7 +5,9 @@ # Install latest PHP in chocolatey $installDir = "c:\tools\php" -Choco-Install -PackageName php -ArgumentList "--force", "--params", "/InstallDir:$installDir" +$phpMajorMinor = (Get-ToolsetContent).php.version +$phpVersionToInstall = Get-LatestChocoPackageVersion -TargetVersion $phpMajorMinor -PackageName "php" +Choco-Install -PackageName php -ArgumentList "--params", "/InstallDir:$installDir", "--version=$phpVersionToInstall" # Install latest Composer in chocolatey Choco-Install -PackageName composer -ArgumentList "--ia", "/DEV=$installDir /PHP=$installDir" diff --git a/images/win/scripts/Tests/PHP.Tests.ps1 b/images/win/scripts/Tests/PHP.Tests.ps1 index 74469d9a..0e101331 100644 --- a/images/win/scripts/Tests/PHP.Tests.ps1 +++ b/images/win/scripts/Tests/PHP.Tests.ps1 @@ -1,13 +1,16 @@ Describe "PHP" { - It "Check in the PATH" -TestCases @( - @{ ToolName = "php" } - @{ ToolName = "composer" } - ) { - "$ToolName --version" | Should -ReturnZeroExitCode + It "Check PHP version" { + $phpMajorMinor = (Get-ToolsetContent).php.version + $phpInstalledVersion = php --version | Select-String -Pattern "PHP $phpMajorMinor" + $phpInstalledVersion | Should -BeLike "*${phpMajorMinor}*" + } + + It "Check Composer in the PATH" { + "composer --version" | Should -ReturnZeroExitCode } It "PHP Environment variables is set." { ${env:PHPROOT} | Should -Not -BeNullOrEmpty ${env:PHPROOT} | Should -Exist } -} \ No newline at end of file +} diff --git a/images/win/toolsets/toolset-2016.json b/images/win/toolsets/toolset-2016.json index 118fd6c3..9cce92d0 100644 --- a/images/win/toolsets/toolset-2016.json +++ b/images/win/toolsets/toolset-2016.json @@ -427,6 +427,9 @@ "mongodb": { "version": "5.0" }, + "php": { + "version": "8.0" + }, "llvm": { "version": "13" } diff --git a/images/win/toolsets/toolset-2019.json b/images/win/toolsets/toolset-2019.json index 7ddacfbe..1670e986 100644 --- a/images/win/toolsets/toolset-2019.json +++ b/images/win/toolsets/toolset-2019.json @@ -459,6 +459,9 @@ "mongodb": { "version": "5.0" }, + "php": { + "version": "8.0" + }, "llvm": { "version": "13" } diff --git a/images/win/toolsets/toolset-2022.json b/images/win/toolsets/toolset-2022.json index 94c50975..796fcfdb 100644 --- a/images/win/toolsets/toolset-2022.json +++ b/images/win/toolsets/toolset-2022.json @@ -310,5 +310,8 @@ }, "mongodb": { "version": "5.0" + }, + "php": { + "version": "8.0" } }