Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Order
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Mar 2010 at 03:11 UTC
Updated:
3 Jan 2014 at 01:08 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bojanz commentedWill give it a shot this week.
Comment #2
rszrama commentedI'm postponing this until we actually give unit testing some attention. As our 1.0 goal is full functional test coverage, adding CRUD API test coverage comparable to the tests found in commerce_product.test isn't really a priority item. We can revisit this later but focus on more immediate tasks for now.
Comment #3
dpolant commentedI've provided a patch that adds CRUD and token-replace tests for orders. It is modeled after commerce_product.test. This my first time writing a unit test so it could probably use some review.
One thing I wasn't sure about: line 193 of commerce_product.test uses assertNotIdentical to check the edit-url token replacement for products. I'm not sure why we are checking that these values are not identical - is this a mistake? I copied this structure into the new commerce_order.test as it is.
In order to make order:hostname token replacement work, I added it to commerce.info.inc. Additionally, I added a method generateEmail to CommerceBaseTestCase to generate a random email.
Also, it's probably worth noting that commerce unit tests fail when using commerce kickstart if you don't move profiles/commerce_kickstart/modules/commerce into sites/all/modules.
Comment #4
rszrama commentedAs for the assertNotIdentical, it's because the assertion there is based on the usage of
strpos(). This assertion will pass if the return value !== FALSE, meaning the integer 0 will still pass. This may in fact be the result of the token replacement (though I'm not sure if it necessarily will be, like if Drupal is being run in a subdirectory of the docroot), hence the assertNotIdentical to pass anything besides FALSE.The hostname Entity API integration and new method on the base test class look fine. I won't nitpick over the tests too much, as they seem to cover the basics and all pass. Drupal doesn't really have a great framework for unit tests as is, but it's worth having these around in case we screw something up horribly. : )
Committed.