You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
T-Regx supports multiple PHP versions, currently spaning from PHP 7.1 to PHP 8.2. These versions differ from each other in terms of what they support and how exactly. Additionally, first few PHP versions use PCRE, while the newer ones use PCRE2. T-Regx supports all of those differences under a unified interface.
T-Regx is developed using Extreme Programming and TDD, and every piece of code is tested much more than once. However, because we support multiple PHP versions, we use polymorphism to abstract certain differences away, and make the internals cleaner and safer. Because of that, on a given PHP version, only one implementation of the abstraction is used, while others are used for other PHP versions.
So when running T-Regx on any given PHP version, you will not achieve 100% code coverage, because certain features of T-Regx aren't employed for that particular version. There is, however, a way to trick the coverage. We can simply run code coverege multiple times, each time on a different PHP version, and then join the results together. If we do that, we in fact achieve complete 100% coverage.
A curious reader might ask - "So what pieces of code aren't used for a given particular PHP version. Couldn't we write tests for the classes and achieve 100% coverage that way?". That's a valid question, and answer to it is: yes, it's possible to write tightly-coupled tests for those classes and easily achieve 100% code coverage that way. Having that in mind, we at T-Regx decided not to pursue this path for two reasons. The first reason, is that we don't think an inflated code coverage is something to be desired - true 98% is better than a falsy 100%. Secondly, in order to write tests that are able to cover classes that aren't supposed to be used on a particular version, would have to be unnecessarily tightly coupled to the code, making those tests less susceptible to finding bugs and more difficult in maintenance. Not however, that despite the coverage metric being below 100%, the actual code is tested in its entirety (full 100%) - if tests are run on all versions of PHP.
Currently tests are being run on each supported PHP version, but coveralls is only being checked for the newest supported PHP version. Perhaps one day we can update the Coveralls Github Action to run the coverage for all versions and join them together.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Our badge currently shows:
T-Regx supports multiple PHP versions, currently spaning from PHP 7.1 to PHP 8.2. These versions differ from each other in terms of what they support and how exactly. Additionally, first few PHP versions use PCRE, while the newer ones use PCRE2. T-Regx supports all of those differences under a unified interface.
T-Regx is developed using Extreme Programming and TDD, and every piece of code is tested much more than once. However, because we support multiple PHP versions, we use polymorphism to abstract certain differences away, and make the internals cleaner and safer. Because of that, on a given PHP version, only one implementation of the abstraction is used, while others are used for other PHP versions.
So when running T-Regx on any given PHP version, you will not achieve 100% code coverage, because certain features of T-Regx aren't employed for that particular version. There is, however, a way to trick the coverage. We can simply run code coverege multiple times, each time on a different PHP version, and then join the results together. If we do that, we in fact achieve complete 100% coverage.
A curious reader might ask - "So what pieces of code aren't used for a given particular PHP version. Couldn't we write tests for the classes and achieve 100% coverage that way?". That's a valid question, and answer to it is: yes, it's possible to write tightly-coupled tests for those classes and easily achieve 100% code coverage that way. Having that in mind, we at T-Regx decided not to pursue this path for two reasons. The first reason, is that we don't think an inflated code coverage is something to be desired - true
98%
is better than a falsy100%
. Secondly, in order to write tests that are able to cover classes that aren't supposed to be used on a particular version, would have to be unnecessarily tightly coupled to the code, making those tests less susceptible to finding bugs and more difficult in maintenance. Not however, that despite the coverage metric being below 100%, the actual code is tested in its entirety (full 100%) - if tests are run on all versions of PHP.Currently tests are being run on each supported PHP version, but coveralls is only being checked for the newest supported PHP version. Perhaps one day we can update the Coveralls Github Action to run the coverage for all versions and join them together.
Beta Was this translation helpful? Give feedback.
All reactions