[Windows] Add PHP to the toolset (#4493)

This commit is contained in:
V-Zabayrachny
2021-11-16 11:32:09 +03:00
committed by GitHub
parent 06c90a3200
commit d3e74a5d7d
5 changed files with 21 additions and 7 deletions

View File

@@ -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"

View File

@@ -1,13 +1,16 @@
Describe "PHP" {
It "Check <ToolName> 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
}
}
}

View File

@@ -427,6 +427,9 @@
"mongodb": {
"version": "5.0"
},
"php": {
"version": "8.0"
},
"llvm": {
"version": "13"
}

View File

@@ -459,6 +459,9 @@
"mongodb": {
"version": "5.0"
},
"php": {
"version": "8.0"
},
"llvm": {
"version": "13"
}

View File

@@ -310,5 +310,8 @@
},
"mongodb": {
"version": "5.0"
},
"php": {
"version": "8.0"
}
}