Commit Graph

27 Commits

Author SHA1 Message Date
Nestor Soriano 2a68bb018d Move testing tools to the tests/Tools directory
The testing tools (only the code hacker at this time) have been moved
from 'src' to 'tests/Tools', since many opcode cache plugins
load the whole src folder in production.

Also, an extra autoloader is set in the tests bootstrap so that
the 'tests/Tools' directory corresponds, using PSR4, to the
'Automattic\WooCommerce\Testing\Tools' namespace.
2020-05-20 09:57:39 +02:00
Nestor Soriano 57845ef8b8 All code hacking files moved to src\Testing folder. 2020-05-20 09:56:25 +02:00
Nestor Soriano db58b51de3 Barebones implementation of a code hacker for unit tests.
The "code hacker" is a class that hooks on filesystem events
(using stream_wrapper_unregister) in order to allow for dynamically
modifying the content of PHP code files while they are loaded.
The code hacker class allows registering hacks, which are
functions that take source code as input and return the modified code.
A hack can be a standalone function or a class with a "hack" method.

A few hacks are provided off the shelf. One allows mocking standalone
PHP functions (WP, WOO or not), another one allows mocking static
methods, and there's the one that removes the "final" qualifier
from a class definition. This helps unit testing stuff that would
otherwise be quite hard to test.
2020-05-20 09:56:25 +02:00
Christopher Allford 04ec11e90b Added a PSR-4 namespaced tests/php folder for tests written against new code in the src directory 2020-04-28 15:41:04 -07:00
Christopher Allford b5bd8225e8 Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
Gerhard 41d0702a3c Exclude new packages and vendor folders from unit tests 2019-07-29 11:20:58 +02:00
Claudio Sanches 96c7255fc0 Fixed SpeedTrapListener include 2019-07-18 22:24:40 -03:00
Claudio Sanches 67212d1303 Updated PHPUnit to 7.5.14 2019-07-18 22:02:58 -03:00
Mike Jolley 9d381d456b Remove simplify commerce gateway 2019-01-10 12:01:27 +00:00
Rodrigo Primo 3057ed0bd6 Use WordPress version of phpunit-speed-trap
This commit adds WordPress version of phpunit-speed-trap (https://github.com/WordPress/wordpress-develop/blob/master/tests/phpunit/includes/speed-trap-listener.php). First I tried to add it using composer but for some unknown reason it worked on my local environment but not on Travis (https://travis-ci.org/woocommerce/woocommerce/jobs/377286389#L673). I don't think it is worth spending too much time on this so it seems to me that it is just easy to use WordPress version instead since it works.
2018-05-17 15:04:32 +01:00
Rodrigo Primo fef08f6e16 Revert "Add phpunit-speedtrap"
This reverts commit 5cd7326881.
2018-05-17 14:52:07 +01:00
Rodrigo Primo 5cd7326881 Add phpunit-speedtrap
phpunit-speedtrap (https://github.com/johnkary/phpunit-speedtrap) includes a report of slow-running unit tests to the PHPUnit output and it will help identify WC core tests that need to be changed to run faster.
2018-05-10 10:39:26 -03:00
Claudio Sanches 109e884533 Exclude includes/wc-widget-functions.php 2017-10-05 14:10:17 -03:00
Claudio Sanches e5f7b5ebc2 Updated tests exclusion list 2017-10-05 14:05:38 -03:00
Claudio Sanches 0c423c6ef7 Account function Unit Tests 2017-10-04 16:43:41 -03:00
Mike Jolley 1fa049415b Config 2017-09-27 13:12:10 +01:00
Mike Jolley e81f5e5d88 whitelist 2017-09-26 14:24:49 +01:00
Mike Jolley e9c3ebebdc Merge branch 'master' into feature/discounts-class
# Conflicts:
#	includes/abstracts/abstract-wc-data.php
#	woocommerce.php
2017-08-08 15:49:59 +01:00
Mike Jolley f57c6dc2ee Speed up tests 2017-07-28 11:42:54 +01:00
Claudio Sanches c5055ed2f7 Tidy up Scrutinizer, PHPUnit and Travis config 2017-07-21 14:25:27 -03:00
Jon Surrell 85ed78f438 Add PHPUnit coverage `addUncoveredFilesFromWhitelist="true"` 2017-01-17 10:28:20 +01:00
Jon Surrell ec374770aa Update phpunit.xml to use <whitelist> 2017-01-17 10:06:08 +01:00
Mike Jolley 97819f5a17 Test 2016-08-26 15:53:50 +01:00
Claudio Sanches f204b33fb7 Exclude legacy API from phpunit and scrutinizer 2016-04-19 12:59:13 -03:00
Claudio Sanches f9ff5ba49f Updated phpunit blacklist 2016-03-10 00:06:22 -03:00
Claudio Sanches 3235ba177c Allow phpunit to check php syntax 2016-02-11 17:44:44 -02:00
Max Rice 71def57a7d [#3176] Add unit test boostrap 2014-09-01 02:03:52 -04:00