Commit Graph

737 Commits

Author SHA1 Message Date
Jon Surrell 2bd8b6efbc Validate handlers implement WC_Log_handler_Interface
Add tests for interface validation.
2017-01-24 23:07:58 +01:00
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
Mike Jolley 885dad605a Interface naming 2016-11-22 13:54:51 +00:00
Justin Shreve dd0a2317f1 Fix up data tests and some coding standards issues 2016-11-22 04:05:05 -08:00
Justin Shreve 174aa38be6 Start moving meta to normal stores, instead of a separate meta store. 2016-11-22 04:05:05 -08:00
Justin Shreve f3140889d5 Move meta handling saving/getting logic to a data store, and fix cache handling for meta to reduce queries. 2016-11-22 04:03:57 -08:00
Justin Shreve 8d551c01e6 Merge pull request #12403 from woocommerce/order-item-data-store
Order Item Data Store
2016-11-22 03:39:53 -08:00
Mike Jolley cecfac6318 Product false test 2016-11-22 10:52:18 +00:00
Justin Shreve b20b3590c8 First pass at order items 2016-11-21 10:56:21 -08:00
Mike Jolley 32de28355a Merge branch 'master' into order-data-store
# Conflicts:
#	includes/admin/meta-boxes/class-wc-meta-box-order-data.php
2016-11-21 14:45:46 +00:00
Kevin Killingsworth 919fdb7aed Add a test for variation attributes on update
This adds a test to exhibit issue #12416, which strips attributes from a
variation upon update from the CRUD object.
2016-11-21 01:45:17 -06:00
Mike Jolley 5d9a9b4dec Fix tests 2016-11-18 11:14:09 +00:00
Mike Jolley 29ddaca8e8 Merge branch 'update/shipping-zone-data-store'
# Conflicts:
#	includes/api/class-wc-rest-products-controller.php
#	tests/unit-tests/product/data-store.php
2016-11-16 15:11:13 +00:00
Mike Jolley ecc503c2c7 Merge branch 'product-crud-test-fixes'
# Conflicts:
#	includes/class-wc-data-store.php
#	woocommerce.php
2016-11-16 15:09:32 +00:00
Justin Shreve 23a325ca8d Make sure we error out on read if a zone is not found. 2016-11-16 04:53:23 -08:00
Justin Shreve 735c1b7a14 Finish moving queries to the shipping zone data store, update usage of deprecated get_zone_id, legacy updates. 2016-11-16 04:53:23 -08:00
Justin Shreve 61d1b29789 Shipping Zone Data Store 2016-11-16 04:53:23 -08:00
Mike Jolley 76b32c9aa5 WIP - Product CRUD (#12065)
* Created function to get the catalog visibility options

* First methods for WP_Product crud

* Product set methods

* Fixed several erros while setting data

* First methods for WP_Product crud

* Product set methods

* Fixed several erros while setting data

* Hardcode the get_type per product class

* Initial look through getters and setters and abstract data

* Missing var

* Add related product functions and deprecate those in class.

* No need to exclude ID

* Fixed coding standards and improved the docblocks

* Get cached terms from wc_get_related_terms()

* Fixed wrong variable in wc_get_related_terms

* Use count() instead of sizeof()

* Sanitize ids later

* Remove unneeded comments

* wc_get_product_term_ids instead of related wording and use in other places.

get_the_terms is used here and also handles caching, something
wp_get_post_terms does not.

* Clean up the abstract product class a bit, deprecate two functions we have renamed, make update & create work properly, and add some tests for it.

* Bump template version

* Handle PR feedback: Remove duplicate regular_price update, allow changing of post status for products, remove deprecation for get_title since we might still offer it as a function

* Made abstract function useful

* External Product CRUD

* _virtual meta should be 'no', not taxable, in product unit test helper

* Grouped product class

* Tests

* Move children to meta and update test

* Use get_upsell_ids

* Spacing in query

* Moving and refactoring methods

* Availability html

* Tidy/add todos

* Rename method

* Put back review functions (still todo)

* missing $this

* get_price_including_tax/excluding_tax functions

* wc_get_price_to_display

* Price handling

* [Product CRUD] Variable (#12146)

* [Product CRUD] Variable Products

* Handle PR feedback.

* [Product CRUD] Grouped Handling (#12151)

* Handle grouped product saving

* Update routine

* [Product CRUD] Product crud terms (#12149)

* Category and tag id handling

* Replace template functions

* Remove todo

* Handle default name in save function

* Product crud admin save routine (#12174)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Spacing

* Fix comment

* wc_implode_text_attributes helper function

* [Product CRUD] Product crud admin use getters (#12196)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Move settings into new files

* Refactor panels and use getters

* Use getters for variation panel

* Revert save variation changes for now

* Add todos

* Fix downloads

* REST API CRUD Updates

* Additional API updates/fixes. Added some todos

* Fix final failing tests and implementing setters/getters and attributes functionality.

* Fix comparison for is_on_sale and remove download_type from WC_Product.

* Add a wc_get_products wrapper.

* Remove the download type input from the product data metabox for downloadable products. (#12221)

* [Product CRUD] Variations - setters, getters and admin. (#12228)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* Feedback fixes

* Implement CRUD in the legacy REST API

* Handle PR feedback

* [Product CRUD] Getter setter proxy methods (#12236)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* get_prop implementation in abstract and data classes

* Implement set_prop

* Change handling

* Array key exists

* set_object_read

* Use get_the_terms() instead of wp_get_post_terms()

wp_get_post_terms() is a wrapper around wp_get_object_terms() which does not
use the object cache, and generates a database query every time it is used.

get_the_terms() however can use data from the object cache if present.

* Allow WP_Query to preload post data, and meta in wc_get_products()

Allow WP_Query to bulk query for post data and meta if more than
just IDs are requested from wc_get_products(). Reduces query count
significantly.

* [Product CRUD] Variable, variation, notices, and stock handling (#12277)

* No longer needed

* Remove old todos

* Use getters in admin list

* Related and upsells update for CRUD

* Fix notice in gallery

* Variable fixes and todos

* Context

* Price sync

* Revert variation attributes change

* Return parent data in view context

* Defer term counting

* wc_find_matching_product_variation

* Stock manage tweaks

* Stock fixes

* Correct id

* correct id

* Better sync

* Data logic setter fix

* feedback

* First methods for WP_Product crud

* Product set methods

* Fixed several erros while setting data

* Hardcode the get_type per product class

* Initial look through getters and setters and abstract data

* Missing var

* Fixed coding standards and improved the docblocks

* Get cached terms from wc_get_related_terms()

* Fixed wrong variable in wc_get_related_terms

* Use count() instead of sizeof()

* Add related product functions and deprecate those in class.

* No need to exclude ID

* Sanitize ids later

* Clean up the abstract product class a bit, deprecate two functions we have renamed, make update & create work properly, and add some tests for it.

* Remove unneeded comments

* wc_get_product_term_ids instead of related wording and use in other places.

get_the_terms is used here and also handles caching, something
wp_get_post_terms does not.

* Handle PR feedback: Remove duplicate regular_price update, allow changing of post status for products, remove deprecation for get_title since we might still offer it as a function

* External Product CRUD

* _virtual meta should be 'no', not taxable, in product unit test helper

* Bump template version

* Made abstract function useful

* Grouped product class

* Tests

* Move children to meta and update test

* Use get_upsell_ids

* Spacing in query

* Moving and refactoring methods

* Availability html

* Tidy/add todos

* Rename method

* Put back review functions (still todo)

* missing $this

* get_price_including_tax/excluding_tax functions

* wc_get_price_to_display

* Price handling

* [Product CRUD] Variable (#12146)

* [Product CRUD] Variable Products

* Handle PR feedback.

* [Product CRUD] Grouped Handling (#12151)

* Handle grouped product saving

* Update routine

* [Product CRUD] Product crud terms (#12149)

* Category and tag id handling

* Replace template functions

* Remove todo

* Handle default name in save function

* Product crud admin save routine (#12174)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Spacing

* Fix comment

* wc_implode_text_attributes helper function

* [Product CRUD] Product crud admin use getters (#12196)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Move settings into new files

* Refactor panels and use getters

* Use getters for variation panel

* Revert save variation changes for now

* Add todos

* Fix downloads

* REST API CRUD Updates

* Additional API updates/fixes. Added some todos

* Fix final failing tests and implementing setters/getters and attributes functionality.

* Fix comparison for is_on_sale and remove download_type from WC_Product.

* Add a wc_get_products wrapper.

* Remove the download type input from the product data metabox for downloadable products. (#12221)

* [Product CRUD] Variations - setters, getters and admin. (#12228)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* Feedback fixes

* Implement CRUD in the legacy REST API

* Handle PR feedback

* [Product CRUD] Getter setter proxy methods (#12236)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* get_prop implementation in abstract and data classes

* Implement set_prop

* Change handling

* Array key exists

* set_object_read

* Use get_the_terms() instead of wp_get_post_terms()

wp_get_post_terms() is a wrapper around wp_get_object_terms() which does not
use the object cache, and generates a database query every time it is used.

get_the_terms() however can use data from the object cache if present.

* [Product CRUD] Variable, variation, notices, and stock handling (#12277)

* No longer needed

* Remove old todos

* Use getters in admin list

* Related and upsells update for CRUD

* Fix notice in gallery

* Variable fixes and todos

* Context

* Price sync

* Revert variation attributes change

* Return parent data in view context

* Defer term counting

* wc_find_matching_product_variation

* Stock manage tweaks

* Stock fixes

* Correct id

* correct id

* Better sync

* Data logic setter fix

* feedback

* Prevent notices

* Handle image_id from parent

* Fix error

* Remove _wc_save_product_price

* Remove todo

* Fixed wrong variation URLs

* Fixed undefined $image_id in WC_Product_Variation::get_image_id()

* Allow wc_rest_prepare_date_response() handle timestamps

* Updated get methods on REST API for variations

* Use variations CRUD to save variations metadata

* [Product CRUD] Abstract todos (#12305)

* Get dimensions and weights, with soft deprecation

* Product attributes

* Ratings

* Fix read method

* Downloads

* Feedback

* Revert "[Product CRUD] Abstract todos (#12305)"

This reverts commit 9a6136fcf8.

* Remove deprecated get_variation_id()

* New default attributes method

* [Product CRUD] Product Datastore (#12317)

* Fix up tests in the product/* folder.

* Handle data store updates for grouped, variable, external, simple, and general data store updates for products.

* Variations & variable changes.

* Update -functions.php calls to use data store.

* Add an interface for the public product data store methods.

* Finished product factory tests

* Correctly delete in the api, fix up some comments, and implement an interface for the public variable methods.

* Fix up delete in all versions of the api

* Handle feedback

* Match protected decloration to parent

* Product crud abstract todos (#12316)

* Get dimensions and weights, with soft deprecation

* Product attributes

* Ratings

* Fix read method

* Downloads

* Feedback

* Fix up store

* Fixed method returning in write context

* Fix error in variation admin

* Check for parent value - fixes tax class

* Remove old/complete todos

* Allow set tax class as "parent"

* Removed duplicated sync

* Fixed wrong variation URLs

* Fixed undefined $image_id in WC_Product_Variation::get_image_id()

* Allow wc_rest_prepare_date_response() handle timestamps

* Updated get methods on REST API for variations

* Use variations CRUD to save variations metadata

* Remove deprecated get_variation_id()

* New default attributes method

* Fixed method returning in write context

* Allow set tax class as "parent"

* Removed duplicated sync

* Fixed coding standards

* TODO is not accurate.

* Should pass WC_Product instancies to WC_Comments methods (#12327)

* Use new method in abstract order class to prevent headers sent issue in tests

* Fixed variable description in REST API

* Updated how create initial product variation

* Fixed a few fatal errors and warnings in Products CRUD (#12329)

* Fixed a few fatal errors and warnings in Products CRUD

* Fixed sync functions

* Add variations CRUD to legacy API (#12331)

* Apply crud to variable products in legacy API v1

* New REST API do not need fallback for default attributes

* Apply variations CRUD to legacy API v2

* Legacy v2 - save default attributes

* Variations in legacy API v2 do not have descriptions

* Fixed legacy API v2 variations params

* Applied variations CRUD to legacy API v3

* Sync before save in legacy apis

* Punc

* Removed API todos

* Removed test

* Products endpoint tweaks (#12354)

* Var type already normalized on CRUD

* Let Product CRUD handle with validation, sanitization and conditional checks

* Set downloads using WC_Product_Download

* Stop try catch exceptions more than one time

* Handle WC_Data_Exception in legacy API

* Complete remove products when fails on creating

* On creating I mean!

* Already have a method to complete delete products

* Fixed standards using WP CodeSniffer

* get_the_terms() returns false when empty

* get_manage_stock returns boolean

@claudiosanches

* Merge conflict

* Variations API endpoint fixes

* Product CRUD improvements (#12359)

* args is not used any more - remove todo

* Added test for attributes

* wc_get_price_excluding_tax usage

* parent usage

* Fix rating counts

* Test fixes

* Cleanup after tests

* Make sure status transition code runs even during API calls, not just in admin.

* Default visibility

* Fix attribute setting in API

* Use get name instead of get title

* variation id usage

* Improved cross sell templates

* variation_data

* Grouped product sync

* Notices

* Sync is not needed in API

* Delete

* Rename interfaces

* Update counts in data store
2016-11-16 12:38:24 +00:00
Mike Jolley af3496402d Merge branch 'master' into product-crud
# Conflicts:
#	includes/class-wc-data-store.php
#	woocommerce.php
2016-11-16 12:37:57 +00:00
Mike Jolley 599a2ad296 Product CRUD improvements (#12359)
* args is not used any more - remove todo

* Added test for attributes

* wc_get_price_excluding_tax usage

* parent usage

* Fix rating counts

* Test fixes

* Cleanup after tests

* Make sure status transition code runs even during API calls, not just in admin.

* Default visibility

* Fix attribute setting in API

* Use get name instead of get title

* variation id usage

* Improved cross sell templates

* variation_data

* Grouped product sync

* Notices

* Sync is not needed in API

* Delete

* Rename interfaces

* Update counts in data store
2016-11-16 12:17:00 +00:00
Mike Jolley eade55041c Delete args 2016-11-15 18:11:25 +00:00
Mike Jolley c18f6efeb4 Conflicts from master 2016-11-15 11:52:05 +00:00
Mike Jolley dc60ea4c23 Merge branch 'master' into customer-data-store
# Conflicts:
#	includes/class-wc-data-store.php
#	woocommerce.php
2016-11-14 18:21:30 +00:00
Mike Jolley 00ed627b29 Data stores 2016-11-14 18:18:08 +00:00
Justin Shreve 944e5d658b Handle feedback 2016-11-14 09:08:46 -08:00
Justin Shreve 370166a6b0 Payment Token Data Store 2016-11-14 06:20:41 -08:00
Justin Shreve 4b33f11bf2 Move queries from coupon-functions.php to the coupon data store. 2016-11-14 02:31:04 -08:00
Claudio Sanches 3dfb4c98e3 Fixed coding standards 2016-11-11 15:19:40 -02:00
Mike Jolley 3d58459246 Remove old/complete todos 2016-11-11 16:28:47 +00:00
Justin Shreve 90e43d97de [Product CRUD] Product Datastore (#12317)
* Fix up tests in the product/* folder.

* Handle data store updates for grouped, variable, external, simple, and general data store updates for products.

* Variations & variable changes.

* Update -functions.php calls to use data store.

* Add an interface for the public product data store methods.

* Finished product factory tests

* Correctly delete in the api, fix up some comments, and implement an interface for the public variable methods.

* Fix up delete in all versions of the api

* Handle feedback

* Match protected decloration to parent
2016-11-11 14:31:15 +00:00
Justin Shreve 8612ce877c Merge pull request #12284 from woocommerce/system-status-security-section
New system status security section
2016-11-10 00:53:48 -08:00
Claudio Sanches c58bef1fa4 Include tests for security endpoint 2016-11-09 22:29:17 -02:00
Mike Jolley b9d60965d2 Conflicts 2016-11-09 16:53:23 +00:00
Mike Jolley 09ea4ba91f [Product CRUD] Variable, variation, notices, and stock handling (#12277)
* No longer needed

* Remove old todos

* Use getters in admin list

* Related and upsells update for CRUD

* Fix notice in gallery

* Variable fixes and todos

* Context

* Price sync

* Revert variation attributes change

* Return parent data in view context

* Defer term counting

* wc_find_matching_product_variation

* Stock manage tweaks

* Stock fixes

* Correct id

* correct id

* Better sync

* Data logic setter fix

* feedback
2016-11-09 16:10:37 +00:00
Justin Shreve e551a846b8 Implement CRUD in the legacy REST API 2016-11-09 16:05:50 +00:00
Mike Jolley 5f4dbdb733 [Product CRUD] Variations - setters, getters and admin. (#12228)
* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* Feedback fixes
2016-11-09 16:05:49 +00:00
Justin Shreve a8742a2bcc Add a wc_get_products wrapper. 2016-11-09 15:47:23 +00:00
Justin Shreve 37c8e62fcf Fix final failing tests and implementing setters/getters and attributes functionality. 2016-11-09 15:47:23 +00:00
Justin Shreve e31a75d584 Additional API updates/fixes. Added some todos 2016-11-09 15:47:23 +00:00
Justin Shreve bcae6fb1d6 REST API CRUD Updates 2016-11-09 15:47:23 +00:00
Mike Jolley 611ac8b651 [Product CRUD] Product crud terms (#12149)
* Category and tag id handling

* Replace template functions

* Remove todo

* Handle default name in save function
2016-11-09 15:41:48 +00:00
Justin Shreve 5b09c9f063 [Product CRUD] Variable (#12146)
* [Product CRUD] Variable Products

* Handle PR feedback.
2016-11-09 15:41:25 +00:00
Mike Jolley 3e6bee0712 Move children to meta and update test 2016-11-09 15:39:18 +00:00
Mike Jolley 5fc0142ba0 Tests 2016-11-09 15:39:18 +00:00
Justin Shreve 92e016f68e _virtual meta should be 'no', not taxable, in product unit test helper 2016-11-09 15:38:44 +00:00
Justin Shreve 19949d369d External Product CRUD 2016-11-09 15:38:44 +00:00
Justin Shreve 432d736520 Clean up the abstract product class a bit, deprecate two functions we have renamed, make update & create work properly, and add some tests for it. 2016-11-09 15:38:44 +00:00
Mike Jolley ed46abf3a3 [Product CRUD] Variable, variation, notices, and stock handling (#12277)
* No longer needed

* Remove old todos

* Use getters in admin list

* Related and upsells update for CRUD

* Fix notice in gallery

* Variable fixes and todos

* Context

* Price sync

* Revert variation attributes change

* Return parent data in view context

* Defer term counting

* wc_find_matching_product_variation

* Stock manage tweaks

* Stock fixes

* Correct id

* correct id

* Better sync

* Data logic setter fix

* feedback
2016-11-09 12:26:46 +00:00
Justin Shreve b41626c555 Implement Coupon Data Store (#12280)
* Implement a Coupon Data Store using CPTs..

* Handle PR feedback.
2016-11-09 12:21:18 +00:00
Claudio Sanches 8858e74c56 Fixed coding standards and tests 2016-11-08 18:27:21 -02:00
Justin Shreve 1797c76a14 Implement WC_Data_Store and related code & tests. 2016-11-08 01:39:47 -08:00