diff options
-rw-r--r-- | phpBB/composer.json | 3 | ||||
-rw-r--r-- | phpBB/composer.lock | 97 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/310/notification_options_reconvert.php | 118 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/310/notifications.php | 64 | ||||
-rw-r--r-- | phpBB/includes/template/asset.php | 182 | ||||
-rw-r--r-- | phpBB/includes/template/twig/node/includeasset.php | 23 | ||||
-rw-r--r-- | tests/mock/sql_insert_buffer.php | 21 | ||||
-rw-r--r-- | tests/notification/convert_test.php | 110 | ||||
-rw-r--r-- | tests/notification/fixtures/convert.xml | 80 | ||||
-rw-r--r-- | tests/template/template_includejs_test.php | 26 | ||||
-rw-r--r-- | tests/template/templates/includejs.html | 8 | ||||
-rw-r--r-- | travis/phpunit-mysql-travis.xml | 4 | ||||
-rw-r--r-- | travis/phpunit-postgres-travis.xml | 4 |
13 files changed, 625 insertions, 115 deletions
diff --git a/phpBB/composer.json b/phpBB/composer.json index a114d5c0e0..bf693d1950 100644 --- a/phpBB/composer.json +++ b/phpBB/composer.json @@ -12,6 +12,7 @@ "require-dev": { "fabpot/goutte": "v0.1.0", "phpunit/dbunit": "1.2.*", - "phpunit/phpunit": "3.7.*" + "phpunit/phpunit": "3.7.*", + "phing/phing": "2.4.*" } } diff --git a/phpBB/composer.lock b/phpBB/composer.lock index a20c6303ee..1ba6cb6f83 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "e4a4f4848a7201d7e044446001afda29", + "hash": "6e6125b88160e28568edcb9fd007abed", "packages": [ { "name": "symfony/config", @@ -29,6 +29,7 @@ "Symfony\\Component\\Config": "" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -78,6 +79,7 @@ "Symfony\\Component\\DependencyInjection": "" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -126,6 +128,7 @@ "Symfony\\Component\\EventDispatcher": "" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -168,6 +171,7 @@ "SessionHandlerInterface": "Symfony/Component/HttpFoundation/Resources/stubs" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -229,6 +233,7 @@ "Symfony\\Component\\HttpKernel": "" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -281,6 +286,7 @@ "Symfony\\Component\\Routing": "" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -322,6 +328,7 @@ "Symfony\\Component\\Yaml": "" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -367,6 +374,7 @@ "Twig_": "lib/" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3" ], @@ -534,6 +542,58 @@ "time": "2012-12-19 23:06:35" }, { + "name": "phing/phing", + "version": "2.4.14", + "source": { + "type": "git", + "url": "https://github.com/phingofficial/phing", + "reference": "2.4.14" + }, + "dist": { + "type": "zip", + "url": "https://github.com/phingofficial/phing/archive/2.4.14.zip", + "reference": "2.4.14", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "bin": [ + "bin/phing" + ], + "type": "library", + "autoload": { + "classmap": [ + "classes/phing/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "classes" + ], + "license": [ + "LGPL3" + ], + "authors": [ + { + "name": "Michiel Rook", + "email": "mrook@php.net" + }, + { + "name": "Phing Community", + "homepage": "http://www.phing.info/trac/wiki/Development/Contributors" + } + ], + "description": "PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.", + "homepage": "http://www.phing.info/", + "keywords": [ + "build", + "task", + "tool" + ], + "time": "2012-11-29 21:23:47" + }, + { "name": "phpunit/dbunit", "version": "1.2.3", "source": { @@ -593,16 +653,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "1.2.11", + "version": "1.2.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "1.2.11" + "reference": "1.2.12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1.2.11", - "reference": "1.2.11", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1.2.12", + "reference": "1.2.12", "shasum": "" }, "require": { @@ -612,13 +672,18 @@ "phpunit/php-token-stream": ">=1.1.3@stable" }, "require-dev": { - "phpunit/phpunit": "3.7.*" + "phpunit/phpunit": "3.7.*@dev" }, "suggest": { "ext-dom": "*", "ext-xdebug": ">=2.0.5" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, "autoload": { "classmap": [ "PHP/" @@ -645,7 +710,7 @@ "testing", "xunit" ], - "time": "2013-05-23 18:23:24" + "time": "2013-07-06 06:26:16" }, { "name": "phpunit/php-file-iterator", @@ -827,16 +892,16 @@ }, { "name": "phpunit/phpunit", - "version": "3.7.21", + "version": "3.7.22", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3.7.21" + "reference": "3.7.22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3.7.21", - "reference": "3.7.21", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3.7.22", + "reference": "3.7.22", "shasum": "" }, "require": { @@ -845,12 +910,12 @@ "ext-reflection": "*", "ext-spl": "*", "php": ">=5.3.3", - "phpunit/php-code-coverage": ">=1.2.1,<1.3.0", + "phpunit/php-code-coverage": "~1.2.1", "phpunit/php-file-iterator": ">=1.3.1", "phpunit/php-text-template": ">=1.1.1", - "phpunit/php-timer": ">=1.0.2,<1.1.0", - "phpunit/phpunit-mock-objects": ">=1.2.0,<1.3.0", - "symfony/yaml": ">=2.0,<3.0" + "phpunit/php-timer": "~1.0.2", + "phpunit/phpunit-mock-objects": "~1.2.0", + "symfony/yaml": "~2.0" }, "require-dev": { "pear-pear/pear": "1.9.4" @@ -897,7 +962,7 @@ "testing", "xunit" ], - "time": "2013-05-23 18:54:29" + "time": "2013-07-06 06:29:15" }, { "name": "phpunit/phpunit-mock-objects", diff --git a/phpBB/includes/db/migration/data/310/notification_options_reconvert.php b/phpBB/includes/db/migration/data/310/notification_options_reconvert.php new file mode 100644 index 0000000000..d994d7ec5f --- /dev/null +++ b/phpBB/includes/db/migration/data/310/notification_options_reconvert.php @@ -0,0 +1,118 @@ +<?php +/** +* +* @package migration +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +class phpbb_db_migration_data_310_notification_options_reconvert extends phpbb_db_migration +{ + static public function depends_on() + { + return array('phpbb_db_migration_data_310_notifications_schema_fix'); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'convert_notifications'))), + ); + } + + public function convert_notifications() + { + $insert_table = $this->table_prefix . 'user_notifications'; + $insert_buffer = new phpbb_db_sql_insert_buffer($this->db, $insert_table); + + $this->perform_conversion($insert_buffer, $insert_table); + } + + /** + * Perform the conversion (separate for testability) + * + * @param phpbb_db_sql_insert_buffer $insert_buffer + * @param string $insert_table + */ + public function perform_conversion(phpbb_db_sql_insert_buffer $insert_buffer, $insert_table) + { + $sql = 'DELETE FROM ' . $insert_table; + $this->db->sql_query($sql); + + $sql = 'SELECT user_id, user_notify_type, user_notify_pm + FROM ' . USERS_TABLE; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $notification_methods = array(); + + // In-board notification + $notification_methods[] = ''; + + if ($row['user_notify_type'] == NOTIFY_EMAIL || $row['user_notify_type'] == NOTIFY_BOTH) + { + $notification_methods[] = 'email'; + } + + if ($row['user_notify_type'] == NOTIFY_IM || $row['user_notify_type'] == NOTIFY_BOTH) + { + $notification_methods[] = 'jabber'; + } + + // Notifications for posts + foreach (array('post', 'topic') as $item_type) + { + $this->add_method_rows( + $insert_buffer, + $item_type, + 0, + $row['user_id'], + $notification_methods + ); + } + + if ($row['user_notify_pm']) + { + // Notifications for private messages + // User either gets all methods or no method + $this->add_method_rows( + $insert_buffer, + 'pm', + 0, + $row['user_id'], + $notification_methods + ); + } + } + $this->db->sql_freeresult($result); + + $insert_buffer->flush(); + } + + /** + * Insert method rows to DB + * + * @param phpbb_db_sql_insert_buffer $insert_buffer + * @param string $item_type + * @param int $item_id + * @param int $user_id + * @param string $methods + */ + protected function add_method_rows(phpbb_db_sql_insert_buffer $insert_buffer, $item_type, $item_id, $user_id, array $methods) + { + $row_base = array( + 'item_type' => $item_type, + 'item_id' => (int) $item_id, + 'user_id' => (int) $user_id, + 'notify' => 1 + ); + + foreach ($methods as $method) + { + $row_base['method'] = $method; + $insert_buffer->insert($row_base); + } + } +} diff --git a/phpBB/includes/db/migration/data/310/notifications.php b/phpBB/includes/db/migration/data/310/notifications.php index 82bfd4cb2d..17c939d95a 100644 --- a/phpBB/includes/db/migration/data/310/notifications.php +++ b/phpBB/includes/db/migration/data/310/notifications.php @@ -91,70 +91,6 @@ class phpbb_db_migration_data_310_notifications extends phpbb_db_migration ), )), array('config.add', array('load_notifications', 1)), - array('custom', array(array($this, 'convert_notifications'))), ); } - - public function convert_notifications() - { - $convert_notifications = array( - array( - 'check' => ($this->config['allow_topic_notify']), - 'item_type' => 'post', - ), - array( - 'check' => ($this->config['allow_forum_notify']), - 'item_type' => 'topic', - ), - array( - 'check' => ($this->config['allow_bookmarks']), - 'item_type' => 'bookmark', - ), - array( - 'check' => ($this->config['allow_privmsg']), - 'item_type' => 'pm', - ), - ); - - foreach ($convert_notifications as $convert_data) - { - if ($convert_data['check']) - { - $sql = 'SELECT user_id, user_notify_type - FROM ' . USERS_TABLE . ' - WHERE user_notify = 1'; - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) - { - $this->sql_query('INSERT INTO ' . $this->table_prefix . 'user_notifications ' . $this->db->sql_build_array('INSERT', array( - 'item_type' => $convert_data['item_type'], - 'item_id' => 0, - 'user_id' => $row['user_id'], - 'method' => '', - ))); - - if ($row['user_notify_type'] == NOTIFY_EMAIL || $row['user_notify_type'] == NOTIFY_BOTH) - { - $this->sql_query('INSERT INTO ' . $this->table_prefix . 'user_notifications ' . $this->db->sql_build_array('INSERT', array( - 'item_type' => $convert_data['item_type'], - 'item_id' => 0, - 'user_id' => $row['user_id'], - 'method' => 'email', - ))); - } - - if ($row['user_notify_type'] == NOTIFY_IM || $row['user_notify_type'] == NOTIFY_BOTH) - { - $this->sql_query('INSERT INTO ' . $this->table_prefix . 'user_notifications ' . $this->db->sql_build_array('INSERT', array( - 'item_type' => $convert_data['item_type'], - 'item_id' => 0, - 'user_id' => $row['user_id'], - 'method' => 'jabber', - ))); - } - } - $this->db->sql_freeresult($result); - } - } - } } diff --git a/phpBB/includes/template/asset.php b/phpBB/includes/template/asset.php new file mode 100644 index 0000000000..7c322cd971 --- /dev/null +++ b/phpBB/includes/template/asset.php @@ -0,0 +1,182 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class phpbb_template_asset +{ + protected $components = array(); + + /** + * Constructor + * + * @param string $url URL + */ + public function __construct($url) + { + $this->set_url($url); + } + + /** + * Set URL + * + * @param string $url URL + */ + public function set_url($url) + { + if (version_compare(PHP_VERSION, '5.4.7') < 0 && substr($url, 0, 2) === '//') + { + // Workaround for PHP 5.4.6 and older bug #62844 - add fake scheme and then remove it + $this->components = parse_url('http:' . $url); + $this->components['scheme'] = ''; + return; + } + $this->components = parse_url($url); + } + + /** + * Convert URL components into string + * + * @param array $components URL components + * @return string URL + */ + protected function join_url($components) + { + $path = ''; + if (isset($components['scheme'])) + { + $path = $components['scheme'] === '' ? '//' : $components['scheme'] . '://'; + } + + if (isset($components['user']) || isset($components['pass'])) + { + if ($path === '' && !isset($components['port'])) + { + $path = '//'; + } + $path .= $components['user']; + if (isset($components['pass'])) + { + $path .= ':' . $components['pass']; + } + $path .= '@'; + } + + if (isset($components['host'])) + { + if ($path === '' && !isset($components['port'])) + { + $path = '//'; + } + $path .= $components['host']; + if (isset($components['port'])) + { + $path .= ':' . $components['port']; + } + } + + if (isset($components['path'])) + { + $path .= $components['path']; + } + + if (isset($components['query'])) + { + $path .= '?' . $components['query']; + } + + if (isset($components['fragment'])) + { + $path .= '#' . $components['fragment']; + } + + return $path; + } + + /** + * Get URL + * + * @return string URL + */ + public function get_url() + { + return $this->join_url($this->components); + } + + /** + * Checks if URL is local and relative + * + * @return boolean True if URL is local and relative + */ + public function is_relative() + { + if (empty($this->components) || !isset($this->components['path'])) + { + // Invalid URL + return false; + } + return !isset($this->components['scheme']) && !isset($this->components['host']) && substr($this->components['path'], 0, 1) !== '/'; + } + + /** + * Get path component of current URL + * + * @return string Path + */ + public function get_path() + { + return isset($this->components['path']) ? $this->components['path'] : ''; + } + + /** + * Set path component + * + * @param string $path Path component + * @param boolean $urlencode If true, parts of path should be encoded with rawurlencode() + */ + public function set_path($path, $urlencode = false) + { + if ($urlencode) + { + $paths = explode('/', $path); + foreach ($paths as &$dir) + { + $dir = rawurlencode($dir); + } + $path = implode('/', $paths); + } + $this->components['path'] = $path; + } + + /** + * Add assets_version parameter to URL. + * Parameter will not be added if assets_version already exists in URL + * + * @param string $version Version + */ + public function add_assets_version($version) + { + if (!isset($this->components['query'])) + { + $this->components['query'] = 'assets_version=' . $version; + return; + } + $query = $this->components['query']; + if (!preg_match('/(^|[&;])assets_version=/', $query)) + { + $this->components['query'] = $query . '&assets_version=' . $version; + } + } +} diff --git a/phpBB/includes/template/twig/node/includeasset.php b/phpBB/includes/template/twig/node/includeasset.php index 5abff10e3f..ae113cadc8 100644 --- a/phpBB/includes/template/twig/node/includeasset.php +++ b/phpBB/includes/template/twig/node/includeasset.php @@ -33,26 +33,21 @@ class phpbb_template_twig_node_includeasset extends Twig_Node ->write("\$asset_file = ") ->subcompile($this->getNode('expr')) ->raw(";\n") - ->write("\$argument_string = \$anchor_string = '';\n") - ->write("if ((\$argument_string_start = strpos(\$asset_file, '?')) !== false) {\n") + ->write("\$asset = new phpbb_template_asset(\$asset_file);\n") + ->write("if (\$asset->is_relative()) {\n") ->indent() - ->write("\$argument_string = substr(\$asset_file, \$argument_string_start);\n") - ->write("\$asset_file = substr(\$asset_file, 0, \$argument_string_start);\n") - ->write("if ((\$anchor_string_start = strpos(\$argument_string, '#')) !== false) {\n") + ->write("\$asset_path = \$asset->get_path();") + ->write("\$local_file = \$this->getEnvironment()->get_phpbb_root_path() . \$asset_path;\n") + ->write("if (!file_exists(\$local_file)) {\n") ->indent() - ->write("\$anchor_string = substr(\$argument_string, \$anchor_string_start);\n") - ->write("\$argument_string = substr(\$argument_string, 0, \$anchor_string_start);\n") + ->write("\$local_file = \$this->getEnvironment()->getLoader()->getCacheKey(\$asset_path);\n") + ->write("\$asset->set_path(\$local_file, true);\n") ->outdent() + ->write("\$asset->add_assets_version({$config['assets_version']});\n") + ->write("\$asset_file = \$asset->get_url();\n") ->write("}\n") ->outdent() ->write("}\n") - ->write("if (strpos(\$asset_file, '//') !== 0 && strpos(\$asset_file, 'http://') !== 0 && strpos(\$asset_file, 'https://') !== 0 && !file_exists(\$asset_file)) {\n") - ->indent() - ->write("\$asset_file = \$this->getEnvironment()->getLoader()->getCacheKey(\$asset_file);\n") - ->write("\$argument_string .= ((\$argument_string) ? '&' : '?') . 'assets_version={$config['assets_version']}';\n") - ->outdent() - ->write("}\n") - ->write("\$asset_file .= \$argument_string . \$anchor_string;\n") ->write("\$context['definition']->append('{$this->get_definition_name()}', '") ; diff --git a/tests/mock/sql_insert_buffer.php b/tests/mock/sql_insert_buffer.php new file mode 100644 index 0000000000..ba09aa8d7f --- /dev/null +++ b/tests/mock/sql_insert_buffer.php @@ -0,0 +1,21 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +class phpbb_mock_sql_insert_buffer extends phpbb_db_sql_insert_buffer +{ + public function flush() + { + return (sizeof($this->buffer)) ? true : false; + } + + public function get_buffer() + { + return $this->buffer; + } +} diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php new file mode 100644 index 0000000000..4d00fa0a1e --- /dev/null +++ b/tests/notification/convert_test.php @@ -0,0 +1,110 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/db/db_tools.php'; +require_once dirname(__FILE__) . '/../mock/sql_insert_buffer.php'; + +class phpbb_notification_convert_test extends phpbb_database_test_case +{ + protected $notifications, $db, $container, $user, $config, $auth, $cache; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/convert.xml'); + } + + protected function setUp() + { + parent::setUp(); + + global $phpbb_root_path, $phpEx; + + $this->db = $this->new_dbal(); + + $this->migration = new phpbb_db_migration_data_310_notification_options_reconvert( + new phpbb_config(array()), + $this->db, + new phpbb_db_tools($this->db), + $phpbb_root_path, + $phpEx, + 'phpbb_' + ); + } + + public function test_convert() + { + $buffer = new phpbb_mock_sql_insert_buffer($this->db, 'phpbb_user_notifications'); + $this->migration->perform_conversion($buffer, 'phpbb_user_notifications'); + + $expected = array_merge( + $this->create_expected('post', 1, 'email'), + $this->create_expected('topic', 1, 'email'), + + $this->create_expected('post', 2, 'email'), + $this->create_expected('topic', 2, 'email'), + $this->create_expected('pm', 2, 'email'), + + $this->create_expected('post', 3, 'jabber'), + $this->create_expected('topic', 3, 'jabber'), + + $this->create_expected('post', 4, 'jabber'), + $this->create_expected('topic', 4, 'jabber'), + $this->create_expected('pm', 4, 'jabber'), + + $this->create_expected('post', 5, 'both'), + $this->create_expected('topic', 5, 'both'), + + $this->create_expected('post', 6, 'both'), + $this->create_expected('topic', 6, 'both'), + $this->create_expected('pm', 6, 'both') + ); + + $this->assertEquals($expected, $buffer->get_buffer()); + } + + protected function create_expected($type, $user_id, $method = '') + { + $return = array(); + + if ($method !== '') + { + $return[] = array( + 'item_type' => $type, + 'item_id' => 0, + 'user_id' => $user_id, + 'method' => '', + 'notify' => 1, + ); + } + + if ($method === 'email' || $method === 'both') + { + $return[] = array( + 'item_type' => $type, + 'item_id' => 0, + 'user_id' => $user_id, + 'method' => 'email', + 'notify' => 1, + ); + } + + if ($method === 'jabber' || $method === 'both') + { + $return[] = array( + 'item_type' => $type, + 'item_id' => 0, + 'user_id' => $user_id, + 'method' => 'jabber', + 'notify' => 1, + ); + } + + return $return; + } +} diff --git a/tests/notification/fixtures/convert.xml b/tests/notification/fixtures/convert.xml new file mode 100644 index 0000000000..3f0a065cc4 --- /dev/null +++ b/tests/notification/fixtures/convert.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_users"> + <column>user_id</column> + <column>username</column> + <column>username_clean</column> + <column>user_notify_type</column> + <column>user_notify_pm</column> + <column>user_permissions</column> + <column>user_sig</column> + <column>user_occ</column> + <column>user_interests</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value></value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>2</value> + <value>0</value> + <value>1</value> + <value></value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>3</value> + <value>3</value> + <value>1</value> + <value>0</value> + <value></value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>4</value> + <value>4</value> + <value>4</value> + <value>1</value> + <value>1</value> + <value></value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>5</value> + <value>5</value> + <value>5</value> + <value>2</value> + <value>0</value> + <value></value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>6</value> + <value>6</value> + <value>6</value> + <value>2</value> + <value>1</value> + <value></value> + <value></value> + <value></value> + <value></value> + </row> + </table> +</dataset> diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php index ea5c30891b..b67fa123a1 100644 --- a/tests/template/template_includejs_test.php +++ b/tests/template/template_includejs_test.php @@ -26,19 +26,15 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes ), array( array('TEST' => 2), - '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?assets_version=0&assets_version=1"></script>', + '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?assets_version=0"></script>', ), array( array('TEST' => 3), - '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&assets_version=0&assets_version=1"></script>', + '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&assets_version=0"></script>', ), array( array('TEST' => 4), - '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&assets_version=0&assets_version=1"></script>', - ), - array( - array('TEST' => 5), - '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1;assets_version=0&assets_version=1"></script>', + '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&assets_version=0"></script>', ), array( array('TEST' => 6), @@ -62,19 +58,15 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes ), array( array('TEST' => 11), - '<script type="text/javascript" src="' . $this->test_path . '/templates/child_only.js?test1=1&test2=2&assets_version=1#test3"></script>', + '<script type="text/javascript" src="' . $this->test_path . '/templates/child_only.js?test1=1&test2=2&assets_version=1#test3"></script>', ), array( array('TEST' => 12), - '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?test1=1&test2=2&assets_version=1#test3"></script>', - ), - array( - array('TEST' => 13), - '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?test1=1;test2=2&assets_version=1#test3"></script>', + '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?test1=1&test2=2&assets_version=1#test3"></script>', ), array( array('TEST' => 14), - '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?test1="&assets_version=1#test3"></script>', + '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?test1="&assets_version=1#test3"></script>', ), array( array('TEST' => 15), @@ -82,12 +74,16 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes ), array( array('TEST' => 16), - '<script type="text/javascript" src="http://phpbb.com/b.js?c=d&assets_version=1#f"></script>', + '<script type="text/javascript" src="http://phpbb.com/b.js?c=d&assets_version=2#f"></script>', ), array( array('TEST' => 17), '<script type="text/javascript" src="//phpbb.com/b.js"></script>', ), + array( + array('TEST' => 18), + '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&test2=0&assets_version=1"></script>', + ), ); } diff --git a/tests/template/templates/includejs.html b/tests/template/templates/includejs.html index 3bcad76af5..0bcdf1a815 100644 --- a/tests/template/templates/includejs.html +++ b/tests/template/templates/includejs.html @@ -6,8 +6,6 @@ <!-- INCLUDEJS parent_and_child.js?test=1&assets_version=0 --> <!-- ELSEIF TEST === 4 --> <!-- INCLUDEJS parent_and_child.js?test=1&assets_version=0 --> -<!-- ELSEIF TEST === 5 --> - <!-- INCLUDEJS parent_and_child.js?test=1;assets_version=0 --> <!-- ELSEIF TEST === 6 --> <!-- INCLUDEJS {PARENT} --> <!-- ELSEIF TEST === 7 --> @@ -24,15 +22,15 @@ <!-- INCLUDEJS {$TEST} --> <!-- ELSEIF TEST === 12 --> <!-- INCLUDEJS parent_only.js?test1=1&test2=2#test3 --> -<!-- ELSEIF TEST === 13 --> - <!-- INCLUDEJS parent_only.js?test1=1;test2=2#test3 --> <!-- ELSEIF TEST === 14 --> <!-- INCLUDEJS parent_only.js?test1="#test3 --> <!-- ELSEIF TEST === 15 --> <!-- INCLUDEJS http://phpbb.com/b.js?c=d#f --> <!-- ELSEIF TEST === 16 --> - <!-- INCLUDEJS http://phpbb.com/b.js?c=d&assets_version=1#f --> + <!-- INCLUDEJS http://phpbb.com/b.js?c=d&assets_version=2#f --> <!-- ELSEIF TEST === 17 --> <!-- INCLUDEJS //phpbb.com/b.js --> +<!-- ELSEIF TEST === 18 --> + <!-- INCLUDEJS parent_and_child.js?test=1&test2=0 --> <!-- ENDIF --> {$SCRIPTS} diff --git a/travis/phpunit-mysql-travis.xml b/travis/phpunit-mysql-travis.xml index 2d6af0e2ac..715e66c223 100644 --- a/travis/phpunit-mysql-travis.xml +++ b/travis/phpunit-mysql-travis.xml @@ -15,6 +15,10 @@ <testsuite name="phpBB Test Suite"> <directory suffix="_test.php">../tests/</directory> <exclude>tests/functional</exclude> + <exclude>tests/lint_test.php</exclude> + </testsuite> + <testsuite name="phpBB Lint Test"> + <file>tests/lint_test.php</file> </testsuite> <testsuite name="phpBB Functional Tests"> <directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/functional</directory> diff --git a/travis/phpunit-postgres-travis.xml b/travis/phpunit-postgres-travis.xml index a9062efafb..9f281b4c21 100644 --- a/travis/phpunit-postgres-travis.xml +++ b/travis/phpunit-postgres-travis.xml @@ -15,6 +15,10 @@ <testsuite name="phpBB Test Suite"> <directory suffix="_test.php">../tests/</directory> <exclude>tests/functional</exclude> + <exclude>tests/lint_test.php</exclude> + </testsuite> + <testsuite name="phpBB Lint Test"> + <file>tests/lint_test.php</file> </testsuite> <testsuite name="phpBB Functional Tests"> <directory suffix="_test.php" phpVersion="5.3.19" phpVersionOperator=">=">../tests/functional</directory> |