Tests are run with sqlite by default now anyway, so in the majority of cases
the error message explaining how to set up database test running will not be
displayed anyway. Database tests are now generally simply skipped if no
configuration can be found. The RUNNING_TESTS.txt file explains how to set
them up however, and more info is available on the wiki.
The get_database_config method was moved from test_case_helpers to
database_test_case because it has no general purpose.
PHPBB3-9868
Calling initialisation to then use the member directly seems more
complicated than just having a method that returns the instance or
creates it if necessary.
PHPBB3-9868
All class names have been adjusted to use a phpbb_request prefix,
allowing them to be autoloaded.
Also introduces some improvements to autoloading in general.
PHPBB3-9716
Removed the dependency of the request class test on having an actual
phpbb_type_cast_helper instance, by replacing it with an object mocking
the phpbb_type_cast_helper_interface.
PHPBB3-9716
The request class
- now makes use of the new type cast helper (dependency injection)
- has no static methods anymore.
- now has a constructor argument to leave super globals turned on
Brought back the set_var function in functions.php. It is now a wrapper
around the type cast helper. It creates an instance on the fly.
The request_var wrapper function now has an optional last argument to
inject the request class instance, rather than abusing the $var_name.
PHPBB3-9716
These methods should be available without having to instantiate a request class
object, better separation of concerns. A set_var wrapper around this class no
longer requires a request object at all.
PHPBB3-9716
The well known request_var function is now a wrapper that calls a method
on a phpbb_request object. The class provides additional functionality.
It can replace all super globals with special objects that throw errors
when being accessed. They still allow isset operations to keep backward
compatibility with isset($_POST['var']) checks. The phpbb_request class
implements the phpbb_request_interface which is available for easy mocking
of input in tests.
PHPBB3-9716
* develop-olympus:
[ticket/9825] Add unit test config and db to gitignore
[ticket/9825] Unit tests: Use sqlite when possible and no test_config exists.
* develop-olympus:
[ticket/9592] Slight adjustments to simplify db test cases
[ticket/9592] Remove test cases for empty IN()
[ticket/9592] Test suite does not run on SQlite
* develop-olympus: (57 commits)
Revert "[ticket/7716] Data too long for column 'message_subject'"
[ticket/7716] Data too long for column 'message_subject'
[ticket/9780] Adding unit tests for gen_rand_string().
[ticket/9780] Add length check back to gen_rand_string().
[ticket/7972] Copying topics in the MCP now indexes the new topic.
[ticket/9782] Board disable radio set on when server load high
[ticket/9635] Useless parameter $data['post_time'] in function submit_post.
[ticket/9104] Safari does not display box headers correctly in the ACP.
[ticket/9777] Print error message in pre-commit hook when php is not installed.
[ticket/7716] Data too long for column 'message_subject'
[task/git-tools] Ignore git commit message comments
[task/git-tools] Adjust the hook to enforce that a ticket is always mentioned
[task/git-tools] Vastly expanded commit-msg hook.
[task/git-tools] Beginnings of a syntax checking hook.
[task/git-tools] Append ticket identifier to commit message prior to editing.
[ticket/7332] Redirect users back to post details when performing actions.
[ticket/7332] Collapse post details content down to a maximum of 300px heigh
[ticket/9771] Remove query string parameters that have no name.
[ticket/9760] Remove unrestricted wildcards from search terms.
[ticket/9599] Reimplement phpbb_checkdnsrr() function.
...
Conflicts:
tests/template/template.php
The template tests disable NOTICEs for the duration of template execution since
the current version of the template engine does not generate sufficiently clean
code. The error level is reset aftwards, however that part is skipped when
trigger_error is called which is converted into a regular exception by PHPUnit
and passed down until caught. Such exceptions are now caught to reset the error
level, and then the exception is rethrown.
This uncovered another issue in the template tests which only passed because
NOTICEs were unintentionally disabled at this point. assign_display is also
required to operate without NOTICEs. The respective code has been added around
its callee as well. However no handling of exceptions takes place there. If
another test checking for errors in that function is ever added similar catch
logic will have to be added there.
PHPBB3-9701
* develop-olympus:
[ticket/9704] Fix minor typo in coding guidelines.
[ticket/9690] Add forthcoming Bing Bot to list of recognized bots
[ticket/9451] Add optional $can_upload parameter to avatar_process_user().
[ticket/9593] A readme file for unit tests and running unit tests.
[ticket/9570] Changed "system" to "guest" timezone in ACP, added explanation.
[ticket/9589] Added sample nginx configuration file for phpbb.
phpBB class name lookups follow these rules:
- All classes are prefixed with phpbb_
- All classes reside in includes/ or a subdirectory thereof
- Directories must not contain underscores
- The class name is separated into parts by underscores, the parts
are checked from first to last, until one is found which is not
a directory, all remaining parts make up the file name. If no parts
are left, the last directory name is used.
Examples:
directory structure:
includes/
class_name.php
dir/
class_name.php
dir.php
subdir/
class_name.php
lookups:
phpbb_class_name -> includes/class_name.php
phpbb_dir_class_name -> includes/dir/class_name.php
phpbb_dir -> includes/dir/dir.php
phpbb_dir_subdir_class_name -> includes/dir/subdir/class_name.php
Optionally the class can be supplied with a cache instance, either in the
constructor or via set_cache() at a later time. This allows for the lookups to
be cached, so the directories do not have to be traveresed on every request.
This makes it necessary for the cache and its dependency to continue to be
loaded the old way - without autoloading.
The code will not be changed to use autoloading, but it will rather only be
used for new classes where applicable.
PHPBB3-9682
* develop-olympus:
[ticket/9626] Adding tests for the URL regular expression.
[ticket/9626] Add missing class prefix.
[ticket/9626] A few tests for the email regular expression.
[ticket/9626] More IPv6 regex tests.
[ticket/9626] Adding tests for the IPv4 regular expression.
[ticket/9626] Adding tests for regular expressions.
* ticket/bantu/9626:
[ticket/9626] Adding tests for the URL regular expression.
[ticket/9626] Add missing class prefix.
[ticket/9626] A few tests for the email regular expression.
[ticket/9626] More IPv6 regex tests.
[ticket/9626] Adding tests for the IPv4 regular expression.
[ticket/9626] Adding tests for regular expressions.
* develop-olympus:
[feature/dbal-tests] Follow the coding guidelines and ...
[feature/dbal-tests] Update data
[feature/dbal-tests] Multi insert
[feature/dbal-tests] Delete data
[feature/dbal-tests] Insert data
[feature/dbal-tests] Fix SQL-ERROR: invalid input syntax for integer: ""
[ticket/9587] Prosilver overrides reCaptcha class.
[ticket/9605] Wrong class added to topiclist, when there's no announcement topic.