Commit Graph

35983 Commits

Author SHA1 Message Date
Nestor Soriano 064ae558ab Changes in the overall organization of the dependency injection:
- The `Container` class now implements `Psr\Container\ContainerInterface`
  (and registers itself as such), holding a private instance of the
  real container. This way it's a read-only container from the point
  of view of plugins (which should use their own containers, but
  can still use this to get WooCommerce classes).
- All registrations are now done in the `Container` constructor via
  service providers.
- The container instance is now held in a global variable, set in
  `woocommerce.php`
- Added the `wc_get_container` function for old code.
- Added the `AbstractServiceProvider` class, which inherits with the
  corresponding League's class and adds some utility methods,
  most notably `add/shareWithAutoArguments`.
- Added the `ActionsProxy` and `LegacyProxy` classes, they are
  registered via a dedicated service provider.
- `WC_Queue_Interface` is no longer resolvable via the container
  (which is for classes inside `src` only).
- All the method names in the new classes have the format `fooBarFizz`
  to be PSR4 compliant, so the MethodNameInvalid error has been
  disabled in phpcs.xml for the `src` directory.
- Introduced the `@public` annotation for public API classes
  (classes that plugins can use and whose backwards compatibility
  we guarantee), applied to `ActionsProxy` and to `LegacyProxy` for now.
- Removed the hack for the autoloader as now it doesn't work anyway.
  For the changes in this branch to work, now WP_DEBUG must be false.
2020-07-24 09:23:01 +02:00
Nestor Soriano 23df8a4d17 Revert a couple of files to its original content after a messed rebase 2020-07-24 09:20:24 +02:00
Nestor Soriano a7829525eb Changes in the dependency injection container:
- Renamed from `ObjectContainer` to `Container`.
- It now inherits from PHP League's `Container`.
- It has now a `defineAsSharedAutowired` method.
- Initialization moved to the `WooCommerce::init_container` method.
- The static method for object resolution is now `WooCommerce::get_instance_of`.
2020-07-24 09:20:24 +02:00
Nestor Soriano 281ec18158 Undo the registration of old singletons in the DI container.
The container will in principle be used only to register classes
in the `src` directory.

Also, CustomerProvider class removed.
2020-07-24 09:20:24 +02:00
Nestor Soriano 518c52b829 Move PSR4 autoloading from woocommerce.php to the Autoloader class 2020-07-24 09:20:24 +02:00
Nestor Soriano 312383ae47 First steps towards introducing a dependency injection framework.
- Add PHP League's Container package via Composer.
- Add an ObjectContainer class that encapsulates all the configuration
  and insulates the codebase from the concrete DI engine used.
- Add an improved ReflectionContainer class that will allow to
  register individual classes as singletons while autowiring.
- Use ObjectContainer to resolve the WooCommerce class, everything
  instantiated with "new" inside it, and all singletons that are
  usually obtained via WC() function.
- Introduce the CustomerProvider class.
- Introduce a service provider to resolve WC_Queue_Interface,
  this replaces the WC_Queue class.
- Mark as obsolete all the replaced "instance()" methods,
  and the entire WC_Queue class.
2020-07-24 09:20:21 +02:00
Claudio Sanches 64f4fb85e2 Move variation validation logic to add to cart 2020-07-23 19:10:42 -03:00
budzanowski 7bc30512a4 Remove extra tab. 2020-07-23 23:22:16 +02:00
budzanowski 623363ba50 Check for if new locale has language pack installed. 2020-07-23 22:52:59 +02:00
Tam Mullen 86da271e6e
Merge pull request #27063 from woocommerce/fix/e2e-obw-4.3
Fix OBW e2e test in WC 4.3: Scroll Home Screen tasks list into view for the `Set up shipping` click to work
2020-07-23 15:48:18 +01:00
vedanshujain e1e5acfe1f Add 'includes/api/' from commit '880b82a0373b5b019294409b4d29f861b8964261'
git-subtree-dir: includes/api
git-subtree-mainline: 5a784bc1e4
git-subtree-split: 880b82a037
2020-07-23 00:34:46 +05:30
vedanshujain 880b82a037 Keep only source to merge with core. 2020-07-23 00:29:41 +05:30
vedanshujain 5a784bc1e4 Keep only unit test files for merge into core. 2020-07-23 00:07:29 +05:30
vedanshujain e42b97e7ea Add 'tests/legacy/unit-tests/api/' from commit '5335083922d350e73eaf0e8370d8335e1b076b55'
git-subtree-dir: tests/legacy/unit-tests/api
git-subtree-mainline: 2d39467fb4
git-subtree-split: 5335083922
2020-07-22 23:56:29 +05:30
vedanshujain 5335083922 Keep only unit test files for merge into core. 2020-07-22 23:55:16 +05:30
Dhruvin c843455b0b Clear Action Scheduler Transients
Currently when Clear Transients action is performed via System Tools, the Action Scheduler Transients are not cleared resulting in incorrect comment counts.
2020-07-22 17:41:34 +05:30
Peter Fabian 2f53fac78c Update jetpack autoloader to ^1.6 2020-07-22 17:40:59 +05:30
Andrew Minion 1387725088 add X-WP-Total headers to product attribute API calls 2020-07-22 17:39:58 +05:30
Csaba Maulis 0c366c5a75 Fix `date_expire` and `expiry_date` field schema definitions
Coupon controller for all API versions
2020-07-22 17:38:57 +05:30
Mindaugas Budreika 0aac20b404 forward query params (product variations) 2020-07-22 17:23:47 +05:30
vedanshujain bc52dbad89 Fix tests in response to Core 25630 2020-07-22 17:22:16 +05:30
vedanshujain 0576b142a4 Add unit tests 2020-07-22 17:20:46 +05:30
vedanshujain 7d335c5eab Remove `modified` enum from customer because its not supported.
Customers are based on `users` table which does not have a modified or similar column to track last modified timestamp, so this param cannot be supported at this time.
2020-07-22 17:20:35 +05:30
Stamoulis Zamanis a37628e94b Include modified in orderby filter 2020-07-22 17:20:23 +05:30
budzanowski 70c65f60f2 Don't process if there are no plugins to check. 2020-07-22 12:16:20 +02:00
budzanowski ed1a181eca Update api url. 2020-07-22 10:56:04 +02:00
Christopher Allford 2d39467fb4
Merge pull request #27073 from mahdiyazdani/patch-3
Removed dot "." from the generated password string
2020-07-21 11:12:02 -07:00
Jeff Stieler 76e42fec98 Update E2E env jest preset default version.
6.x.x will update the weak ref detection dependencies.
2020-07-21 13:51:16 -04:00
budzanowski 2d8f308a08 Remove redundant check. 2020-07-21 18:41:34 +02:00
Claudio Sanches 133462d645
Update class-wc-cart.php 2020-07-21 13:13:10 -03:00
Claudio Sanches 7b7102c9de
Fixed typo 2020-07-21 13:12:39 -03:00
Claudio Sanches 85f81d0e0b
Add docblock 2020-07-21 13:10:43 -03:00
Peter Fabian 544a7322eb
Merge pull request #27080 from woocommerce/update/woocommerce-admin/1.3.1
[4.3.1] Update WooCommerce Admin Package.
2020-07-21 12:08:10 +02:00
Timmy Crawford 000e695a34 [4.3.1] Update WooCommerce Admin Package. 2020-07-20 16:57:57 -07:00
Claudio Sanches f758b2bb31
Fixed coding standards 2020-07-20 18:08:02 -03:00
Christopher Allford 840554d788
Merge pull request #27017 from woocommerce/fix/25480
Fixed the `shipping_zone_method` CLI command's instance_id parameter
2020-07-20 11:00:08 -07:00
Damir Ha 4c7a0f1580 Remove country label 2020-07-20 18:18:14 +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
budzanowski 0a10d64394 Update code to the new server setup. 2020-07-20 17:16:18 +02:00
Mike Dent 541f68363e Test code updated, with thanks to @ObliviousHarmony 2020-07-20 15:45:13 +01:00
Mahdi Yazdani c3c15a4f2a
Removed dot "." from the generated password string
There is an extra dot "." right after the generated password string which is not part of the actual password and creates confusion for the users who want to login. It would be great if we can remove it.
2020-07-19 13:45:46 +03:00
Ron Rennick d3ab19b7cf eliminate internal use of deprecated functions
- remove deprecation of offsetGet as it is used throught abstract order
- eliminate use of offsetGet in unit tests, structured data, order functions
-
2020-07-17 17:14:26 -03:00
Julia Amosova 10bfb679eb Scroll home screen tasks list into view for the click to work 2020-07-17 12:44:46 -04:00
Brian 78b2141bf5
Update class-wc-countries.php 2020-07-17 13:39:26 +02:00
Brian e27fc1a8fe
Update class-wc-countries.php 2020-07-17 13:38:47 +02:00
Brian a1e0959e09
Update class-wc-countries.php 2020-07-17 13:37:56 +02:00
Brian d330d98431
Update states.php 2020-07-17 13:36:45 +02:00
Damir Ha 5e2bae2a7d Update currency_pos fix 2020-07-17 13:06:40 +02:00
Damir Ha d37a82fec8 Add Locale info and Hide state 2020-07-17 13:04:20 +02:00
Brian bf92d07442
add postcode validation for liechtenstein
added the postcode validation for liechtenstein.
max. 4 digits
has to start with 94**
second * can only be a 8 or a 9
2020-07-17 11:50:51 +02:00