Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Unit Tests #317

Merged
merged 9 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ jobs:
include:
# Test with the previous WP version.
- php: '7.4'
wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }}
wordpress: 'previous major version'
- php: '8.2'
wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }}
wordpress: 'previous major version'

env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ matrix.wordpress == '' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }}
WP_ENV_CORE: ${{ matrix.wordpress == '' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', needs.compute-previous-wordpress-version.outputs.previous-wordpress-version ) }}

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions classes/class-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -1500,11 +1500,11 @@ public function render_callback( $attributes, $content = null, $context = 'front
'class' => '',
);

if ( $attributes['blockUniqueClass'] ) {
if ( isset( $attributes['blockUniqueClass'] ) && $attributes['blockUniqueClass'] ) {
$array_atts['class'] .= $attributes['blockUniqueClass'];
}

if ( $attributes['align'] ) {
if ( isset( $attributes['align'] ) && $attributes['align'] ) {
$array_atts['class'] .= ' align' . $attributes['align'];
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"env:start": "wp-env start",
"env:stop": "wp-env stop",
"env:destroy": "wp-env destroy",
"test": "npm-run-all lint test:unit",
"test": "npm-run-all lint test:unit:php test:e2e",
"test:e2e": "playwright test --config tests/e2e/playwright.config.js",
"test:e2e:ui": "playwright test --config tests/e2e/playwright.config.js --ui",
"test:e2e:install-playwright": "npx playwright install",
Expand Down
3 changes: 3 additions & 0 deletions tests/phpunit/block-render-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ public function add_test_block( $attrs = array() ) {
lazyblocks()->add_block( array_merge(
array(
'slug' => $block_slug,
'supports' => array(
'align' => false,
),
),
$attrs
) );
Expand Down
3 changes: 3 additions & 0 deletions tests/phpunit/controls/select-control-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ public function add_test_block( $attrs = array() ) {
lazyblocks()->add_block( array_merge(
array(
'slug' => $block_slug,
'supports' => array(
'align' => false,
),
),
$attrs
) );
Expand Down
Loading