diff options
| -rw-r--r-- | .travis.yml | 5 | ||||
| -rw-r--r-- | build/build.xml | 42 | ||||
| -rw-r--r-- | phpBB/includes/captcha/captcha_non_gd.php | 2 | ||||
| -rw-r--r-- | phpBB/includes/db/db_tools.php | 16 | ||||
| -rw-r--r-- | phpBB/includes/functions_install.php | 2 | ||||
| -rw-r--r-- | phpBB/includes/mcp/mcp_pm_reports.php | 1 | ||||
| -rw-r--r-- | tests/RUNNING_TESTS.txt | 21 | ||||
| -rw-r--r-- | tests/template/template_test.php | 24 | ||||
| -rw-r--r-- | tests/template/templates/include_define.html | 2 | ||||
| -rw-r--r-- | tests/template/templates/include_define_variable.html | 2 | ||||
| -rw-r--r-- | tests/template/templates/include_loop_define.html | 4 |
11 files changed, 108 insertions, 13 deletions
diff --git a/.travis.yml b/.travis.yml index 94e7086c1e..ba8c1b4a91 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,16 @@ php: - 5.3.3 - 5.3 - 5.4 + - 5.5 env: - DB=mysql - DB=postgres +matrix: + allow_failures: + - php: 5.5 + before_script: - sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres; fi" - sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'create database phpbb_tests;' -U postgres; fi" diff --git a/build/build.xml b/build/build.xml index d21ed99fd7..f9574a3d4d 100644 --- a/build/build.xml +++ b/build/build.xml @@ -11,8 +11,7 @@ <property name="versions" value="${oldversions}, ${newversion}" /> <!-- These are the main targets which you will probably want to use --> - <target name="package" depends="clean,prepare,composer,create-package" /> - <target name="all" depends="clean,prepare,composer,test,docs,create-package" /> + <target name="all" depends="clean,prepare,composer,test,docs,package" /> <target name="build" depends="clean,prepare,composer,test,docs" /> <target name="prepare"> @@ -43,9 +42,15 @@ <delete dir="build/save" /> </target> - <target name="composer" depends="clean,prepare"> - <exec dir="./phpBB/" - command="php ../composer.phar install" + <!-- + This target basically just runs composer in the phpBB tree to ensure + all dependencies are loaded. Additional development dependencies are + loaded because testing framework may depend on them. + --> + <target name="composer"> + <exec dir="phpBB" + command="php ../composer.phar install --dev" + checkreturn="true" passthru="true" /> </target> @@ -122,7 +127,7 @@ </target> - <target name="create-package" depends="prepare-new-version,old-version-diffs"> + <target name="package" depends="clean,prepare,prepare-new-version,old-version-diffs"> <exec dir="build" command="php -f package.php '${versions}' > logs/package.log" escape="false" /> <exec dir="build" command="php -f build_diff.php '${prevversion}' '${newversion}' > logs/build_diff.log" escape="false" /> @@ -162,9 +167,27 @@ command="git archive ${revision} | tar -xf - -C ../${dir}" checkreturn="true" /> - <exec dir="${dir}" - command="php ../composer.phar install" - passthru="true" /> + <!-- + If composer.phar exists in this version of the tree, also export + it into ${dir}, install dependencies, then delete it again. + --> + <exec dir="." + command="git ls-tree ${revision} composer.phar" + checkreturn="true" + outputProperty='composer-ls-tree-output' /> + <if> + <not><equals arg1="${composer-ls-tree-output}" arg2="" trim="true" /></not> + <then> + <exec dir="." + command="git archive ${revision} composer.phar | tar -xf - -C ${dir}" + checkreturn="true" /> + <exec dir="${dir}" + command="php composer.phar install" + checkreturn="true" + passthru="true" /> + <delete file="${dir}/composer.phar" /> + </then> + </if> <delete file="${dir}/config.php" /> <delete dir="${dir}/develop" /> @@ -187,6 +210,7 @@ <delete dir="${dir}/files" /> <delete dir="${dir}/install" /> <delete dir="${dir}/store" /> + <delete dir="${dir}/vendor" /> </target> </project> diff --git a/phpBB/includes/captcha/captcha_non_gd.php b/phpBB/includes/captcha/captcha_non_gd.php index f82896f628..2adf909b96 100644 --- a/phpBB/includes/captcha/captcha_non_gd.php +++ b/phpBB/includes/captcha/captcha_non_gd.php @@ -119,7 +119,7 @@ class captcha $new_line = ''; $end = strlen($scanline) - ceil($width/2); - for ($i = floor($width/2); $i < $end; $i++) + for ($i = (int) floor($width / 2); $i < $end; $i++) { $pixel = ord($scanline{$i}); diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php index c6dd23e6bd..f63ff18cbe 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/includes/db/db_tools.php @@ -1819,6 +1819,22 @@ class phpbb_db_tools case 'mssql': case 'mssqlnative': + // remove default cosntraints first + // http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx + $statements[] = "DECLARE @drop_default_name VARCHAR(100), @cmd VARCHAR(1000) + SET @drop_default_name = + (SELECT so.name FROM sysobjects so + JOIN sysconstraints sc ON so.id = sc.constid + WHERE object_name(so.parent_obj) = '{$table_name}' + AND so.xtype = 'D' + AND sc.colid = (SELECT colid FROM syscolumns + WHERE id = object_id('{$table_name}') + AND name = '{$column_name}')) + IF @drop_default_name <> '' + BEGIN + SET @cmd = 'ALTER TABLE [{$table_name}] DROP CONSTRAINT [' + @drop_default_name + ']' + EXEC(@cmd) + END"; $statements[] = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']'; break; diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index eae136808c..47f4eac627 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -55,6 +55,8 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'AVAILABLE' => true, '2.0.x' => false, ), + // Note: php 5.5 alpha 2 deprecated mysql. + // Keep mysqli before mysql in this list. 'mysqli' => array( 'LABEL' => 'MySQL with MySQLi Extension', 'SCHEMA' => 'mysql_41', diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index 72f77fae7c..77bc7680e6 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -123,6 +123,7 @@ class mcp_pm_reports $message = bbcode_nl2br($message); $message = smiley_text($message); + $report['report_text'] = make_clickable(bbcode_nl2br($report['report_text'])); if ($pm_info['message_attachment'] && $auth->acl_get('u_pm_download')) { diff --git a/tests/RUNNING_TESTS.txt b/tests/RUNNING_TESTS.txt index 7c2a7c3fce..de9c751238 100644 --- a/tests/RUNNING_TESTS.txt +++ b/tests/RUNNING_TESTS.txt @@ -17,7 +17,24 @@ PHP extensions Unit tests use several PHP extensions that board code does not use. Currently the following PHP extensions must be installed and enabled to run unit tests: -- ctype +- ctype (also a PHPUnit dependency) +- dom (PHPUnit dependency) + +Some of the functionality in phpBB and/or the test suite uses additional +PHP extensions. If these extensions are not loaded, respective tests +will be skipped: + +- apc (APC cache driver) +- bz2 (compress tests) +- interbase, pdo_firebird (Firebird database driver) +- mysql, pdo_mysql (MySQL database driver) +- mysqli, pdo_mysql (MySQLi database driver) +- pdo (any database tests) +- pgsql, pdo_pgsql (PostgreSQL database driver) +- simplexml (any database tests) +- sqlite, pdo_sqlite (SQLite database driver, requires SQLite 2.x support + in pdo_sqlite) +- zlib (compress tests) Database Tests -------------- @@ -44,7 +61,7 @@ to use in the environment as follows: $ PHPBB_TEST_CONFIG=tests/test_config.php phpunit Alternatively you can specify parameters in the environment, so e.g. the -following will run phpunit with the same parameters as in the shown +following will run PHPUnit with the same parameters as in the shown test_config.php file: $ PHPBB_TEST_DBMS='mysqli' PHPBB_TEST_DBHOST='localhost' \ diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 9b3c6ac245..e532de294c 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -233,12 +233,34 @@ class phpbb_template_template_test extends phpbb_test_case 'value', ), array( + 'include_define.html', + array('VARIABLE' => 'value'), + array(), + array(), + 'value', + ), + array( 'loop_vars.html', array(), array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())), array('loop'), '', - ),/* no top level nested loops + ), + array( + 'include_define_variable.html', + array('VARIABLE' => 'variable.html'), + array(), + array(), + 'variable.html', + ), + array( + 'include_loop_define.html', + array('VARIABLE' => 'value'), + array('loop' => array(array('NESTED_FILE' => 'variable.html'))), + array(), + 'value', + ), + /* no top level nested loops array( 'loop_vars.html', array(), diff --git a/tests/template/templates/include_define.html b/tests/template/templates/include_define.html new file mode 100644 index 0000000000..2419c8cba1 --- /dev/null +++ b/tests/template/templates/include_define.html @@ -0,0 +1,2 @@ +<!-- DEFINE $DEF = 'variable.html' --> +<!-- INCLUDE {$DEF} --> diff --git a/tests/template/templates/include_define_variable.html b/tests/template/templates/include_define_variable.html new file mode 100644 index 0000000000..aff9b574c2 --- /dev/null +++ b/tests/template/templates/include_define_variable.html @@ -0,0 +1,2 @@ +<!-- DEFINE $DEF = '{VARIABLE}' --> +<!-- INCLUDE {$DEF} --> diff --git a/tests/template/templates/include_loop_define.html b/tests/template/templates/include_loop_define.html new file mode 100644 index 0000000000..f539b21396 --- /dev/null +++ b/tests/template/templates/include_loop_define.html @@ -0,0 +1,4 @@ +<!-- BEGIN loop --> +<!-- DEFINE $DEF = '{loop.NESTED_FILE}' --> +<!-- INCLUDE {$DEF} --> +<!-- END loop --> |
