wc-admin: Include package

This commit is contained in:
Paul Sealock 2019-11-11 15:08:02 +13:00 committed by Jeff Stieler
parent dd49f89e77
commit 4380087608
6 changed files with 65 additions and 5 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

@ -14,7 +14,8 @@
"maxmind-db/reader": "1.6.0",
"woocommerce/action-scheduler": "2.2.5",
"woocommerce/woocommerce-blocks": "2.5.11",
"woocommerce/woocommerce-rest-api": "1.0.7"
"woocommerce/woocommerce-rest-api": "1.0.7",
"woocommerce/woocommerce-admin": "dev-try/downgrade-autoloader"
},
"require-dev": {
"phpunit/phpunit": "7.5.20",
@ -64,7 +65,8 @@
"installer-paths": {
"packages/action-scheduler": ["woocommerce/action-scheduler"],
"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",

55
composer.lock generated
View File

@ -1,10 +1,10 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "d2f5085db8a002bfb5349dca8dc82878",
"content-hash": "84e367f04bc0b0a8c6a58d4cf074bd8f",
"packages": [
{
"name": "automattic/jetpack-autoloader",
@ -279,6 +279,53 @@
"description": "Action Scheduler for WordPress and WooCommerce",
"time": "2019-04-24T12:45:40+00:00"
},
{
"name": "woocommerce/woocommerce-admin",
"version": "dev-try/downgrade-autoloader",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-admin.git",
"reference": "26ee4d87d772d250a760453f0b422e300fb3abdc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/26ee4d87d772d250a760453f0b422e300fb3abdc",
"reference": "26ee4d87d772d250a760453f0b422e300fb3abdc",
"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-20T19:08:51+00:00"
},
{
"name": "woocommerce/woocommerce-blocks",
"version": "v2.5.11",
@ -2201,7 +2248,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' ) );
}
/**