Commit Graph

18 Commits

Author SHA1 Message Date
Nestor Soriano fc0be07e0f Add unit test for WC_Admin_Post_Types::bulk_and_quick_edit_save_post.
The test added checks that the new regular or sale price is
appropriately set when bulk saving.
2020-07-14 11:42:21 +02:00
Nestor Soriano 4531af3382 Small fix in WC_Tests_Admin_Post_Types::bulk_and_quick_edit_stock_status_for_variable_product.
At some point the 'change_stock' key is assumed to be present
in the request data, but it might not. Fixed to test for existence
before using the value.
2020-07-14 11:42:21 +02:00
Nestor Soriano e05aa8a03a Add unit test for WC_Admin_Post_Types::bulk_and_quick_edit_save_post.
The test added checks that stock status of variations when saving
a variable product is changed or not appropriately depending on
the request data supplied.
2020-07-14 11:42:21 +02:00
Christopher Allford b5bd8225e8 Moved PHPUnit suite into tests/legacy 2020-04-24 13:53:40 -07:00
Christopher Allford 753f39ff27 Added unique slug generation for variable product duplication
The standard wp_unique_post_slug() function will run one query per name collision, leading to a large number of queries being made when a product template is duplicated repeatedly. We can avoid this by doing the unique generation ourselves.
2019-11-18 13:49:41 -08:00
Christopher Allford 4120fe1cd8 Added tests to product duplication 2019-11-15 21:12:22 -08:00
Claudio Sanches 16041d9247 Fixed failing tests 2019-07-18 22:42:31 -03:00
Rodrigo Primo 18ee70918b Fix PHPCS violations in tests/ using PHPCBF
This commit fixes all 1533 PHPCS errors that PHPCBF can fix automatically in the tests/ directory. Before this change there was a total of 3106 PHPCS errors in the WooCommerce repository and now there is 1573 errors.
2019-05-01 19:05:00 -03:00
Adrien Foulon 8bae56d51a
Remove '_' prefix from function 2019-03-13 18:01:53 +01:00
Adrien Foulon 7099aa5d1a
Change function call to static 2019-03-13 13:48:39 +01:00
Adrien Foulon a316101358
Fix tests 2019-03-13 11:58:59 +01:00
Ron Rennick ab6012fa3f move test parameters with calculations to separate lines 2019-01-18 23:32:47 -04:00
Ron Rennick 6daf89ad6e add descriptions to report sale by date tests 2019-01-18 23:27:11 -04:00
Ron Rennick 2bb2475e92 phpcs sniff fixes for class-wc-tests-report-sales-by-date.php 2019-01-18 23:26:45 -04:00
Rodrigo Primo 5a5a2bc1fb Make unit tests work again with PHP 5.2
This commit fixes WC PHPUnit tests in PHP 5.2 that have been broken since commit e68084d7b8 (diff-b43983ff635e47e2ec510ae07726f0b4R30) was merged. The mentioned commit added a new method to WC_Unit_Test_Case that uses late static binding. The problem is that late static binding is available only since PHP 5.3 and WooCommerce still support PHP 5.2. Running WC tests with PHP 5.2 resulted in the following error:

Parse error: syntax error, unexpected T_STATIC, expecting T_STRING or T_VARIABLE or '$' in /home/travis/build/woocommerce/woocommerce/tests/framework/class-wc-unit-test-case.php on line 40 (see https://travis-ci.org/woocommerce/woocommerce/jobs/350303315#L281)

For now, I'm simply removing the method that used late static binding (WC_Unit_Test_Case::include_dependencies()) and manually loading the required dependencies in the two test classes that relied on it. I'm happy to add WC_Unit_Test_Case::include_dependencies() again if someone can find a way to make it compatible with PHP 5.2. If not, we can revisit this once WC drops support for PHP 5.2.
2018-03-12 16:19:47 -03:00
Steve Grunwell d4ca2d87e8 It's only a single scenario, but start writing tests around how WC_Report_Sales_By_Date generates reports 2018-01-12 23:39:55 +00:00
Steve Grunwell e68084d7b8 Add a method by which testcases can load necessary files via include_once.
There are a number of files that are only loaded when another function is called (for example, load a reporting class when displaying a widget). An autoloader would be the ideal way to handle this (both in production and for tests), but until PHP compatibility is sorted out this commit adds an easy fix:

Testcases can now populate the protected, static $includes property with filepaths relative to the project root; when the testcase boots up, these files will automatically be included.
2018-01-12 21:33:20 +00:00
Steve Grunwell d0efd7251e Introduce some basic tests around getting data out of WC_Admin_Report.
The real value of these tests will be ensuring that data is being sourced correctly in the specific implementations of this class.
2018-01-12 19:55:33 +00:00