woocommerce/tests/legacy/unit-tests
Nestor Soriano 8a7d955253 Improvements on the code hacker.
- Add methods to temporarily disable and reenable the code hacker.

The code hacker is causing issues in some tests that perform
write operations to the local filesystem. Since this happens only
in a few cases, the easiest fix is to temporarily disable the
code hacker when that happens. This commit adds two new methods
for that in `WC_Unit_Test_Case`: `disable_code_hacker` and
`reenable_code_hacker`.

These methods use a disabling requests count so that the hacker
isn't enabled before it should. E.g. you call `disable`, then
a helper method that does `disable` and `enable`, then `enable` -
then only the last `enable` will have effect.

- `CodeHacker::add_hack` has now a boolean `persistent` parameter.
Persistent hacks won't be cleared by `clear_hacks`.

- `CodeHackerTestHook::executeAfterTest` will now disable the hacker
only if no persistent hacks are registered.

- The existing `file_copy` method is made static for consistency.

- `CodeHacker::restore` method renamed to `disable` for clarity.
2020-05-20 09:56:26 +02:00
..
account Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
admin Merge pull request #26399 from woocommerce/fix/uploads_htaccess 2020-05-19 15:56:37 +05:30
attributes Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
cart Fixed cart get total unit test 2020-05-08 23:17:59 +05:30
checkout Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
core Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
countries Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
coupon Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
crud Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
customer Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
discounts Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
email Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
exporter Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
formatting Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
gateways Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
geolocation Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
importer Improvements on the code hacker. 2020-05-20 09:56:26 +02:00
integrations Improvements on the code hacker. 2020-05-20 09:56:26 +02:00
libraries Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
log Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
order Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
order-items Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
packages Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
page-functions Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
payment-gateways Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
payment-tokens Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
privacy Merge branch 'privacy-exporter-group-description' of git://github.com/garretthyder/woocommerce into garretthyder-privacy-exporter-group-description 2020-05-12 09:40:17 -07:00
product Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
queue Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
session Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
settings Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
setup Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
shipping Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
shortcodes Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
tax Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
templates Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
totals Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
util Improvements on the code hacker. 2020-05-20 09:56:26 +02:00
webhooks Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
widgets Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00