@@ -32,13 +32,67 @@ function Add-TestRequirements {
3232 [string ] $VsVersion ,
3333 [Parameter (Mandatory = $false , Position = 4 , HelpMessage = ' Tests Directory' )]
3434 [ValidateLength (1 , [int ]::MaxValue)]
35- [string ] $TestsDirectory
35+ [string ] $TestsDirectory ,
36+ [Parameter (Mandatory = $true , Position = 5 , HelpMessage = ' Artifacts Directory' )]
37+ [ValidateNotNull ()]
38+ [string ] $ArtifactsDirectory
3639 )
3740 begin {
3841 }
3942 process {
40- Get-PhpBuild - PhpVersion $PhpVersion - Arch $Arch - Ts $Ts - VsVersion $VsVersion
41- Get-PhpTestPack - PhpVersion $PhpVersion - TestsDirectory $TestsDirectory
43+ Add-Type - Assembly " System.IO.Compression.Filesystem"
44+ $versionInUrl = $PhpVersion
45+ if ($PhpVersion -eq ' master' ) {
46+ $versionInUrl = " master"
47+ }
48+ $tsPart = if ($Ts -eq " nts" ) {" nts-Win32" } else {" Win32" }
49+ $binZipFile = " php-$versionInUrl -$tsPart -$VsVersion -$Arch .zip"
50+ $testZipFile = " php-test-pack-$versionInUrl .zip"
51+
52+ $currentDirectory = (Get-Location ).Path
53+ $binZipFilePath = Join-Path $ArtifactsDirectory $binZipFile
54+ $binDirectoryPath = Join-Path $currentDirectory phpbin
55+
56+ $testZipFilePath = Join-Path $ArtifactsDirectory $testZipFile
57+ $testsDirectoryPath = Join-Path $currentDirectory $TestsDirectory
58+
59+ if (-not (Test-Path $binZipFilePath )) {
60+ Write-Host " Downloading PHP build $binZipFile ..."
61+ Get-PhpBuild - PhpVersion $PhpVersion - Arch $Arch - Ts $Ts - VsVersion $VsVersion
62+ } else {
63+ [System.IO.Compression.ZipFile ]::ExtractToDirectory($binZipFilePath , $binDirectoryPath )
64+ }
65+
66+ if (-not (Test-Path $testZipFilePath )) {
67+ Write-Host " Downloading PHP test pack $testZipFile ..."
68+ Get-PhpTestPack - PhpVersion $PhpVersion - TestsDirectory $TestsDirectory
69+ } else {
70+ [System.IO.Compression.ZipFile ]::ExtractToDirectory($testZipFilePath , $testsDirectoryPath )
71+ }
72+
73+ $ldapDll = Join-Path $binDirectoryPath ' php_ldap.dll'
74+ Remove-Item - LiteralPath $ldapDll - Force - ErrorAction SilentlyContinue
75+
76+ $phpExePath = Join-Path $binDirectoryPath ' php.exe'
77+ $phpCgiPath = Join-Path $binDirectoryPath ' php-cgi.exe'
78+ try { & editbin " /stack:8388608" $phpExePath | Out-Null } catch {}
79+ try { & editbin " /stack:8388608" $phpCgiPath | Out-Null } catch {}
80+
81+ $Env: TEST_PHPDBG_EXECUTABLE = (Join-Path $binDirectoryPath ' phpdbg.exe' )
82+
83+ Get-PhpSdk
84+ $env: DEPS_DIR = " $currentDirectory /../deps"
85+ New-Item " $env: DEPS_DIR " - ItemType " directory" - Force > $null 2>&1
86+ $branch = if ($PhpVersion -eq ' master' ) {' master' } else {($PhpVersion -split ' \.' )[0 .. 1 ] -join ' .' }
87+ & " $currentDirectory \php-sdk\bin\phpsdk_deps.bat" -- update -- no- backup -- branch $branch -- stability staging -- deps $env: DEPS_DIR -- crt $VsVersion -- arch $Arch
88+
89+ Set-MySqlTestEnvironment
90+ Set-PgSqlTestEnvironment
91+ Set-OdbcTestEnvironment
92+ Set-MsSqlTestEnvironment
93+ Set-FirebirdTestEnvironment
94+ Set-EnchantTestEnvironment
95+ Set-SnmpTestEnvironment - TestsDirectoryPath $testsDirectoryPath
4296 }
4397 end {
4498 }
0 commit comments