diff options
-rw-r--r-- | .appveyor.yml | 26 | ||||
-rw-r--r-- | phpBB/phpbb/tree/nestedset.php | 2 | ||||
-rw-r--r-- | tests/test_framework/phpbb_database_test_connection_manager.php | 8 | ||||
-rw-r--r-- | tests/tree/nestedset_forum_base.php | 10 |
4 files changed, 42 insertions, 4 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index ef301584b7..9e5d687372 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -3,9 +3,23 @@ clone_folder: c:\projects\phpbb version: '{build}' services: - - mssql2014 - 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: phpbb.test: 127.0.0.1 @@ -16,7 +30,13 @@ init: before_test: - 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% - 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|]','') @@ -49,7 +69,7 @@ before_test: - php ..\composer.phar install - cd c:\projects\phpbb\tests - 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 - 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'} diff --git a/phpBB/phpbb/tree/nestedset.php b/phpBB/phpbb/tree/nestedset.php index 7149513fd9..68485d04be 100644 --- a/phpBB/phpbb/tree/nestedset.php +++ b/phpBB/phpbb/tree/nestedset.php @@ -533,7 +533,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface $row = $this->db->sql_fetchrow($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 . ' diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index 147029d699..74170f2f35 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -222,6 +222,14 @@ class phpbb_database_test_connection_manager $this->purge_extras(); 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: $this->connect(false); diff --git a/tests/tree/nestedset_forum_base.php b/tests/tree/nestedset_forum_base.php index 3daa75b2e4..62f3e0bcab 100644 --- a/tests/tree/nestedset_forum_base.php +++ b/tests/tree/nestedset_forum_base.php @@ -100,6 +100,11 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case } 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->insert_all($forums); $buffer->flush(); @@ -107,6 +112,11 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case $this->database_synchronisation(array( '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); + } } } |