wc-admin: Include package

This commit is contained in:
Paul Sealock 2019-11-11 15:08:02 +13:00 committed by Jeff Stieler
parent 2668bf6025
commit 6c9e78850a
6 changed files with 64 additions and 4 deletions

View File

@ -31,6 +31,8 @@ output 3 "Updating package textdomains..."
# Replace text domains within packages with woocommerce
find ./packages/woocommerce-blocks \( -iname '*.php' -o -iname '*.js' \) -exec sed -i.bak -e "s/'woo-gutenberg-products-block'/'woocommerce'/g" -e "s/\"woo-gutenberg-products-block\"/'woocommerce'/g" {} \;
find ./packages/woocommerce-rest-api -iname '*.php' -exec sed -i.bak -e "s/, 'woocommerce-rest-api'/, 'woocommerce'/g" {} \;
find ./packages/woocommerce-admin -iname '*.php' -exec sed -i.bak -e "s/, 'woocommerce-admin'/, 'woocommerce'/g" {} \;
find ./packages/woocommerce-admin -iname '*.js' -exec sed -i.bak -e "s/, 'woocommerce-admin'/, 'woocommerce'/g" {} \;
# Cleanup backup files
find ./packages -name "*.bak" -type f -delete

View File

@ -12,7 +12,8 @@
"composer/installers": "1.7.0",
"maxmind-db/reader": "1.6.0",
"woocommerce/woocommerce-blocks": "2.5.10",
"woocommerce/woocommerce-rest-api": "1.0.6"
"woocommerce/woocommerce-rest-api": "1.0.6",
"woocommerce/woocommerce-admin": "dev-try/downgrade-autoloader"
},
"require-dev": {
"phpunit/phpunit": "7.5.20",
@ -60,7 +61,8 @@
"extra": {
"installer-paths": {
"packages/woocommerce-rest-api": ["woocommerce/woocommerce-rest-api"],
"packages/woocommerce-blocks": ["woocommerce/woocommerce-blocks"]
"packages/woocommerce-blocks": ["woocommerce/woocommerce-blocks"],
"packages/woocommerce-admin": ["woocommerce/woocommerce-admin"]
},
"scripts-description": {
"test": "Run unit tests",

53
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "316f960abc40df62fbc75b77930323fc",
"content-hash": "07bec7718ef13f40b195815d51d45e61",
"packages": [
{
"name": "automattic/jetpack-autoloader",
@ -224,6 +224,53 @@
],
"time": "2019-12-19T22:59:03+00:00"
},
{
"name": "woocommerce/woocommerce-admin",
"version": "dev-try/downgrade-autoloader",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-admin.git",
"reference": "7cdfd0eccb2f9a8cccd60213d041d406a5da9d33"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/7cdfd0eccb2f9a8cccd60213d041d406a5da9d33",
"reference": "7cdfd0eccb2f9a8cccd60213d041d406a5da9d33",
"shasum": ""
},
"require": {
"automattic/jetpack-autoloader": "^1.2.0",
"composer/installers": "1.7.0",
"php": ">=5.6|>=7.0"
},
"require-dev": {
"phpunit/phpunit": "7.5.18",
"woocommerce/woocommerce-sniffs": "0.0.9"
},
"type": "wordpress-plugin",
"extra": {
"scripts-description": {
"test": "Run unit tests",
"phpcs": "Analyze code against the WordPress coding standards with PHP_CodeSniffer",
"phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier"
}
},
"autoload": {
"classmap": [
"includes/"
],
"psr-4": {
"Automattic\\WooCommerce\\Admin\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-3.0-or-later"
],
"description": "A modern, javascript-driven WooCommerce Admin experience.",
"homepage": "https://github.com/woocommerce/woocommerce-admin",
"time": "2020-01-17T00:35:41+00:00"
},
{
"name": "woocommerce/woocommerce-blocks",
"version": "v2.5.10",
@ -2146,7 +2193,9 @@
],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": [],
"stability-flags": {
"woocommerce/woocommerce-admin": 20
},
"prefer-stable": true,
"prefer-lowest": false,
"platform": {

View File

@ -29,6 +29,7 @@ class Packages {
protected static $packages = array(
'woocommerce-blocks' => '\\Automattic\\WooCommerce\\Blocks\\Package',
'woocommerce-rest-api' => '\\Automattic\\WooCommerce\\RestApi\\Package',
'woocommerce-admin' => '\\Automattic\\WooCommerce\\Admin\\Package',
);
/**

View File

@ -82,6 +82,10 @@ class WC_Unit_Tests_Bootstrap {
WC_Install::install();
// Initialize the WC API extensions.
\Automattic\WooCommerce\Admin\Install::create_tables();
\Automattic\WooCommerce\Admin\Install::create_events();
// Reload capabilities after install, see https://core.trac.wordpress.org/ticket/28374
if ( version_compare( $GLOBALS['wp_version'], '4.7', '<' ) ) {
$GLOBALS['wp_roles']->reinit();

View File

@ -27,6 +27,7 @@ class WC_Tests_Packages extends WC_Unit_Test_Case {
public function test_packages_exist() {
$this->assertTrue( \Automattic\WooCommerce\Packages::package_exists( 'woocommerce-blocks' ) );
$this->assertTrue( \Automattic\WooCommerce\Packages::package_exists( 'woocommerce-rest-api' ) );
$this->assertTrue( \Automattic\WooCommerce\Packages::package_exists( 'woocommerce-admin' ) );
}
/**
@ -35,6 +36,7 @@ class WC_Tests_Packages extends WC_Unit_Test_Case {
public function test_autoload_packages() {
$this->assertTrue( class_exists( '\Automattic\WooCommerce\Blocks\Package' ) );
$this->assertTrue( class_exists( '\Automattic\WooCommerce\RestApi\Package' ) );
$this->assertTrue( class_exists( '\Automattic\WooCommerce\Admin\Package' ) );
}
/**