[ticket/15055] Try using build matrix

PHPBB3-15055
This commit is contained in:
Marc Alexander 2017-12-25 19:20:02 +01:00
parent 400fc0f73d
commit 27a24d0a67
4 changed files with 42 additions and 4 deletions

View file

@ -3,9 +3,23 @@ clone_folder: c:\projects\phpbb
version: '{build}' version: '{build}'
services: services:
- mssql2014
- iis - iis
environment:
matrix:
- db: mssql
db_version: sql2012sp1
php: 7.1
- db: mssql
db_version: sql2014
php: 7.1
- db: mssql
db_version: sql2016
php: 7.1
- db: mssql
db_version: sql2017
php: 7.1
hosts: hosts:
phpbb.test: 127.0.0.1 phpbb.test: 127.0.0.1
@ -16,7 +30,13 @@ init:
before_test: before_test:
- ps: Set-Service wuauserv -StartupType Manual - ps: Set-Service wuauserv -StartupType Manual
- sqlcmd -S "(local)\SQL2014" -Q "Use [master]; CREATE DATABASE [phpbb_test]" - ps: |
$instanceName = $env:db_version.ToUpper()
Start-Service "MSSQL`$$instanceName"
Set-Variable -Name "sqlServerPath" -Value "(local)\$($env:db_version.ToUpper())"
Write-Host "$sqlServerPath"
Write-Host "$env:db_version --> $($env:db_version.ToUpper())"
sqlcmd -S $sqlServerPath -Q "Use [master]; CREATE DATABASE [phpbb_test] COLLATE Latin1_General_CI_AS"
- SET PATH=C:\Program Files\OpenSSL;C:\tools\php;%PATH% - SET PATH=C:\Program Files\OpenSSL;C:\tools\php;%PATH%
- ps: Set-Service wuauserv -StartupType Manual - ps: Set-Service wuauserv -StartupType Manual
- ps: cinst -y php --version ((choco search php --exact --all-versions -r | select-string -pattern 7.1 | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') - ps: cinst -y php --version ((choco search php --exact --all-versions -r | select-string -pattern 7.1 | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
@ -49,7 +69,7 @@ before_test:
- php ..\composer.phar install - php ..\composer.phar install
- cd c:\projects\phpbb\tests - cd c:\projects\phpbb\tests
- touch test_config.php - touch test_config.php
- ps: $data = "<?php`n`n`$dbms = 'phpbb\\db\\driver\\mssqlnative';`n`$dbhost = '.\\sql2014';`n`$dbport = '';`n`$dbname = 'phpbb_test';`n`$dbuser = 'sa';`n`$dbpasswd = 'Password12!';`n`$phpbb_functional_url = 'http://phpbb.test/';"; $data | Out-File -Encoding "Default" "test_config.php" - ps: $data = "<?php`n`n`$dbms = 'phpbb\\db\\driver\\mssqlnative';`n`$dbhost = '.\\$env:db_version';`n`$dbport = '';`n`$dbname = 'phpbb_test';`n`$dbuser = 'sa';`n`$dbpasswd = 'Password12!';`n`$phpbb_functional_url = 'http://phpbb.test/';"; $data | Out-File -Encoding "Default" "test_config.php"
- choco install -y urlrewrite - choco install -y urlrewrite
- ps: New-WebSite -Name 'phpBBTest' -PhysicalPath 'c:\projects\phpbb\phpBB' -Force - ps: New-WebSite -Name 'phpBBTest' -PhysicalPath 'c:\projects\phpbb\phpBB' -Force
- ps: Import-Module WebAdministration; Set-ItemProperty 'IIS:\Sites\phpBBTest' -name Bindings -value @{protocol='http';bindingInformation='*:80:phpbb.test'} - ps: Import-Module WebAdministration; Set-ItemProperty 'IIS:\Sites\phpBBTest' -name Bindings -value @{protocol='http';bindingInformation='*:80:phpbb.test'}

View file

@ -533,7 +533,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface
$row = $this->db->sql_fetchrow($result); $row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result); $this->db->sql_freeresult($result);
$diff = ' + ' . ($row[$this->column_right_id] - (int) $item[$this->column_left_id] + 1); $diff = ' + ' . ((int) $row[$this->column_right_id] - (int) $item[$this->column_left_id] + 1);
} }
$sql = 'UPDATE ' . $this->table_name . ' $sql = 'UPDATE ' . $this->table_name . '

View file

@ -222,6 +222,14 @@ class phpbb_database_test_connection_manager
$this->purge_extras(); $this->purge_extras();
break; break;
case 'phpbb\db\driver\mssql':
case 'phpbb\db\driver\mssqlnative':
$this->connect();
// Drop all tables
$this->pdo->exec("EXEC sp_MSforeachtable 'DROP TABLE ?'");
$this->purge_extras();
break;
default: default:
$this->connect(false); $this->connect(false);

View file

@ -100,6 +100,11 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case
} }
else else
{ {
if (strpos($this->db->sql_layer, 'mssql') !== false)
{
$sql = 'SET IDENTITY_INSERT phpbb_forums ON';
$this->db->sql_query($sql);
}
$buffer = new \phpbb\db\sql_insert_buffer($this->db, 'phpbb_forums'); $buffer = new \phpbb\db\sql_insert_buffer($this->db, 'phpbb_forums');
$buffer->insert_all($forums); $buffer->insert_all($forums);
$buffer->flush(); $buffer->flush();
@ -107,6 +112,11 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case
$this->database_synchronisation(array( $this->database_synchronisation(array(
'phpbb_forums' => array('forum_id'), 'phpbb_forums' => array('forum_id'),
)); ));
if (strpos($this->db->sql_layer, 'mssql') !== false)
{
$sql = 'SET IDENTITY_INSERT phpbb_forums OFF';
$this->db->sql_query($sql);
}
} }
} }