Skip to content

Commit

Permalink
Merge branch 'develop' into env/deploy-free-code
Browse files Browse the repository at this point in the history
  • Loading branch information
kurudrive committed Aug 23, 2022
2 parents 2da9759 + 129d560 commit cf063c2
Show file tree
Hide file tree
Showing 12 changed files with 247 additions and 66 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/develop-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ on:

jobs:
php_unit:
name: php unit test
runs-on: ubuntu-latest
strategy:
matrix:
php: [7.3, 7.4]
# これが先にdevelopにマージされたら 8.0 を追加して 8.0 でおそらく baloon関連のテストでエラーになるので修正する
php-versions: ['7.3', '7.4']
# これが先にdevelopにマージされたら 5.8.4 不具合修正のブランチ( https://github.com/vektor-inc/vk-blocks-pro/pull/1372 )にマージして '5.8.4' を追加
wp-versions: ['6.0.1','5.9.3','5.8.4']
name: PHP Unit test ${{ matrix.php-versions }} / WP ${{ matrix.wp-versions }} Test on ${{ matrix.operating-system }}
services:
mysql:
image: mysql:5.7
Expand Down Expand Up @@ -43,11 +46,11 @@ jobs:
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
- name: Setup PHP ${{ matrix.php }}
key: ${{ runner.os }}-php${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
php-version: ${{ matrix.php-versions }}
- name: install npm scripts
run: npm install
- name: install Composer Package
Expand All @@ -57,14 +60,15 @@ jobs:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
- name: Install several WordPress version by wp-env.override.json
run: WP_ENV_PHP_VERSION=${{ matrix.php-versions }} WP_ENV_CORE=WordPress/WordPress#${{ matrix.wp-versions }} npm run wp-env start --update
- name: Check WordPress Version
run: npm run wp-env run cli wp core version
# dist の中で build は実行している
- name: Build and Dist
run: npm run dist

# PHPUnit
- name: Run @wordpress/env
run: npx wp-env start
- name: PHP Unit Test
run: npm run phpunit

Expand Down
16 changes: 4 additions & 12 deletions inc/vk-blocks/class-vk-blocks-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static function balloon_image_number() {
*
* @return $balloon_meta_schema
*/
public function balloon_meta_schema() {
public static function balloon_meta_schema() {
$number = self::balloon_image_number();
$return_array = array();
$return_array['default_icons'] = array(
Expand Down Expand Up @@ -188,17 +188,9 @@ public static function get_properties( $schema ) {
* @return options
*/
public static function get_balloon_meta_options() {
$options = get_option( 'vk_blocks_balloon_meta' );
$number = self::balloon_image_number();
$defaults = array();
$defaults['default_icons'] = array();
for ( $i = 1; $i <= $number; $i++ ) {
$defaults['default_icons'][ $i ] = array(
'name' => null,
'src' => null,
);
};
$options = wp_parse_args( $options, $defaults );
$options = get_option( 'vk_blocks_balloon_meta' );
$defaults = self::get_properties( self::balloon_meta_schema() );
$options = wp_parse_args( $options, $defaults );
return $options;
}

Expand Down
12 changes: 7 additions & 5 deletions inc/vk-blocks/load-bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ function vk_blocks_load_bootstrap( $hook_suffix ) {
* @return void
*/
function vk_blocks_load_bootstrap_for_site_editor() {
if ( wp_is_block_theme() && is_admin() ) {
$style_path = wp_normalize_path( VK_BLOCKS_DIR_PATH . '/build/bootstrap_vk_using.css' );
if ( file_exists( $style_path ) ) {
$dynamic_css = file_get_contents( $style_path );
wp_add_inline_style( 'wp-edit-blocks', $dynamic_css );
if ( function_exists( 'wp_is_block_theme' ) ) { // Cope with bofore WP5.8.
if ( wp_is_block_theme() && is_admin() ) {
$style_path = wp_normalize_path( VK_BLOCKS_DIR_PATH . '/build/bootstrap_vk_using.css' );
if ( file_exists( $style_path ) ) {
$dynamic_css = file_get_contents( $style_path );
wp_add_inline_style( 'wp-edit-blocks', $dynamic_css );
}
}
}
}
Expand Down
54 changes: 27 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"update:savedVersion": "bash -c 'npm run cli wp post meta update $0 _vkb_saved_block_version $1'",
"packages-update": "npx wp-scripts packages-update",
"reinstall": "rm -rf node_modules/ && npm install && npm run build",
"prepare": "husky install"
"prepare": "husky install",
"wp-env": "wp-env"
},
"author": "",
"license": "MIT",
Expand All @@ -56,7 +57,7 @@
"@wordpress/e2e-test-utils": "^6.0.2",
"@wordpress/edit-post": "^6.0.2",
"@wordpress/element": "^4.1.1",
"@wordpress/env": "^4.2.2",
"@wordpress/env": "^4.9.0",
"@wordpress/hooks": "^3.3.1",
"@wordpress/i18n": "^4.3.1",
"@wordpress/icons": "^7.0.1",
Expand Down Expand Up @@ -101,4 +102,4 @@
"rimraf": "^3.0.2",
"sass": "1.32.12"
}
}
}
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ e.g.

== Changelog ==

= 1.41.2 =
[ Improvement ][ Page list from ancestor ] Fix behavior site editor.
[ Other ] Add PHPUnit test on Several PHP and WordPress versions
[ Bug Fix ] Fatal error in WordPress 5.8
[ Bug Fix ][ highlighter ] cope with color palette with alpha.
[ Bug Fix ][ button ] buttonColorCustom clear convert to primary.

Expand Down
4 changes: 2 additions & 2 deletions test/phpunit/free/test-page-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class PageContentBlockTest extends WP_UnitTestCase {
/**
* 各テストケースの実行直前に呼ばれる
*/
public function setUp() {
public function setUp(): void {
parent::setUp();

$page = array(
Expand All @@ -35,7 +35,7 @@ public function setUp() {
/**
* Tear down each test method.
*/
public function tearDown() {
public function tearDown(): void {
wp_delete_post( $this->page_id, true );
$this->page_id = 0;
}
Expand Down
6 changes: 3 additions & 3 deletions test/phpunit/pro/test-breadcrumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Breadcrumb extends WP_UnitTestCase {
/**
* 各テストケースの実行直前に呼ばれる
*/
public function setUp() {
public function setUp() : void {
parent::setUp();

$catarr = array(
Expand Down Expand Up @@ -56,7 +56,7 @@ public function setUp() {
/**
* Tear down each test method.
*/
public function tearDown() {
public function tearDown(): void {
wp_delete_post( $this->page_id, true );
$this->page_id = 0;

Expand Down Expand Up @@ -106,7 +106,7 @@ public function test_breadcrumb() {
* @param string $role administrator, editor, author, contributor ...
* @return void
*/
public function set_current_user( $role ) {
public function set_current_user( $role ) : void {
$user = $this->factory()->user->create_and_get(
array(
'role' => $role,
Expand Down
4 changes: 2 additions & 2 deletions test/phpunit/pro/test-child-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ChildPageBlockTest extends WP_UnitTestCase {
/**
* 各テストケースの実行直前に呼ばれる
*/
public function setUp() {
public function setUp(): void {
parent::setUp();

$page = array(
Expand All @@ -51,7 +51,7 @@ public function setUp() {
/**
* Tear down each test method.
*/
public function tearDown() {
public function tearDown(): void {
wp_delete_post( $this->page_id, true );
$this->page_id = 0;

Expand Down
Loading

0 comments on commit cf063c2

Please sign in to comment.