Commit Graph

686 Commits

Author SHA1 Message Date
Mike Jolley 086ed58084 Merge pull request #12943 from woocommerce/fix-unit-tests-bootstrap
Fixed compatibility with 4.7 in tests bootstrap
2017-01-23 20:42:39 +00:00
Claudio Sanches 09123c9fc8 Merge pull request #12926 from woocommerce/fix-12910
Use mb_ functions in wc_get_wildcard_postcodes
2017-01-23 15:48:59 -02:00
Claudio Sanches 26091c4644 Fixxed compatibility with 4.7 in tests bootstrap 2017-01-23 15:37:26 -02:00
Mike Jolley 66914966fb Adjust meta saving code throughout
#12885
2017-01-23 11:30:53 +00:00
Mike Jolley f0049367ae Use mb_ functions and add tests 2017-01-22 01:24:20 +00:00
Claudio Sanches d536d15652 Merge branch 'master' of github.com:woocommerce/woocommerce 2017-01-18 16:01:02 -02:00
Claudio Sanches f54e9e1e1a Fixed coding standards 2017-01-18 15:16:01 -02:00
Justin Shreve 5fe996930f Fix alignment 2017-01-17 12:55:53 -08:00
Justin Shreve b660eda4b8 Add date searching to wc_get_orders. 2017-01-17 12:52:27 -08:00
Jon Surrell 9069bce4d3 Change travis setup to exclude coverage from all but latest stable
Add PHP_LATEST_STABLE env to travis

Use same bash conditional for test scripts
2017-01-16 21:11:21 +01:00
Jon Surrell b422de03ef Add tests for wc_get_logger
When filter provided class doesn't implement
WC_Logger_Interface, test for wc_doing_it_wrong
and use WC_Logger
2017-01-14 18:45:51 +01:00
Jon Surrell 5d7665671c Remove WC_Logger::remove
This method was added post 2.6 and does not need to be maintained/deprecated.
Remove related test.
2017-01-13 06:48:57 +01:00
Jon Surrell bb1ece4c31 Add test for deprecated WC_Logger::remove 2017-01-12 22:25:02 +01:00
Jon Surrell 29b3917f0e Test deprecated WC_Logger::clear functionality 2017-01-12 22:23:02 +01:00
Claudio Sanches 9c27661dea Synchronized with master 2017-01-12 17:53:15 -02:00
Jon Surrell e8fd29520f Un-deprecate wc_get_log_file_path 2017-01-12 20:39:39 +01:00
Mike Jolley ab76036c1f Enable 7.1 tests 2017-01-11 12:58:10 +00:00
Jon Surrell 1006fc209e Fix DB handler tests for default source 2017-01-08 22:15:04 +01:00
Jon Surrell acd338fb87 Add default source to WC_Log_Handler_DB 2017-01-08 21:42:56 +01:00
Dwain Maralack e8fc25bb00 Unit Tests: Add new parameter to order helper create_order method to allow clients to override the default product. 2017-01-05 11:23:22 +02:00
Justin Shreve e4937b898d Fix PHP 7.1 warnings/notices. 2017-01-04 10:45:45 -08:00
Justin Shreve 291a662be1 The WC API returns exclude_product_ids and expiry_date. 2.7 renamed these in the API file, which we should not do until we version the endpoints. 2017-01-03 10:25:36 -08:00
Mike Jolley 98b79ddf5b Unit test warnings 2017-01-03 12:19:03 +00:00
Mike Jolley 5ec8ef50e6 Correct case 2017-01-03 11:57:21 +00:00
Jon Surrell a33fac966d Use plural in multiple log email 2016-12-29 11:58:43 +01:00
Jon Surrell 5367baeadd Fix tests for different threshold configuration
No filtering by default.
Options configuration has been removed.
2016-12-29 11:58:43 +01:00
Jon Surrell fbd91fe376 Improve email handler subject 2016-12-29 11:58:43 +01:00
Jon Surrell 4b13e3b053 Do not deprecate WC_Logger::add 2016-12-29 11:58:43 +01:00
Jon Surrell e4d5886427 Replace log `tag` with log `source` 2016-12-29 11:58:43 +01:00
Jon Surrell af7b8646c5 Remove unneeded setUp and tearDown
WC_Logger tests no longer depend on writing/reading from log files.
2016-12-29 11:58:43 +01:00
Jon Surrell 5700043e6d Deprecate wc_get_log_file_path
wc_get_log_file_path moves into `WC_Log_Handler_File` class as a static
method.
Update deprecations and version info.
2016-12-29 11:58:43 +01:00
Jon Surrell 065277a596 Fix WC_Logger::add test to match new 'notice' level. 2016-12-29 11:58:43 +01:00
Jon Surrell 50eb303a73 Fix WC_Log_Levels::is_valid_level tests
The wrong method was being called in tests.
2016-12-29 11:58:43 +01:00
Jon Surrell 23a45125e7 Add unit tests for wc_print_r()
Clean up some log logic ( `assertEquals( true ... )` becomse `assertTrue( ... )` ).
2016-12-29 11:58:43 +01:00
Jon Surrell 3f4b473a48 Improve PHP 5.2 test compatibility (older PHPUnit version) 2016-12-29 11:58:43 +01:00
Jon Surrell b94d029546 Improve test compatibility (PHP 5.2) 2016-12-29 11:58:43 +01:00
Jon Surrell fe837c5113 Aggregate email handler messages (max: 1 email/request/handler)
Update emails accordingly.
Update email handler tests.
2016-12-29 11:58:43 +01:00
Jon Surrell 9ba616b2c1 Return single instance from wc_get_logger
Remove class include from wc_get_logger (should be autoloaded).
Add tests for wc_get_logger.
2016-12-29 11:58:43 +01:00
Jon Surrell 5af479f61b Add email log handler tests 2016-12-29 11:58:43 +01:00
Jon Surrell 080cf8e436 Store log levels as integer representations in database
This will allow indexed ordering by severity.
Add WC_Log_Levels::get_severity_level method to translate severity
integers to level strings. The inverse of WC_Log_Levels::get_level_severity.
Add context to tests.
2016-12-29 11:58:43 +01:00
Jon Surrell 825d9c9f82 Fix spelling 2016-12-29 11:58:43 +01:00
Jon Surrell 88836b9cca Drop WP_DEBUG override threshold. Improve logger tests.
This may be unexpected behavior for a user, their level is overridden with no
way to change it. It also greatly complicates testing default thresholds.

Dependency on WC_Log_Handler_File has been removed from logger tests.
2016-12-29 11:58:43 +01:00
Jon Surrell 0bea7e1305 Improve logger tests 2016-12-29 11:58:43 +01:00
Jon Surrell 0389909d88 Improve logger tests 2016-12-29 11:58:43 +01:00
Jon Surrell 2626c5b3af Accept explicit handlers and threshold in WC_Logger 2016-12-29 11:58:43 +01:00
Jon Surrell ffd0d380ee Remove threshold logic from handlers.
Email handler implements threshold logic internally. Other handlers handle all logs received.
Handler constructors have changed.
2016-12-29 11:58:43 +01:00
Jon Surrell 85fa9df7fe Drop "bubbling" support for logs
The concept of bubbling or consuming logs has little benefit for our use case.
Drop support for bubbling and simplify logging.
2016-12-29 11:58:43 +01:00
Jon Surrell 4f77954bc7 Move log levels to independent class 2016-12-29 11:58:43 +01:00
Jon Surrell 60314e5ba1 Fix spelling errors 2016-12-29 11:58:43 +01:00
Jon Surrell eca10f6362 Explicit use of file log handler for logger tests 2016-12-29 11:58:43 +01:00
Jon Surrell 0f13cca921 Use autoloader for log handlers 2016-12-29 11:58:43 +01:00
Jon Surrell 81223995fc Add basic email logger test 2016-12-29 11:58:42 +01:00
Jon Surrell ceea56e323 Add test for multiple file log handlers writing to same file. 2016-12-29 11:58:42 +01:00
Jon Surrell b6304cbcc4 Prefer "unit-tests" tag for testing log handler 2016-12-29 11:58:42 +01:00
Jon Surrell dd2474fb3c Rename test file log -> logger 2016-12-29 11:58:42 +01:00
Jon Surrell dce4e7c21a Fix misnamed test class 2016-12-29 11:58:42 +01:00
Jon Surrell e5b369b431 Remove bad logger test
Test comparing equality of logger results could randomly fail depending on execution time.
The coverage was duplicated by other tests, test was redundant and has been removed.
2016-12-29 11:58:42 +01:00
Jon Surrell 05146089cd Add DB handler tests 2016-12-29 11:58:42 +01:00
Jon Surrell 0f63e5bfdb Add severity level tests 2016-12-29 11:58:42 +01:00
Jon Surrell 822981c009 Improve handle signature
The signature of WC_Log_Handler::handle mirrors log messages which is more intuitive.
Method docblocks have also been improved and are more complete.
2016-12-29 11:58:42 +01:00
Jon Surrell e7d6a9a48b Rotate logs
WC_Log_Handler_File now includes log rotation.
Add and improve tests.
2016-12-29 11:58:42 +01:00
Jon Surrell 7359cca4a9 Add specific file log handler tests 2016-12-29 11:58:42 +01:00
Jon Surrell ad03597a3d Simplify default log entry format
Remove punctuation. Space separate values:

TIMESTAMP LEVEL MESSAGE
2016-12-29 11:58:42 +01:00
Jon Surrell e722870aa4 Fix tests for PHP 5.2 2016-12-29 11:58:42 +01:00
Jon Surrell 8600ccc6de Restructure log tests to own directory
Also moves parent::tearDown to end of tearDown
Fix phpcs problems.
2016-12-29 11:58:42 +01:00
Jon Surrell fe02d44e31 Defauly log file level is DEBUG 2016-12-29 11:58:42 +01:00
Jon Surrell 7ba54d8617 Add test for log() === [level_short_method]() 2016-12-29 11:58:42 +01:00
Jon Surrell 227651df77 Add `setMethods` to test mocks
This may improve php 5.2 test failures
2016-12-29 11:58:42 +01:00
Jon Surrell 83aad2ba2e Use older test mock syntax for legacy compatibility. 2016-12-29 11:58:42 +01:00
Jon Surrell c5c0563f7c Restore deprecated functions WC_Logger::clear & WC_Logger::remove
Also updates clear test to supply required argument.
2016-12-29 11:58:42 +01:00
Jon Surrell fda6ab57bc Fix tests for compatibility with PHP5 2016-12-29 11:58:42 +01:00
Jon Surrell 55963b09a8 Extract anonymous functions to improve test compatibility. 2016-12-29 11:58:42 +01:00
Jon Surrell 3ef2ae611d Cleanup "A" test log file 2016-12-29 11:58:42 +01:00
Jon Surrell c418623fed Add tag context test for file log handler 2016-12-29 11:58:42 +01:00
Jon Surrell 44ea69c579 Adds tests for bubbling, etc.
Add tests teardown to cleanup log files
Fix errors in log handlers
2016-12-29 11:58:42 +01:00
Jon Surrell 7e79746302 Update tests for WC_Logger 2016-12-29 11:58:42 +01:00
Jon Surrell 4000ba6aea Use strict `assertTrue` and `assertFalse` over `assertEquals( true|false )` 2016-12-20 23:33:35 +01:00
Mike Jolley e5c18fd6e4 Fix currency check unit tests 2016-12-19 15:11:25 +00:00
Claudio Sanches 0da2f70e13 Fixed coding standards 2016-12-15 15:11:08 -02:00
Mike Jolley ac1c9b5b7b Fix test 2016-12-14 11:07:39 +00:00
Mike Jolley b5f9d6b6eb Merge percent and cart percent coupon types 2016-12-14 11:07:08 +00:00
Justin Shreve ec30c308c3 Add CLI tests 2016-12-08 14:13:10 -08:00
Mike Jolley 47fbae4d26 Product Visibility Taxonomies (#12527)
* Convert visibility and featured to taxonomy

* Comment

* Add missing tax_queries

* Only check SKU after read.

* Added visibility term for outofstock products to speed those queries up al

* wc_bool_to_string
2016-12-08 10:56:45 +00:00
Mike Jolley b0ef92c30e Better conditional for travis 2016-12-07 19:48:35 +00:00
Mike Jolley 50dd4bb774 Another travis test 2016-12-07 19:44:46 +00:00
Mike Jolley 5139c811d6 Merge pull request #12533 from woocommerce/rest-api-4.7
[2.6] API Fixes for 4.7
2016-12-07 18:51:47 +00:00
Mike Jolley fcf0ab0ba5 Tweak travis code to reduce test times. 2016-12-07 18:44:18 +00:00
Mike Jolley a6a4650809 Fix theme test 2016-12-07 13:46:01 +00:00
Mike Jolley 6a7ceab462 Fix tests by casting to array 2016-12-07 11:37:11 +00:00
Mike Jolley 44ee5f7ed3 Ensure products have different timestamps in tests. 2016-12-06 10:46:48 +00:00
Mike Jolley 84a930a607 Variations are returned newest to oldest in tests. Ensure dates differ. 2016-12-05 18:51:29 +00:00
Mike Jolley 8e81526bfc Set menu order so products return in correct order for tests. 2016-12-05 15:43:08 +00:00
Mike Jolley 162aa986b6 Fix tests 2016-12-05 14:21:09 +00:00
Mike Jolley 5f64f1bf0a Customer tests for role 2016-11-25 14:48:21 +00:00
Mike Jolley 086d8bce1d Fix is_callable 2016-11-25 14:48:20 +00:00
Mike Jolley 9087a45f29 Remove attribute_ prefix rather than add so that get_attributes has better return values, and don't show duplicate data in cart. 2016-11-24 14:20:48 +00:00
Mike Jolley 4ca49ba999 Fix tests 2016-11-23 16:27:18 +00:00
Mike Jolley d7dfdd3d10 Wrap all deprecation calls. 2016-11-23 16:15:00 +00:00
Claudio Sanches 1c9c26cda6 Fixed syntax for old versions of PHP 2016-11-23 12:56:08 -02:00
Claudio Sanches 8d19832937 Fixed coding standards 2016-11-22 23:47:13 -02:00