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

Script Loading Strategy - Update standalone business logic #47

Conversation

kt-12
Copy link

@kt-12 kt-12 commented Mar 6, 2023

Fixes #17

Trac ticket:


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@kt-12 kt-12 added this to the Milestone 3 milestone Mar 11, 2023
@kt-12 kt-12 requested review from 10upsimon and joemcgill March 11, 2023 01:21
@kt-12 kt-12 self-assigned this Mar 11, 2023
@kt-12 kt-12 added the needs:code-review This requires code review. label Mar 11, 2023
@kt-12 kt-12 added the Script Loading Strategy Issues relating to the Script Loading Strategy (WPP) label Mar 14, 2023
Co-authored-by: Simon Dowdles <72872375+10upsimon@users.noreply.github.com>
Copy link

@10upsimon 10upsimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kt-12 minor feedback, mostly grammatical and one or two smaller observations.

src/wp-includes/class-wp-scripts.php Show resolved Hide resolved
src/wp-includes/class-wp-scripts.php Outdated Show resolved Hide resolved
src/wp-includes/class-wp-scripts.php Outdated Show resolved Hide resolved
src/wp-includes/class-wp-scripts.php Outdated Show resolved Hide resolved
src/wp-includes/class-wp-scripts.php Outdated Show resolved Hide resolved
tests/phpunit/tests/dependencies/scripts.php Outdated Show resolved Hide resolved
tests/phpunit/tests/dependencies/scripts.php Outdated Show resolved Hide resolved
$this->assertSame( $expected, $output, $message );
}

public function data_standalone_inline_script() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docblock, I know it's a data provider for the test but we should still have docblocks or not?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about the use of a data provider here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned above this will be handled in PR #50.

tests/phpunit/tests/dependencies/scripts.php Outdated Show resolved Hide resolved
tests/phpunit/tests/dependencies/scripts.php Outdated Show resolved Hide resolved
kt-12 and others added 11 commits March 22, 2023 10:08
Co-authored-by: Simon Dowdles <72872375+10upsimon@users.noreply.github.com>
Co-authored-by: Simon Dowdles <72872375+10upsimon@users.noreply.github.com>
Co-authored-by: Simon Dowdles <72872375+10upsimon@users.noreply.github.com>
Co-authored-by: Simon Dowdles <72872375+10upsimon@users.noreply.github.com>
Co-authored-by: Simon Dowdles <72872375+10upsimon@users.noreply.github.com>
Co-authored-by: Simon Dowdles <72872375+10upsimon@users.noreply.github.com>
Co-authored-by: Simon Dowdles <72872375+10upsimon@users.noreply.github.com>
Co-authored-by: Simon Dowdles <72872375+10upsimon@users.noreply.github.com>
Co-authored-by: Simon Dowdles <72872375+10upsimon@users.noreply.github.com>
Co-authored-by: Simon Dowdles <72872375+10upsimon@users.noreply.github.com>
Co-authored-by: Simon Dowdles <72872375+10upsimon@users.noreply.github.com>
@10upsimon 10upsimon self-requested a review March 22, 2023 12:08
Copy link

@10upsimon 10upsimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kt-12 this is looking good. I am approving as I did not see the missing docblocks for test data providers as a total blocker, but if you can add them that would be great!

Copy link
Collaborator

@joemcgill joemcgill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functionality here looks good, I left some feedback about the use of data providers in this context, which I think we should adjust either here or in a following PR if needed.

To address your questions about adding doc blocks, I think that even though there are several places in the current WordPress unit tests where those don't exist, I would prefer us put in the extra effort to put some doc blocks in place on data providers wherever we are using them.

$this->assertSame( $expected, $output, $message );
}

public function data_non_standalone_before_inline_script_with_defer() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally speaking, data providers are meant to provide inputs into whatever functionality you are unit testing, and not just passing parameters to a PHPUnit assertion. I think that these would probably be better broken up into several individual tests instead.

$this->assertSame( $expected, $output, $message );
}

public function data_standalone_inline_script() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about the use of a data provider here.

@joemcgill joemcgill mentioned this pull request Mar 31, 2023
@kt-12 kt-12 requested a review from joemcgill March 31, 2023 09:04
Copy link
Collaborator

@joemcgill joemcgill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, since all the data providers are being split out in #50. Thanks, @kt-12

@kt-12 kt-12 merged commit db29ae2 into enhancement/wp-add-inline-script-standalone Apr 1, 2023
@kt-12 kt-12 deleted the enhancement/update-wp-add-inline-script-standalone branch April 1, 2023 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:code-review This requires code review. Script Loading Strategy Issues relating to the Script Loading Strategy (WPP)
Projects
No open projects
3 participants