Claudio Sanches
3c1132e274
Added unit tests for wc_get_current_admin_url()
2020-07-29 21:02:52 -03:00
Néstor Soriano
8c2412ea7d
Merge pull request #26731 from woocommerce/feature/introduce-dependency-injection
...
Introduce a dependency injection framework
2020-07-24 15:12:16 +02:00
Peter Fabian
03230ecf01
Merge pull request #26642 from woocommerce/fix/26607
...
Limit stock changes for order items to status methods for consistency.
2020-07-24 13:23:53 +02:00
Christopher Allford
811ac747e6
Added callable reflection to `add_with_auto_arguments`
...
This allows the dependencies of the callable function to be automatically resolved out of the container too!
2020-07-24 09:25:12 +02:00
Nestor Soriano
408295720c
Fix LegacyProxy::get_instance_of for classesd having an `instance` method.
...
Pass the arguments as `...$args` instead of `$args`.
Also fix related unit test, and remove unnecessary `is_function`.
2020-07-24 09:25:12 +02:00
Nestor Soriano
bd1e6a5db0
Add the ContainerException class, use it for dependency injection related errors.
2020-07-24 09:25:12 +02:00
Nestor Soriano
65b5cbe692
Improve AbstractServiceProvider::add_with_auto_arguments
...
If a class name is passed as a concrete, check that the class
constructor is public if it exists. If another type of concrete is
passed, check that it's valid (a callback or an object).
Also update the autoloader to check if the class file exists,
otherwise class_exists fails if a namespaced class doesn't exist.
2020-07-24 09:25:11 +02:00
Nestor Soriano
6fd84a0401
Add shortcut methods for the LegacyProxy in the WooCommerce class.
...
The following methods are added and can be invoked using `WC()`,
they just redirect to the same methods in LegacyProxy:
call_function
call_static
get_instance_of
2020-07-24 09:25:11 +02:00
Nestor Soriano
abf53086ca
Remove @throws annotation from some unit tests.
2020-07-24 09:25:11 +02:00
Nestor Soriano
29cf161415
Small changes after review feedback:
...
- Method and class renames.
- Removed unnecessary autoloader registration.
- Add a unit test for classes with non-object type hints
in constructor arguments.
2020-07-24 09:24:06 +02:00
Nestor Soriano
4ec143532c
Adjustments in the LegacyProxy class.
...
- `get_instance_of` accepts now arguments to be passed to the
class constructor if necessary.
- `get_special_instance_of` method removed, instead, now if a method
named `get_instance_of_<lowercased class name>` exists in the class,
it is used to get the instance of the class.
- A couple more unit tests added.
2020-07-24 09:24:06 +02:00
Nestor Soriano
282d1dab86
DependencyManagement code folder moved inside an Internal folder.
2020-07-24 09:24:06 +02:00
Nestor Soriano
044a79d941
Added unit tests for `LegacyProxy` and `MockableLegacyProxy`.
...
Also:
- Added sutoloader for the `tests/tools` directory.
2020-07-24 09:24:04 +02:00
Nestor Soriano
c9154d071c
Add tests for `AbstractServiceProvider` and `ExtendedContainer`.
...
Also:
- Make the methods in `AbstractServiceProvider` protected.
- Add an autoloader for files in the `tests/php/src` directory.
- Fix a bug in the provisional (?) autoloader.
2020-07-24 09:23:05 +02:00
Christopher Allford
636327c110
Merge pull request #27043 from woocommerce/fix/unit-test-suite
...
Test Suite & Namespace PHPCS Changes
2020-07-20 08:40:00 -07:00
Claudio Sanches
86311a9903
Merge pull request #27046 from woocommerce/fix/26860
...
[Importer/Exporter] Fixed the value display of "Published" for children of draft variable products
2020-07-16 13:15:31 -03:00
Néstor Soriano
24bd19c517
Merge pull request #27038 from woocommerce/add/26192
...
Add existing meta keys to woocommerce_duplicate_product_exclude_meta filter
2020-07-16 11:02:09 +02:00
Claudio Sanches
156b061602
Added unit tests for importer and exporter
2020-07-15 21:49:26 -03:00
Christopher Allford
b71ddd35f1
Added sniffs to enforce PSR-4 in the `src` and `tests/php/src` directories
2020-07-15 16:09:00 -07:00
Christopher Allford
f72b8db576
Added some exceptions to the PHPCS standards for unit tests
...
The file comments and @throws tags are unnecessary in unit tests.
2020-07-15 14:29:13 -07:00
Christopher Allford
55385f6cec
Moved the orphaned unit test into the correct directory
2020-07-15 14:21:34 -07:00
Christopher Allford
13536bef5b
Corrected the WCInstallTest filename
...
It is in the `includes` test section and should have the same filename as the corresponding class.
2020-07-15 14:20:26 -07:00
Christopher Allford
fdee8dceaf
Moved test to correct directory
2020-07-15 07:08:09 -07:00
vedanshujain
aabf4bfe37
Add unit tests.
2020-07-15 15:27:34 +05:30
vedanshujain
af401a7d80
Add unit test
2020-07-14 23:32:12 +05:30
vedanshujain
6a8f9a4abe
Disabled flaky test
2020-07-01 19:09:50 +05:30
vedanshujain
836d764c67
Add tests
2020-07-01 19:09:07 +05:30
Vedanshu Jain
60ffc7ab99
Merge pull request #26583 from woocommerce/fix/26582
...
Fix regression caused by merging #25092 conflicting with #24828
2020-06-12 15:13:21 +05:30
Claudio Sanches
6afbed0c14
Fixed coding standards
2020-06-01 23:55:17 -03:00
vedanshujain
bbb7600f87
Add unit test for calculation based on rounding pref
2020-05-27 23:55:46 +05:30
vedanshujain
af942a131a
Add test to ensure that verify_base_table also creates table if needed.
2020-05-26 23:46:58 +05:30
vedanshujain
418741a0b2
Add unit test for verify_base_tables function
2020-05-22 18:32:04 +05:30
Christopher Allford
7bf9c31f64
Adjusted the column name normalization to avoid squashing meta key case sensitivity
...
Since we were converting the field to lowercase we ended up inserting meta in all lowercase, regardless of what it was in the CSV file. We should only be using the normalized field name when looking at the default columns, and should instead rely on a case-insensitive regex for the special columns.
One thing to note is that we're still defaulting the $headers array to the normalized field, as we don't want to change what is being passed to the filter for unmapped columns.
2020-05-14 21:20:55 -07:00
Christopher Allford
63ba6f7ee0
Moved the PSR-4 namespaced test directory to the correct folder
...
I know this probably doesn't belong in this PR, but it has been thoroughly discussed and I don't think anyone will mind :)
2020-05-14 21:20:47 -07:00
vedanshujain
27ad4a552e
Rename file and class to resemble PSR4 like convention for consistency.
2020-05-05 19:19:37 +05:30
vedanshujain
f4e169f21e
Moved test specific logic from bootstrap to test file
2020-05-02 00:31:54 +05:30
vedanshujain
13dfb8180f
Add unit test and a sample Woo plugin file
2020-05-01 22:47:08 +05:30
Christopher Allford
04ec11e90b
Added a PSR-4 namespaced tests/php folder for tests written against new code in the src directory
2020-04-28 15:41:04 -07:00