11 Commits

Author SHA1 Message Date
peterdd
c2a59a52fa fix typo in tests/bootstrap.php
I had to fix the path there to enable running the phpunit tests.
2021-10-21 11:12:53 +02:00
Peter Kokot
fd1338e3de Revert "Add automatic fixtures generator importer"
This reverts commit 5cdac95adc.

Due to the https://github.com/php/web-bugs/pull/77 discussion and
request from a prominent member of the PHP group - Kalle - I'm reverting
this awesome addition because it caused too many conflicts and issues.
So it is not worth of investing more from my side into this neither
having a ruined experience further on from any side here.

This fix has been really helpful with some development ways but people
who maintain this app further better have peace of mind...
2019-05-25 12:16:43 +02:00
Peter Kokot
e8bab3538a Add variables import to included templates 2019-05-23 02:10:03 +02:00
Peter Kokot
5cdac95adc Add automatic fixtures generator importer
When developing site locally, developer needs to have data sets to run
manual tests, see how the app is built, and similar. The new additional
command line command using Symfony/Console component creates a main
scripts/console entry point for running Commands. Initial set of demo
fixtures data is generated using the faker library and includes most
data needed to use and test application manually in the local
environment.
2019-05-22 03:15:30 +02:00
Pieter Hordijk
f762db348d Add tests fixes
- Added filter to phpunit config
- This enables support for coverage support
- Moved unit tests to dedicated directory
- Also created constants for the locations of the fixtures and mocks for
  testing so we do not have to use relative paths in tests
- Updated phpunit to 8
- Added type information to tests
- Added return type and parameter type declarations for tests
- Added strict types to tests
- CS fixes in tests
- Aligning arrays, consistent string concatenation, removed unused local
  vars
- Added constant for test cache directory
- Make the autoloader also properly work on windows
- Windows does not care about the directory separator used so just trim
  both variant from the end.
2019-05-16 22:05:30 +02:00
Peter Kokot
5cd2630a86 Add dependency injection container
This patch introduces a dependency injection container for the PHP bug
tracker application. Container deals with the creation of all service
classes and additionally provides retrieving of configuration parameters.
Service classes are used everywhere in the app - from accessing database
to uploading files. Configuration parameters include infrastructure
configuration (database credentials...) and application level
configuration (directories locations...).

Container is compatible with the PSR-11 container interface defined
so it is simple to quickly understand its usage. Advanced features
such as autowiring are not included in this phase.
2019-01-28 00:47:18 +01:00
Peter Kokot
ae57162e8d Refactor fetching versions
- Procedural code moved to OOP
- Added unit tests
- Added a more flexible tmp folder location and introduce var folder
  (in production this won't work yet, so we still use /tmp there).
  For local development environments var directory in project root
  is used for faster and easier project setup.
- Added initial extensible PSR-16-alike semi-compatible cache class
  and refactored storing fetched versions.
- The versions list generator is now simpler and a bit more logical
  what is happening. Versions sort order is the same as before.
- Added ComposerScripts utility/service class for creating required
  directories (uploads and var/cache), and configuration file, when
  installing application in development environment.
2019-01-07 03:20:57 +01:00
Peter Kokot
068d8514af Add template engine
This patch adds an initial simplistic template engine to separate logic
from the presentation.

Basic initial features:
- escaping via Context::noHtml() and Context::e() methods
- blocks
- nesting options using includes and extending layouts
- PHP syntax
- variable scopes dedicated to template scope only
- Appending blocks (when JS files are in need to be appended)
- initial unit and functional tests
- Main index page refactored as an example of usage
- Very short intro docs how to use the template layer
- Thanks to @nhlm for the code review and numerous suggestions to
  improve the usability and code stability,
- Thanks to @KalleZ and for the code review and numerous common sense
  suggestions about templates themselves.
- Thanks to @Maikuolan for the code review and numerous suggestions
  about the usability.
- Moved hash ids redirection to aseparate JavaScript file
- Use location instead of window.location in the JavaScript redirection

Discussions:
- http://news.php.net/php.webmaster/27603
- https://github.com/php/web-bugs/pull/66
2019-01-02 22:20:11 +01:00
Peter Kokot
8ab9a1d110 Refactor patches uploading
This patch moves patches uploading functionality from the outdated
HTTP_Upload package to a dedicated service class in the app.

Additional changes in this context:
- Functionality concerning retrieving patches data from database has
  been moved to a separate repository classes.
- Some missed bugs fixed when uploading patches and no developer info
  were recorded.
- Obsoleting patches functionality is now working again.
- Added a simple unit test.
2018-12-05 19:29:10 +01:00
Peter Kokot
d337e731ff Add dual PSR-4 compatible classes autoloader
This patch is a workaround until Composer installation step can be used
in production bugs.php.net. Once Composer can be added to the deployment
step together with rsync this can be simplified and only Composer's
autoload.php will be used.
2018-12-05 15:40:19 +01:00
Peter Kokot
35218a2825 Refactor numerical Captcha package into class
The Text_CAPTCHA_Numeral can be integrated in the project source code
instead of using a separate unmaintained dependency.

This patch also adds a simple unit test.
2018-12-03 16:53:15 +01:00