diff --git a/.gitignore b/.gitignore index d875beb784..e6e017f85e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ /phpBB/cache/*.php /phpBB/cache/queue.php.lock /phpBB/config.php +/phpBB/config_dev.php +/phpBB/config_test.php /phpBB/ext/* /phpBB/files/* /phpBB/images/avatars/gallery/* diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..d5e1231584 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,25 @@ +language: php +php: + - 5.3.2 + - 5.4 + +env: + - DB=mysql + - DB=postgres + +before_script: + - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres; fi" + - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'create database phpbb_tests;' -U postgres; fi" + - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS phpbb_tests;'; fi" + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ]; then pear install --force phpunit/DbUnit; else pyrus install --force phpunit/DbUnit; fi" + - phpenv rehash + +script: + - phpunit --configuration travis/phpunit-$DB-travis.xml + +notifications: + email: + recipients: + - dev-team@phpbb.com + on_success: change + on_failure: change diff --git a/README.md b/README.md index 6b94f898a3..51e65176c6 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,12 @@ Find support and lots more on [phpBB.com](http://www.phpbb.com)! Discuss the dev 3. [Read our Git Contribution Guidelines](http://wiki.phpbb.com/Git); if you're new to git, also read [the introduction guide](http://wiki.phpbb.com/display/DEV/Working+with+Git) 4. Send us a pull request +## AUTOMATED TESTING + +We have unit and functional tests in order to prevent regressions. You can view the bamboo continuous integration [here](http://bamboo.phpbb.com) or check our travis build below. +develop - [![Build Status](https://secure.travis-ci.org/phpbb/phpbb3.png?branch=develop)](http://travis-ci.org/phpbb/phpbb3) +develop-olympus - [![Build Status](https://secure.travis-ci.org/phpbb/phpbb3.png?branch=develop-olympus)](http://travis-ci.org/phpbb/phpbb3) + ## LICENSE [GNU General Public License v2](http://opensource.org/licenses/gpl-2.0.php) diff --git a/phpBB/common.php b/phpBB/common.php index dd49b29528..5c468d74a2 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -5,7 +5,7 @@ * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * -* Minimum Requirement: PHP 5.2.0 +* Minimum Requirement: PHP 5.3.2 */ /** diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 80ba1b251a..4088657743 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1528,6 +1528,7 @@ function get_schema_struct() 'report_closed' => array('BOOL', 0), 'report_time' => array('TIMESTAMP', 0), 'report_text' => array('MTEXT_UNI', ''), + 'reported_post_text' => array('MTEXT_UNI', ''), ), 'PRIMARY_KEY' => 'report_id', 'KEYS' => array( diff --git a/phpBB/develop/create_search_index.php b/phpBB/develop/create_search_index.php index 1de20f3099..f329b805a0 100644 --- a/phpBB/develop/create_search_index.php +++ b/phpBB/develop/create_search_index.php @@ -35,7 +35,6 @@ $search_errors = array(); $search = new $class_name($search_errors); $batch_size = isset($argv[2]) ? $argv[2] : 2000; -$time = time(); if (method_exists($search, 'create_index')) { @@ -67,6 +66,7 @@ else while ($post_counter <= $max_post_id) { $row_count = 0; + $time = time(); printf("Processing posts with %d <= post_id <= %d\n", $post_counter + 1, diff --git a/phpBB/develop/extensions.php b/phpBB/develop/extensions.php index 2f7c3d1167..43621f3080 100644 --- a/phpBB/develop/extensions.php +++ b/phpBB/develop/extensions.php @@ -37,6 +37,13 @@ function list_extensions() global $phpbb_extension_manager; $phpbb_extension_manager->load_extensions(); + $all = array_keys($phpbb_extension_manager->all_available()); + + if (empty($all)) + { + echo "There were no extensions found.\n"; + exit(3); + } echo "Enabled:\n"; $enabled = array_keys($phpbb_extension_manager->all_enabled()); @@ -49,7 +56,6 @@ function list_extensions() echo "\n"; echo "Available:\n"; - $all = array_keys($phpbb_extension_manager->all_available()); $purged = array_diff($all, $enabled, $disabled); print_extensions($purged); } diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index 9b27ac06bc..e3d56baa36 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -138,7 +138,7 @@
  • Oracle
  • -
  • PHP 5.2.0+ with support for the database you intend to use.
  • +
  • PHP 5.3.2+ with support for the database you intend to use.
  • getimagesize() function need to be enabled.
  • These optional presence of the following modules within PHP will provide access to additional features, but they are not required. -

    {L_NO_TOPICS_QUEUE}{L_UNAPPROVED_POSTS_ZERO_TOTAL}

    +

    {L_NO_TOPICS_QUEUE}{L_NO_POSTS_QUEUE}

    diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html index 6943dd41b3..ab0c83a56f 100644 --- a/phpBB/styles/prosilver/template/mcp_topic.html +++ b/phpBB/styles/prosilver/template/mcp_topic.html @@ -106,7 +106,7 @@ onload_functions.push('subPanels()');
    - +

    {postrow.POST_SUBJECT}

    {postrow.MINI_POST_IMG} {L_POSTED} {postrow.POST_DATE} {L_POST_BY_AUTHOR} {postrow.POST_AUTHOR_FULL} [ {L_POST_DETAILS} ]

    @@ -158,6 +158,7 @@ onload_functions.push('subPanels()'); +  
    {L_MARK_ALL} :: {L_UNMARK_ALL}
    diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index 4b41693ded..f10ec64975 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -69,7 +69,7 @@
    {L_JABBER}:
    {L_SEND_JABBER_MESSAGE}
    {L_JABBER}:
    {USER_JABBER}
    -
    {postrow.PROFILE_FIELD1_NAME}:
    {postrow.PROFILE_FIELD1_VALUE}
    +
    {PROFILE_FIELD1_NAME}:
    {PROFILE_FIELD1_VALUE}
    diff --git a/phpBB/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index 67627f9785..1c4b67044d 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -17,7 +17,7 @@
    {topic_review_row.L_IGNORE_POST} -
    +
    diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index 7eb00bd808..574e9ceb3a 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -1,12 +1,51 @@ -/* General Markup Styles +/* CSS Reset http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 ---------------------------------------- */ - -* { - /* Reset browsers default margin, padding and font sizes */ +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { margin: 0; padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; } +/* General Markup Styles +---------------------------------------- */ html { font-size: 100%; /* Always show a scrollbar for short pages - stops the jump when the scrollbar appears. non-IE browsers */ @@ -20,6 +59,7 @@ body { background-color: #FFFFFF; /*font-size: 62.5%; This sets the default font size to be equivalent to 10px */ font-size: 10px; + line-height: normal; margin: 0; padding: 12px 0; } @@ -99,6 +139,39 @@ p.right { text-align: right; } +b, strong { + font-weight: bold; +} + +i, em { + font-style: italic; +} + +u { + text-decoration: underline; +} + +ul { + list-style-type: disc; +} + +ol { + list-style-type: decimal; +} + +li { + display: list-item; +} + +ul ul, ol ul { + list-style-type: circle; +} + +ol ol ul, ol ul ul, ul ol ul, ul ul ul { + list-style-type: square; +} + + /* Main blocks ---------------------------------------- */ #wrap { diff --git a/phpBB/styles/subsilver2/template/mcp_queue.html b/phpBB/styles/subsilver2/template/mcp_queue.html index 6e39ccd272..d13af91888 100644 --- a/phpBB/styles/subsilver2/template/mcp_queue.html +++ b/phpBB/styles/subsilver2/template/mcp_queue.html @@ -27,7 +27,7 @@ - {L_NO_TOPICS_QUEUE}{L_UNAPPROVED_POSTS_ZERO_TOTAL} + {L_NO_TOPICS_QUEUE}{L_NO_POSTS_QUEUE} diff --git a/phpBB/styles/subsilver2/template/mcp_topic.html b/phpBB/styles/subsilver2/template/mcp_topic.html index 83c95c4ff9..8ff648da39 100644 --- a/phpBB/styles/subsilver2/template/mcp_topic.html +++ b/phpBB/styles/subsilver2/template/mcp_topic.html @@ -135,6 +135,7 @@ +   diff --git a/phpBB/styles/subsilver2/template/posting_topic_review.html b/phpBB/styles/subsilver2/template/posting_topic_review.html index 2bfa95f3d4..cbd6746a8a 100644 --- a/phpBB/styles/subsilver2/template/posting_topic_review.html +++ b/phpBB/styles/subsilver2/template/posting_topic_review.html @@ -51,6 +51,13 @@
    + + + + {REPORTED_IMG} + +
    +
    {topic_review_row.MESSAGE}
    diff --git a/phpunit.xml.all b/phpunit.xml.all index b835a38c20..fde3bbb1a7 100644 --- a/phpunit.xml.all +++ b/phpunit.xml.all @@ -14,10 +14,6 @@ ./tests/ - ./tests/functional - - - ./tests/functional diff --git a/phpunit.xml.dist b/phpunit.xml.dist index da31dce5e3..27dee48aac 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -14,10 +14,6 @@ ./tests/ - ./tests/functional - - - ./tests/functional diff --git a/phpunit.xml.functional b/phpunit.xml.functional index 91d569e65b..9facbcff8b 100644 --- a/phpunit.xml.functional +++ b/phpunit.xml.functional @@ -14,10 +14,6 @@ ./tests/ - ./tests/functional - - - ./tests/functional diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 302701e3b3..f103d8f15a 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -25,8 +25,4 @@ require_once 'test_framework/phpbb_test_case_helpers.php'; require_once 'test_framework/phpbb_test_case.php'; require_once 'test_framework/phpbb_database_test_case.php'; require_once 'test_framework/phpbb_database_test_connection_manager.php'; - -if (version_compare(PHP_VERSION, '5.3.0-dev', '>=')) -{ - require_once 'test_framework/phpbb_functional_test_case.php'; -} +require_once 'test_framework/phpbb_functional_test_case.php'; diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php new file mode 100644 index 0000000000..4ee0e68718 --- /dev/null +++ b/tests/functional/extension_controller_test.php @@ -0,0 +1,153 @@ +phpbb_extension_manager = $this->get_extension_manager(); + + $this->purge_cache(); + } + + /** + * Check an extension at ./ext/foobar/ which should have the class + * phpbb_ext_foobar_controller + */ + public function test_foobar() + { + $this->phpbb_extension_manager->enable('foobar'); + $crawler = $this->request('GET', 'index.php?ext=foobar'); + $this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text()); + $this->phpbb_extension_manager->purge('foobar'); + } + + /** + * Check an extension at ./ext/foo/bar/ which should have the class + * phpbb_ext_foo_bar_controller + */ + public function test_foo_bar() + { + $this->phpbb_extension_manager->enable('foo/bar'); + $crawler = $this->request('GET', 'index.php?ext=foo/bar'); + $this->assertContains("This is for testing purposes.", $crawler->filter('#page-body')->text()); + $this->phpbb_extension_manager->purge('foo/bar'); + } + + /** + * Check the error produced by extension at ./ext/error/class which has class + * phpbb_ext_foobar_controller + */ + public function test_error_class_name() + { + $this->phpbb_extension_manager->enable('error/class'); + $crawler = $this->request('GET', 'index.php?ext=error/class'); + $this->assertContains("The extension error/class is missing a controller class and cannot be accessed through the front-end.", $crawler->filter('#message')->text()); + $this->phpbb_extension_manager->purge('error/class'); + } + + /** + * Check the error produced by extension at ./ext/error/classtype which has class + * phpbb_ext_error_classtype_controller but does not implement phpbb_extension_controller_interface + */ + public function test_error_class_type() + { + $this->phpbb_extension_manager->enable('error/classtype'); + $crawler = $this->request('GET', 'index.php?ext=error/classtype'); + $this->assertContains("The extension controller class phpbb_ext_error_classtype_controller is not an instance of the phpbb_extension_controller_interface.", $crawler->filter('#message')->text()); + $this->phpbb_extension_manager->purge('error/classtype'); + } + + /** + * Check the error produced by extension at ./ext/error/disabled that is (obviously) + * a disabled extension + */ + public function test_error_ext_disabled() + { + $crawler = $this->request('GET', 'index.php?ext=error/disabled'); + $this->assertContains("The extension error/disabled is not enabled", $crawler->filter('#message')->text()); + } + + /** + * Check the error produced by extension at ./ext/error/404 that is (obviously) + * not existant + */ + public function test_error_ext_missing() + { + $crawler = $this->request('GET', 'index.php?ext=error/404'); + $this->assertContains("The extension error/404 does not exist.", $crawler->filter('#message')->text()); + } +} diff --git a/tests/functional/fixtures/ext/error/class/controller.php b/tests/functional/fixtures/ext/error/class/controller.php new file mode 100644 index 0000000000..eb2ae362a6 --- /dev/null +++ b/tests/functional/fixtures/ext/error/class/controller.php @@ -0,0 +1,17 @@ +set_ext_dir_prefix($phpbb_root_path . 'ext/error/class/'); + + $template->set_filenames(array( + 'body' => 'index_body.html' + )); + + page_header('Test extension'); + page_footer(); + } +} diff --git a/tests/functional/fixtures/ext/error/class/ext.php b/tests/functional/fixtures/ext/error/class/ext.php new file mode 100644 index 0000000000..f97ad2b838 --- /dev/null +++ b/tests/functional/fixtures/ext/error/class/ext.php @@ -0,0 +1,6 @@ +set_ext_dir_prefix($phpbb_root_path . 'ext/error/classtype/'); + + $template->set_filenames(array( + 'body' => 'index_body.html' + )); + + page_header('Test extension'); + page_footer(); + } +} diff --git a/tests/functional/fixtures/ext/error/classtype/ext.php b/tests/functional/fixtures/ext/error/classtype/ext.php new file mode 100644 index 0000000000..35b1cd15a2 --- /dev/null +++ b/tests/functional/fixtures/ext/error/classtype/ext.php @@ -0,0 +1,6 @@ +set_ext_dir_prefix($phpbb_root_path . 'ext/error/disabled/'); + + $template->set_filenames(array( + 'body' => 'index_body.html' + )); + + page_header('Test extension'); + page_footer(); + } +} diff --git a/tests/functional/fixtures/ext/error/disabled/ext.php b/tests/functional/fixtures/ext/error/disabled/ext.php new file mode 100644 index 0000000000..aec8051848 --- /dev/null +++ b/tests/functional/fixtures/ext/error/disabled/ext.php @@ -0,0 +1,6 @@ +set_ext_dir_prefix($phpbb_root_path . 'ext/foo/bar/'); + + $template->set_filenames(array( + 'body' => 'foobar_body.html' + )); + + page_header('Test extension'); + page_footer(); + } +} diff --git a/tests/functional/fixtures/ext/foo/bar/ext.php b/tests/functional/fixtures/ext/foo/bar/ext.php new file mode 100644 index 0000000000..3a2068631e --- /dev/null +++ b/tests/functional/fixtures/ext/foo/bar/ext.php @@ -0,0 +1,6 @@ + + +
    This is for testing purposes.
    + + diff --git a/tests/functional/fixtures/ext/foobar/controller.php b/tests/functional/fixtures/ext/foobar/controller.php new file mode 100644 index 0000000000..bf8d8139ae --- /dev/null +++ b/tests/functional/fixtures/ext/foobar/controller.php @@ -0,0 +1,17 @@ +set_ext_dir_prefix($phpbb_root_path . 'ext/foobar/'); + + $template->set_filenames(array( + 'body' => 'foobar_body.html' + )); + + page_header('Test extension'); + page_footer(); + } +} diff --git a/tests/functional/fixtures/ext/foobar/ext.php b/tests/functional/fixtures/ext/foobar/ext.php new file mode 100644 index 0000000000..7cf443d369 --- /dev/null +++ b/tests/functional/fixtures/ext/foobar/ext.php @@ -0,0 +1,6 @@ + + +
    This is for testing purposes.
    + + diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index b5e6f7e377..69c62af297 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -14,6 +14,10 @@ class phpbb_functional_test_case extends phpbb_test_case protected $client; protected $root_url; + protected $cache = null; + protected $db = null; + protected $extension_manager = null; + static protected $config = array(); static protected $already_installed = false; @@ -66,6 +70,60 @@ class phpbb_functional_test_case extends phpbb_test_case } } + protected function get_db() + { + global $phpbb_root_path, $phpEx; + // so we don't reopen an open connection + if (!($this->db instanceof dbal)) + { + if (!class_exists('dbal_' . self::$config['dbms'])) + { + include($phpbb_root_path . 'includes/db/' . self::$config['dbms'] . ".$phpEx"); + } + $sql_db = 'dbal_' . self::$config['dbms']; + $this->db = new $sql_db(); + $this->db->sql_connect(self::$config['dbhost'], self::$config['dbuser'], self::$config['dbpasswd'], self::$config['dbname'], self::$config['dbport']); + } + return $this->db; + } + + protected function get_cache_driver() + { + if (!$this->cache) + { + $this->cache = new phpbb_cache_driver_file; + } + + return $this->cache; + } + + protected function purge_cache() + { + $cache = $this->get_cache_driver(); + + $cache->purge(); + $cache->unload(); + $cache->load(); + } + + protected function get_extension_manager() + { + global $phpbb_root_path, $phpEx; + + if (!$this->extension_manager) + { + $this->extension_manager = new phpbb_extension_manager( + $this->get_db(), + self::$config['table_prefix'] . 'ext', + $phpbb_root_path, + ".$phpEx", + $this->get_cache_driver() + ); + } + + return $this->extension_manager; + } + protected function install_board() { global $phpbb_root_path, $phpEx; diff --git a/travis/phpunit-mysql-travis.xml b/travis/phpunit-mysql-travis.xml new file mode 100644 index 0000000000..36845a7f71 --- /dev/null +++ b/travis/phpunit-mysql-travis.xml @@ -0,0 +1,34 @@ + + + + + ../tests/ + + + + + + slow + + + + + + + + + + + + + diff --git a/travis/phpunit-postgres-travis.xml b/travis/phpunit-postgres-travis.xml new file mode 100644 index 0000000000..461a53bcb1 --- /dev/null +++ b/travis/phpunit-postgres-travis.xml @@ -0,0 +1,36 @@ + + + + + ../tests/ + + + + + + slow + + + + + + + + + + + + + + +