Skip to content

Commit 36becc9

Browse files
committed
Fix testing pdo_oci extension
1 parent d9403b0 commit 36becc9

File tree

4 files changed

+59
-3
lines changed

4 files changed

+59
-3
lines changed

extension/BuildPhpExtension/BuildPhpExtension.psd1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
'Get-PhpBuildDetails',
9191
'Get-PhpDevelBuild',
9292
'Get-PhpSdk',
93+
'Get-PhpSrc',
9394
'Get-TempFiles',
9495
'Get-VsVersionHelper',
9596
'Get-VsVersion',

extension/BuildPhpExtension/private/Add-OciSdk.ps1

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ Function Add-OciSdk {
1414
}
1515
process {
1616
$suffix = if ($Config.arch -eq "x64") {"windows"} else {"nt"}
17-
$url = "https://download.oracle.com/otn_software/nt/instantclient/instantclient-sdk-$suffix.zip"
18-
Invoke-WebRequest $url -OutFile "instantclient-sdk.zip"
19-
Expand-Archive -Path "instantclient-sdk.zip" -DestinationPath "../deps"
17+
@('sdk', 'basic') | ForEach-Object {
18+
$url = "https://download.oracle.com/otn_software/nt/instantclient/instantclient-$_-$suffix.zip"
19+
Invoke-WebRequest $url -OutFile "instantclient-$_.zip"
20+
Expand-Archive -Path "instantclient-$_.zip" -DestinationPath "../deps" -Force
21+
}
2022
Copy-Item ../deps/instantclient_*/sdk/* -Destination "../deps" -Recurse -Force
23+
New-Item -ItemType Directory -Path "../deps/bin" -Force | Out-Null
24+
Copy-Item ../deps/instantclient_*/* -Destination "../deps" -Recurse -Force
25+
Add-Path -PathItem (Join-Path (Get-Location).Path ../deps)
2126
}
2227
end {
2328
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
function Get-PhpSrc {
2+
<#
3+
.SYNOPSIS
4+
Get the PHP source code.
5+
.PARAMETER PhpVersion
6+
PHP Version
7+
#>
8+
[OutputType()]
9+
param (
10+
[Parameter(Mandatory = $true, Position=0, HelpMessage='PHP Version')]
11+
[ValidateNotNull()]
12+
[ValidateLength(1, [int]::MaxValue)]
13+
[string] $PhpVersion
14+
)
15+
begin {
16+
}
17+
process {
18+
Add-Type -Assembly "System.IO.Compression.Filesystem"
19+
20+
$baseUrl = "https://github.com/php/php-src/archive"
21+
$zipFile = "php-$PhpVersion.zip"
22+
$directory = "php-$PhpVersion-src"
23+
24+
if ($PhpVersion.Contains(".")) {
25+
$ref = "php-$PhpVersion"
26+
$url = "$baseUrl/PHP-$PhpVersion.zip"
27+
} else {
28+
$ref = $PhpVersion
29+
$url = "$baseUrl/$PhpVersion.zip"
30+
}
31+
32+
$currentDirectory = (Get-Location).Path
33+
$zipFilePath = Join-Path $currentDirectory $zipFile
34+
$directoryPath = Join-Path $currentDirectory $directory
35+
$srcZipFilePath = Join-Path $currentDirectory "php-$PhpVersion-src.zip"
36+
37+
Invoke-WebRequest $url -Outfile $zipFile
38+
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipFilePath, $currentDirectory)
39+
Rename-Item -Path "php-src-$ref" -NewName $directory
40+
[System.IO.Compression.ZipFile]::CreateFromDirectory($directoryPath, $srcZipFilePath)
41+
Add-BuildLog tick "php-src" "PHP source for $PhpVersion added"
42+
}
43+
end {
44+
}
45+
}

extension/BuildPhpExtension/private/Invoke-Tests.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ Function Invoke-Tests {
2222
$env:MAGICK_CONFIGURE_PATH = "$currentDirectory\..\deps\bin"
2323
$env:PHP_AMQP_HOST="rabbitmq"
2424
$env:PHP_AMQP_SSL_HOST="rabbitmq.example.org"
25+
if($Config.name -eq 'pdo_oci') {
26+
Get-PhpSrc -PhpVersion $Config.php_version
27+
$env:PDO_TEST_DIR = "$currentDirectory\php-$($Config.php_version)-src\ext\pdo\tests"
28+
$env:PDO_OCI_TEST_DIR = "$currentDirectory\tests"
29+
}
2530
$tempOriginal = $env:TEMP
2631
Get-TempFiles
2732
$type='extension'

0 commit comments

Comments
 (0)