woocommerce/tests/unit-tests
Cesar Rodas 38f379a7d7 Make get_item() consistent (like get_items())
Right now get_item() is loading an item from the database directly. It doesn't
take advantage of our cache and it doesn't check if the item is already loaded in memory.

There is also another bug (or feature?) that it will let you load any item, even if the item is not related to the current order. I believe this is a bug, if somebody really wants to load any item regardless of the order they should use `WC_Order_Factory::get_order_item`.

Another bug is that items loaded with get_item() are not related to the order object, therefore any calls to Order::save() won't persist the changes made to the item.

This commits makes sure the item returned by get_item is loaded similarly like get_items() does, taking advantage of the cache and the $items protected property (chances are the item is already in memory, ready to be used).

If a given item is not found false will be returned. If item exists but it is not related to the current object it will return false as well (If this behaviour is wanted, I can easily change it load the item anyways instead of returning false).
2017-04-26 02:54:14 -04:00
..
account update test 2017-04-25 14:46:17 +01:00
api Fix test 2017-04-10 21:57:10 +01:00
cart Revert to original behavior 2017-03-07 13:17:36 -08:00
coupon Fixed coding standards 2017-03-21 12:38:35 -03:00
crud Update unit tests 2017-03-23 00:11:21 +00:00
customer Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00
formatting Update unit tests 2017-03-23 00:11:21 +00:00
log Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00
order Make get_item() consistent (like get_items()) 2017-04-26 02:54:14 -04:00
order-items Fixed coding standards 2017-03-21 12:38:35 -03:00
payment-tokens Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00
product Fixed coding standards in tests 2017-04-20 01:34:58 -03:00
settings Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00
shipping-zones Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00
tax Introduce get_tax_class_slugs. 2017-01-25 13:38:13 -08:00
util Sprinkle some periods 2017-03-28 11:15:00 -07:00