Skip to content

Commit

Permalink
Release 3.0.0 beta 2 (#507)
Browse files Browse the repository at this point in the history
* Add unit tests for CPT archive metadata

* Add unit test for CPT term archive

* Beautify code

* Remove custom post type to simplify test

It doesn’t change the functionality to have a custom post type or not, so to simplify we’ll remove that from the test.

* Change cpt-tax-archive to cpt-archive

* Fix code comments

* Clarify the name of the custom taxonomy

* Update check for cpt and taxonomy archives

* Change test name

* functioning e2e framework

* hello world test

* package-lock (+@wordpress/e2e-test-utils)

* hook tests into CI

* limit to a single job

* Update npm to latest

* cache npm in setup-node

* switch to lts syntax for node-version

* some progress using docker compose

* more progress -- it's working!

* docker-compose vs docker compose

* trying to wait for wp

* working loop i hope

* bg docker-compose correctly

* tweak name & rm unused var

* rm the strategy and just code in node lts

* try npm ci

* README for e2e tests

* fixup watch runner name

* add option to reset wp db to init script

* update readme

* update e2e readme

* incraese timeout so tests pass in interactive mode

* Update tests/e2e/README.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* fixup watch script ws

* add details to the 'Run the tests' section

* Add step to node test to confirm the build is up-to-date

* demonstrate failure case when untracked file is present

* demonstrate failure case when change to src is not present in build

* remove failure -- this should pass

* Bump prettier from 2.3.2 to 2.4.1

Bumps [prettier](https://github.com/prettier/prettier) from 2.3.2 to 2.4.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.3.2...2.4.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Renaming alpha

* Bump @wordpress/scripts from 17.1.0 to 18.0.1

Bumps [@wordpress/scripts](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts) from 17.1.0 to 18.0.1.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/scripts/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/scripts@18.0.1/packages/scripts)

---
updated-dependencies:
- dependency-name: "@wordpress/scripts"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Simplifying get_options function

* Tests: Improve the get_current_url data provider

Data providers actually provide an iterator rather than just an array, so we can build up the data using `yield` instead.

As per https://peakd.com/hive-168588/@crell/fun-with-phpunit-data-providers this has several advantages:

1. It's easier to read, making it better for future you to understand the code.
1. It's less indented, which gives you more room for longer lines for each value.
1. Because each test set is syntactically independent, it's easier to add new ones, reorder them, or temporarily comment out a single test set.
1. If a given test set needs more setup than just a static list, it's simple to put that setup before the `yield` statement for which it is relevant.

As per the follow-up article https://peakd.com/hive-168588/@crell/advanced-phpunit-shenanigans, I've also included a `@testdox` line on the test method. When this contains the method parameters, it completely overrides the sentence when the `--testdox` flag is called when running PHPUnit.

* Tests: Rename final *-test.php file to *Test.php

PSR-4 naming is needed for PHPUnit 9.1 support.

Fixes #379.

* Update tests/e2e/README.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update tests/e2e/README.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update tests/e2e/README.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Updating package-lock

* Removing ampersand

* Revert "Removing ampersand"

This reverts commit 228c2b72b6748c17c8f5d4fbed296bc159a768d7.

* Remove jQuery from recommended widget

* Using built code

* Forcing reset of e2e

* Change trigger

* Revert "Change trigger"

This reverts commit f61c2a3c36b6634706d0ab70d90db97d3489c8fd.

* Fix flaky test

* Updating package-lock

* Rollback tests changes

* Changing red color in admin to match wp-admin

* Remove unused default logo variable

* Using npm caching on GitHub Actions

* Integrations: Extract into separate classes

- Move AMP and Facebook Instant Article integrations into separate files.
- Improve and add tests that better check for the intended behaviour.

* Clarifying success message

* Updating built files

* Fixing syntax error

* Remove unused return_personalized_json function

* Hide admin warning on network admin

* Fix typo

* Integrations: Extract into separate classes

- Move AMP and Facebook Instant Article integrations into separate files.
- Improve and add tests that better check for the intended behaviour.

* Adding unit tests

* Fix linting issues

* Simplifying set_options on test

* Separating function for testing

* Update @covers annotation

* Simplifying logic

* Fix rendering errors with multiple widgets

* Fixing linting issues

* Fixing issue with sanitization

* Cleaning up logic

* Updating tests to be more reliable

* Separating subtests

* Tests: Improve get current URL tests

The focus of these tests is on the parsing issues related to the domain, port, and potential path, and this is represented in the data provider.

However, it's good to be able to confirm that going to the homepage, random URL and a post via it's ID, also work well for each of the combinations in the first parts of the URL.

* Adding 3.0 upgrade notice on README

* Encoding boolean values

* Fix linting issues

* Fix linting issues

* Small typo

* Fix linting issues

* Fix linting issues

* Split out plugin actions links logic

Moves the logic that adds the plugin action link to its own class.

Adds integration tests.

See #96.

* Tests: e2e for verifying the plugin action link

See #401.

* API Key: Add utility method for checking it is set

Also add utility method for checking if it is missing.

Includes unit tests.

Closes #395.

* API key: add utility method to retrieve key

Adds unit test.

* Testcase: Allow getMethod() to use different class

The existing method made the assumption that only non-public methods in the `Parsely` class would need to be made available for testing with Reflection.

This updates the method to allow methods in other classes to be reflected as well.

* Apply suggestions from code review

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Apply suggestions from code review

Clarify variable name.

Co-authored-by: Pau Argelaguet <pauarge@users.noreply.github.com>

* Adapting code to new project layout

* Using utility function to check for API keys

* Apply suggestions from code review

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Add admin warning for minimum requirements in 3.0 (#408)

* Adding admin upgrade warning

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Feature/improve test environment (#411)

* Tests: make future-compatible

- Use the snake_case fixture names
- Use wp-test-utils 1.0.0, and remove explicit PHPUnit constraints
- Refresh phpunit config file, including switching to TestDox output format

* CI: Use WP trunk with new test improvements

* CI: No need for pcov-clobber with PHPUnit 8.5

Also, don't ignore platform requirements for PHP 8, as we no longer need to force install PHPUnit 7.5 onto it.

* Bootstrap: Remove PHP_Token references

* Add coverage report back in

Not used yet, but without it, seems like no coverage check is actually done.

* CI: Add support for PHP 8.1 (allowed failures)

Also ensure `convertDeprecationsToExceptions` is true to better highlight PHP 8.1 native deprecation notices.

* Tests: split into unit and integration tests

See #179.

* Bootstrap: Move global code into a function

With all global code (other than some class file requires) in a function that is hooked in when WordPress runs, we can remove the `die`, which allows this file, with the defined constants and functions, to be included for unit tests.

* CI: Support running unit tests

* CI: Run unit tests on PHP 8 as well

* Tests: Define constants from plugin root file

* Tests: Fix CS

* Tests: Fix namespace

* Replace constants

* Various fixes

- Improve handling of no options being set.
- Fix CS
- Fix coverage annotations
- Fix wrong TestCase reference.

* Composer: Improve coverage scripts

Now with verbosity, which is useful in PHPUnit 9.5 to see why a test is classed as risky.

* CI: Add PHP 8.2

* CI: Fix indentation

* CI: Run coverage for integration tests

* CI: Always run coverage on multisite installs

* Re-fix Settings link on plugins page

* Tests: Re-add PluginActions test

Somehow got dropped from my branch when I rebased on to `develop`.

Co-authored-by: Pau Argelaguet <pauarge@users.noreply.github.com>

* Split out row action link logic (#406)

* Bring develop up to date with 2.6.0 (#415)

* Release 2.6.0 (#414)

* Hide the recommendation widget until the element is populated

* Update hidden classname per feedback

* Add conditional for cpt archives

Change to get queried object instead of category.

* Change conditional to is_archive

`is_archive()` is better in this case because it also targets taxonomy archives as well as custom post type archives.

* Add unit tests for CPT archive metadata

* Add unit test for CPT term archive

* Beautify code

* Remove custom post type to simplify test

It doesn’t change the functionality to have a custom post type or not, so to simplify we’ll remove that from the test.

* Change cpt-tax-archive to cpt-archive

* Fix code comments

* Clarify the name of the custom taxonomy

* Update check for cpt and taxonomy archives

* Change test name

* functioning e2e framework

* hello world test

* package-lock (+@wordpress/e2e-test-utils)

* hook tests into CI

* limit to a single job

* Update npm to latest

* cache npm in setup-node

* switch to lts syntax for node-version

* some progress using docker compose

* more progress -- it's working!

* docker-compose vs docker compose

* trying to wait for wp

* working loop i hope

* bg docker-compose correctly

* tweak name & rm unused var

* rm the strategy and just code in node lts

* try npm ci

* README for e2e tests

* fixup watch runner name

* add option to reset wp db to init script

* update readme

* update e2e readme

* incraese timeout so tests pass in interactive mode

* Update tests/e2e/README.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* fixup watch script ws

* add details to the 'Run the tests' section

* Add step to node test to confirm the build is up-to-date

* demonstrate failure case when untracked file is present

* demonstrate failure case when change to src is not present in build

* remove failure -- this should pass

* Bump prettier from 2.3.2 to 2.4.1

Bumps [prettier](https://github.com/prettier/prettier) from 2.3.2 to 2.4.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.3.2...2.4.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Renaming alpha

* Bump @wordpress/scripts from 17.1.0 to 18.0.1

Bumps [@wordpress/scripts](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts) from 17.1.0 to 18.0.1.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/scripts/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/scripts@18.0.1/packages/scripts)

---
updated-dependencies:
- dependency-name: "@wordpress/scripts"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Simplifying get_options function

* Tests: Improve the get_current_url data provider

Data providers actually provide an iterator rather than just an array, so we can build up the data using `yield` instead.

As per https://peakd.com/hive-168588/@crell/fun-with-phpunit-data-providers this has several advantages:

1. It's easier to read, making it better for future you to understand the code.
1. It's less indented, which gives you more room for longer lines for each value.
1. Because each test set is syntactically independent, it's easier to add new ones, reorder them, or temporarily comment out a single test set.
1. If a given test set needs more setup than just a static list, it's simple to put that setup before the `yield` statement for which it is relevant.

As per the follow-up article https://peakd.com/hive-168588/@crell/advanced-phpunit-shenanigans, I've also included a `@testdox` line on the test method. When this contains the method parameters, it completely overrides the sentence when the `--testdox` flag is called when running PHPUnit.

* Tests: Rename final *-test.php file to *Test.php

PSR-4 naming is needed for PHPUnit 9.1 support.

Fixes #379.

* Update tests/e2e/README.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update tests/e2e/README.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update tests/e2e/README.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Updating package-lock

* Removing ampersand

* Revert "Removing ampersand"

This reverts commit 228c2b72b6748c17c8f5d4fbed296bc159a768d7.

* Remove jQuery from recommended widget

* Using built code

* Forcing reset of e2e

* Change trigger

* Revert "Change trigger"

This reverts commit f61c2a3c36b6634706d0ab70d90db97d3489c8fd.

* Fix flaky test

* Updating package-lock

* Rollback tests changes

* Changing red color in admin to match wp-admin

* Remove unused default logo variable

* Using npm caching on GitHub Actions

* Integrations: Extract into separate classes

- Move AMP and Facebook Instant Article integrations into separate files.
- Improve and add tests that better check for the intended behaviour.

* Clarifying success message

* Updating built files

* Fixing syntax error

* Remove unused return_personalized_json function

* Hide admin warning on network admin

* Fix typo

* Integrations: Extract into separate classes

- Move AMP and Facebook Instant Article integrations into separate files.
- Improve and add tests that better check for the intended behaviour.

* Adding unit tests

* Fix linting issues

* Simplifying set_options on test

* Separating function for testing

* Update @covers annotation

* Simplifying logic

* Fix rendering errors with multiple widgets

* Fixing linting issues

* Fixing issue with sanitization

* Cleaning up logic

* Updating tests to be more reliable

* Separating subtests

* Tests: Improve get current URL tests

The focus of these tests is on the parsing issues related to the domain, port, and potential path, and this is represented in the data provider.

However, it's good to be able to confirm that going to the homepage, random URL and a post via it's ID, also work well for each of the combinations in the first parts of the URL.

* Adding 3.0 upgrade notice on README

* Encoding boolean values

* Fix linting issues

* Fix linting issues

* Small typo

* Fix linting issues

* Fix linting issues

* Split out plugin actions links logic

Moves the logic that adds the plugin action link to its own class.

Adds integration tests.

See #96.

* Tests: e2e for verifying the plugin action link

See #401.

* API Key: Add utility method for checking it is set

Also add utility method for checking if it is missing.

Includes unit tests.

Closes #395.

* API key: add utility method to retrieve key

Adds unit test.

* Testcase: Allow getMethod() to use different class

The existing method made the assumption that only non-public methods in the `Parsely` class would need to be made available for testing with Reflection.

This updates the method to allow methods in other classes to be reflected as well.

* Apply suggestions from code review

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Apply suggestions from code review

Clarify variable name.

Co-authored-by: Pau Argelaguet <pauarge@users.noreply.github.com>

* Adapting code to new project layout

* Using utility function to check for API keys

* Apply suggestions from code review

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Add admin warning for minimum requirements in 3.0 (#408)

* Adding admin upgrade warning

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Feature/improve test environment (#411)

* Tests: make future-compatible

- Use the snake_case fixture names
- Use wp-test-utils 1.0.0, and remove explicit PHPUnit constraints
- Refresh phpunit config file, including switching to TestDox output format

* CI: Use WP trunk with new test improvements

* CI: No need for pcov-clobber with PHPUnit 8.5

Also, don't ignore platform requirements for PHP 8, as we no longer need to force install PHPUnit 7.5 onto it.

* Bootstrap: Remove PHP_Token references

* Add coverage report back in

Not used yet, but without it, seems like no coverage check is actually done.

* CI: Add support for PHP 8.1 (allowed failures)

Also ensure `convertDeprecationsToExceptions` is true to better highlight PHP 8.1 native deprecation notices.

* Tests: split into unit and integration tests

See #179.

* Bootstrap: Move global code into a function

With all global code (other than some class file requires) in a function that is hooked in when WordPress runs, we can remove the `die`, which allows this file, with the defined constants and functions, to be included for unit tests.

* CI: Support running unit tests

* CI: Run unit tests on PHP 8 as well

* Tests: Define constants from plugin root file

* Tests: Fix CS

* Tests: Fix namespace

* Replace constants

* Various fixes

- Improve handling of no options being set.
- Fix CS
- Fix coverage annotations
- Fix wrong TestCase reference.

* Composer: Improve coverage scripts

Now with verbosity, which is useful in PHPUnit 9.5 to see why a test is classed as risky.

* CI: Add PHP 8.2

* CI: Fix indentation

* CI: Run coverage for integration tests

* CI: Always run coverage on multisite installs

* Re-fix Settings link on plugins page

* Tests: Re-add PluginActions test

Somehow got dropped from my branch when I rebased on to `develop`.

Co-authored-by: Pau Argelaguet <pauarge@users.noreply.github.com>

* Split out row action link logic (#406)

* Bumping version numbers

* Add changelog

* Update CHANGELOG.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Moving deprecated notes from changelog

Co-authored-by: Jeff Bowen <jblz@users.noreply.github.com>
Co-authored-by: mikeyarce <mikeyarce@gmail.com>
Co-authored-by: Gary Jones <gary.jones@automattic.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Gary Jones <gary@gamajo.com>

* Bumping version number

Co-authored-by: Jeff Bowen <jblz@users.noreply.github.com>
Co-authored-by: mikeyarce <mikeyarce@gmail.com>
Co-authored-by: Gary Jones <gary.jones@automattic.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Gary Jones <gary@gamajo.com>

* Increase minimum PHP and WP versions

See #390.

* CI: Specify coverage: none where it is not needed

See #418.

* Declare strict_types=1

On it's own this doesn't do much, but when more type definitions are added, particularly scalar types, then PHP will handle the types without juggling them.

For choice of positioning below the file-level DocBlock, see https://www.php-fig.org/psr/psr-12/.
For lack of spaces inside the parentheses and around the `=`, see https://make.wordpress.org/core/2020/03/20/updating-the-coding-standards-for-modern-php/

See #389.

* Fix PHP 8+ TypeError for getting current URL

> TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, bool given

This originates when no `$post_id` is passed to the `get_current_url()` method, and no Post ID can be determined from the global `$post`.

As `get_permalink()` can return `false`, then casting it to a string means it will have a value of an empty string.

* Docs: Add contributor note about strong typing

* Remove post_has_viewable_type (#417)

* Using PHP 7 null coalescing operator (#421)

* Using PHP 7 null coalescing operator

* Fixing linter

* Revert "Add admin warning for minimum requirements in 3.0 (#408)" (#424)

* Revert "Add admin warning for minimum requirements in 3.0 (#408)"

This reverts commit 79742d5b39470fb9dd4267eacdf34b41fb2ff8b9.

* Fix identation

* Add return type declarations (#429)

* Add return types for Parsely class

* Add return types to test methods

* Add return types to remaining files

* Nested dirname calls can be replaced

Second argument supported since PHP 7.0.

* Declare visibility for class-level constants

Makes them all explicitly `public`, but some of these could be made less visible.

See #428.

* Convert documented param type to short form

* Fix discrepancy of class name and its use

* Replace full qualified name with an import

* Inline one-time use variables

* Add return type declarations

* Remove incorrect return type declaration

* Fix typos and unnecessary abbreviations

* Remove unnecessary regular expression escaping

* Regexp: Use character class

More performant than single character alternation.

* Use const syntax instead of define()

* Fix CS alignments

* Tests: Stop using deprecated setMethods method (#427)

* Tests: Stop using deprecated setMethods method

Use `onlyMethods()` instead, which ensures that the method that is being mocked does exist in the class being mocked.

* Tests: use onlyMethods() only if it exists

* Displaying Open on Parse.ly links by default (#433)

* Displaying Open on Parse.ly links by default

* Empty

* Remove deprecated filter after_set_parsely_page (#436)

* Remove deprecated filter after_set_parsely_page

* Updating tests

* Remove deprecated filter parsely_filter_insert_javascript (#437)

* Remove deprecated filter parsely_filter_insert_javascript

* Removing deprecated test

* Fixing some code smells (#435)

* Fixing code smells

* Removing duplicate

* Fix linting issues

* Adding E2E test to check for available recommended widget (#434)

* Adding E2E test to check for available recommended widget

* Adding utils

* Documenting utils and separating logical behavior

* Adding missing await

* Extracting more logic into constants

* Fix not working readme code sample (#439)

* Update defaults in `get_bottom_level_term` to empty array to prevent warnings downstream (#438)

* Update class-parsely.php

Change default from null to empty array to prevent warnings thrown by array_diff on line 1650

* Update src/class-parsely.php

Co-authored-by: Pau Argelaguet <pauarge@users.noreply.github.com>

Co-authored-by: Pau Argelaguet <pauarge@users.noreply.github.com>

* Removing old init script (#441)

* Add wp_parsely_should_insert_metadata filter (#440)

* Add wp_parsely_should_insert_metadata filter

* Revert return change

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Adding uninstall script (#444)

* Adding uninstall script

* Addressing linting issues

* Bump @wordpress/e2e-test-utils from 5.4.3 to 5.4.4 (#449)

Bumps [@wordpress/e2e-test-utils](https://github.com/WordPress/gutenberg/tree/HEAD/packages/e2e-test-utils) from 5.4.3 to 5.4.4.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/e2e-test-utils/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/e2e-test-utils@5.4.4/packages/e2e-test-utils)

---
updated-dependencies:
- dependency-name: "@wordpress/e2e-test-utils"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @wordpress/scripts from 18.0.1 to 18.1.0 (#450)

Bumps [@wordpress/scripts](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts) from 18.0.1 to 18.1.0.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/scripts/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/scripts@18.1.0/packages/scripts)

---
updated-dependencies:
- dependency-name: "@wordpress/scripts"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Constant return type on insert_parsely_page (#443)

* Constant return type on insert_parsely_page

* Adding deprecation warning for method

* Fix linting issues

* Fixing backwards compat return

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Fixing return types of update_metadata_endpoint (#446)

* Fixing return types of update_metadata_endpoint

* Fix identation

* Change get_current_url default type to non-post (#447)

* Change to non-post default

* Fix linting issues

* Adding docstring to document parameter change

* Create codeql-analysis.yml (#453)

See https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning

* Add namespaces to files (#430)

Co-authored-by: Pau Argelaguet <pauarge@users.noreply.github.com>

* Bring develop up to date with 2.6.1 (#454)

* Release 2.6.0 (#414)

* Hide the recommendation widget until the element is populated

* Update hidden classname per feedback

* Add conditional for cpt archives

Change to get queried object instead of category.

* Change conditional to is_archive

`is_archive()` is better in this case because it also targets taxonomy archives as well as custom post type archives.

* Add unit tests for CPT archive metadata

* Add unit test for CPT term archive

* Beautify code

* Remove custom post type to simplify test

It doesn’t change the functionality to have a custom post type or not, so to simplify we’ll remove that from the test.

* Change cpt-tax-archive to cpt-archive

* Fix code comments

* Clarify the name of the custom taxonomy

* Update check for cpt and taxonomy archives

* Change test name

* functioning e2e framework

* hello world test

* package-lock (+@wordpress/e2e-test-utils)

* hook tests into CI

* limit to a single job

* Update npm to latest

* cache npm in setup-node

* switch to lts syntax for node-version

* some progress using docker compose

* more progress -- it's working!

* docker-compose vs docker compose

* trying to wait for wp

* working loop i hope

* bg docker-compose correctly

* tweak name & rm unused var

* rm the strategy and just code in node lts

* try npm ci

* README for e2e tests

* fixup watch runner name

* add option to reset wp db to init script

* update readme

* update e2e readme

* incraese timeout so tests pass in interactive mode

* Update tests/e2e/README.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* fixup watch script ws

* add details to the 'Run the tests' section

* Add step to node test to confirm the build is up-to-date

* demonstrate failure case when untracked file is present

* demonstrate failure case when change to src is not present in build

* remove failure -- this should pass

* Bump prettier from 2.3.2 to 2.4.1

Bumps [prettier](https://github.com/prettier/prettier) from 2.3.2 to 2.4.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.3.2...2.4.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Renaming alpha

* Bump @wordpress/scripts from 17.1.0 to 18.0.1

Bumps [@wordpress/scripts](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts) from 17.1.0 to 18.0.1.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/scripts/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/scripts@18.0.1/packages/scripts)

---
updated-dependencies:
- dependency-name: "@wordpress/scripts"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Simplifying get_options function

* Tests: Improve the get_current_url data provider

Data providers actually provide an iterator rather than just an array, so we can build up the data using `yield` instead.

As per https://peakd.com/hive-168588/@crell/fun-with-phpunit-data-providers this has several advantages:

1. It's easier to read, making it better for future you to understand the code.
1. It's less indented, which gives you more room for longer lines for each value.
1. Because each test set is syntactically independent, it's easier to add new ones, reorder them, or temporarily comment out a single test set.
1. If a given test set needs more setup than just a static list, it's simple to put that setup before the `yield` statement for which it is relevant.

As per the follow-up article https://peakd.com/hive-168588/@crell/advanced-phpunit-shenanigans, I've also included a `@testdox` line on the test method. When this contains the method parameters, it completely overrides the sentence when the `--testdox` flag is called when running PHPUnit.

* Tests: Rename final *-test.php file to *Test.php

PSR-4 naming is needed for PHPUnit 9.1 support.

Fixes #379.

* Update tests/e2e/README.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update tests/e2e/README.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update tests/e2e/README.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Updating package-lock

* Removing ampersand

* Revert "Removing ampersand"

This reverts commit 228c2b72b6748c17c8f5d4fbed296bc159a768d7.

* Remove jQuery from recommended widget

* Using built code

* Forcing reset of e2e

* Change trigger

* Revert "Change trigger"

This reverts commit f61c2a3c36b6634706d0ab70d90db97d3489c8fd.

* Fix flaky test

* Updating package-lock

* Rollback tests changes

* Changing red color in admin to match wp-admin

* Remove unused default logo variable

* Using npm caching on GitHub Actions

* Integrations: Extract into separate classes

- Move AMP and Facebook Instant Article integrations into separate files.
- Improve and add tests that better check for the intended behaviour.

* Clarifying success message

* Updating built files

* Fixing syntax error

* Remove unused return_personalized_json function

* Hide admin warning on network admin

* Fix typo

* Integrations: Extract into separate classes

- Move AMP and Facebook Instant Article integrations into separate files.
- Improve and add tests that better check for the intended behaviour.

* Adding unit tests

* Fix linting issues

* Simplifying set_options on test

* Separating function for testing

* Update @covers annotation

* Simplifying logic

* Fix rendering errors with multiple widgets

* Fixing linting issues

* Fixing issue with sanitization

* Cleaning up logic

* Updating tests to be more reliable

* Separating subtests

* Tests: Improve get current URL tests

The focus of these tests is on the parsing issues related to the domain, port, and potential path, and this is represented in the data provider.

However, it's good to be able to confirm that going to the homepage, random URL and a post via it's ID, also work well for each of the combinations in the first parts of the URL.

* Adding 3.0 upgrade notice on README

* Encoding boolean values

* Fix linting issues

* Fix linting issues

* Small typo

* Fix linting issues

* Fix linting issues

* Split out plugin actions links logic

Moves the logic that adds the plugin action link to its own class.

Adds integration tests.

See #96.

* Tests: e2e for verifying the plugin action link

See #401.

* API Key: Add utility method for checking it is set

Also add utility method for checking if it is missing.

Includes unit tests.

Closes #395.

* API key: add utility method to retrieve key

Adds unit test.

* Testcase: Allow getMethod() to use different class

The existing method made the assumption that only non-public methods in the `Parsely` class would need to be made available for testing with Reflection.

This updates the method to allow methods in other classes to be reflected as well.

* Apply suggestions from code review

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Apply suggestions from code review

Clarify variable name.

Co-authored-by: Pau Argelaguet <pauarge@users.noreply.github.com>

* Adapting code to new project layout

* Using utility function to check for API keys

* Apply suggestions from code review

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Add admin warning for minimum requirements in 3.0 (#408)

* Adding admin upgrade warning

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Feature/improve test environment (#411)

* Tests: make future-compatible

- Use the snake_case fixture names
- Use wp-test-utils 1.0.0, and remove explicit PHPUnit constraints
- Refresh phpunit config file, including switching to TestDox output format

* CI: Use WP trunk with new test improvements

* CI: No need for pcov-clobber with PHPUnit 8.5

Also, don't ignore platform requirements for PHP 8, as we no longer need to force install PHPUnit 7.5 onto it.

* Bootstrap: Remove PHP_Token references

* Add coverage report back in

Not used yet, but without it, seems like no coverage check is actually done.

* CI: Add support for PHP 8.1 (allowed failures)

Also ensure `convertDeprecationsToExceptions` is true to better highlight PHP 8.1 native deprecation notices.

* Tests: split into unit and integration tests

See #179.

* Bootstrap: Move global code into a function

With all global code (other than some class file requires) in a function that is hooked in when WordPress runs, we can remove the `die`, which allows this file, with the defined constants and functions, to be included for unit tests.

* CI: Support running unit tests

* CI: Run unit tests on PHP 8 as well

* Tests: Define constants from plugin root file

* Tests: Fix CS

* Tests: Fix namespace

* Replace constants

* Various fixes

- Improve handling of no options being set.
- Fix CS
- Fix coverage annotations
- Fix wrong TestCase reference.

* Composer: Improve coverage scripts

Now with verbosity, which is useful in PHPUnit 9.5 to see why a test is classed as risky.

* CI: Add PHP 8.2

* CI: Fix indentation

* CI: Run coverage for integration tests

* CI: Always run coverage on multisite installs

* Re-fix Settings link on plugins page

* Tests: Re-add PluginActions test

Somehow got dropped from my branch when I rebased on to `develop`.

Co-authored-by: Pau Argelaguet <pauarge@users.noreply.github.com>

* Split out row action link logic (#406)

* Bumping version numbers

* Add changelog

* Update CHANGELOG.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Moving deprecated notes from changelog

Co-authored-by: Jeff Bowen <jblz@users.noreply.github.com>
Co-authored-by: mikeyarce <mikeyarce@gmail.com>
Co-authored-by: Gary Jones <gary.jones@automattic.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Gary Jones <gary@gamajo.com>

* Fix recommended widget not following configuration (#451)

* Fix recommended widget not following configuration

* Remove unwanted console log

* Release 2.6.1 (#452)

* Preparing for 2.6.1 release

* Update CHANGELOG.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Reverting test changes

* Reverting more changes

* Updating asset

Co-authored-by: Jeff Bowen <jblz@users.noreply.github.com>
Co-authored-by: mikeyarce <mikeyarce@gmail.com>
Co-authored-by: Gary Jones <gary.jones@automattic.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Gary Jones <gary@gamajo.com>

* Removing empty functions (#456)

* Enqueue scripts with theme independent hook (#458)

* Move Parse.ly settings to views folder (#459)

* Move Parse.ly settings to views folder

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Removing Parse.ly load text domain (#457)

* i18n: Fix JS string translation

* Adding argument types to functions (#455)

* Adding argument types to functions

* Making tests pass

* Fix linting issues

* Adding types to tests

* Fix type issues

* Addressing PR feedback

* Addressing tests

* Updating more tests

* Fixing final test

* Removing additional comment lines

* Revert OtherTest

* Revert "Revert OtherTest"

This reverts commit 5b8607a010c23e98a8e15676cf82a6724412dd9c.

* Reverting test changes and adding more defensive code on authors

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Adding translation support for Yes and No fields (#463)

* Adding translation support for Yes and No fields

* Fix linting issues

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Adding labels to admin settings form (#464)

* Adding labels to admin settings form

* Fixing identation

* Bump @wordpress/e2e-test-utils from 5.4.4 to 5.4.5 (#466)

Bumps [@wordpress/e2e-test-utils](https://github.com/WordPress/gutenberg/tree/HEAD/packages/e2e-test-utils) from 5.4.4 to 5.4.5.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/e2e-test-utils/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/e2e-test-utils@5.4.5/packages/e2e-test-utils)

---
updated-dependencies:
- dependency-name: "@wordpress/e2e-test-utils"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @wordpress/scripts from 18.1.0 to 19.0.0 (#465)

* Bump @wordpress/scripts from 18.1.0 to 19.0.0

Bumps [@wordpress/scripts](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts) from 18.1.0 to 19.0.0.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/scripts/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/scripts@19.0.0/packages/scripts)

---
updated-dependencies:
- dependency-name: "@wordpress/scripts"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Updating built files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pau Argelaguet <pauarge@users.noreply.github.com>
Co-authored-by: Pau Argelaguet <pau@outlook.com>

* Removing code coverage annotations (#469)

* Removing upgrade README notice (#470)

* Extract settings page from Parsely class (#467)

* Moving settings page out of class-parsely

* Move print dynamic tracking note

* Fixing hooks

* Fix automated linting issues

* Fix manual linting issues

* Updating hook to _admin_menu

* Fix type errors (#474)

* Fix type error get_api_url

* Fixing various type errors

* Fix linting issues

* Adding namespace to Recommended Widget (#475)

* Fix type error get_api_url

* Fixing various type errors

* Fix linting issues

* Adding missing namespaces

* Namespacing recommended widget

* Using proper namespace on tests

* Adding filter to display Cloudflare links (#473)

* Adding filter to display CloudFlare links

* Adding test for filter

* Updating failing test

* Fix multisite test

* Updating readme

* Update README.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update README.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update src/class-parsely.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Updating filter docs

* Removing redundant test assertions

* Changing name of the filter

* Update README.md

Co-authored-by: Gary Jones <gary.jones@automattic.com>

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Avoid making duplicate calls on Recommended Widget (#460)

* Avoid making duplicate calls on Recommended Widget

* Refactoring constructUrl

* Fixing parsing issues of updated values

* Adding e2e tests

* Adding type fixes

* Improving type fixes

* Revert optional post

* Extract admin warning from class-parsely (#468)

* Moving settings page out of class-parsely

* Move print dynamic tracking note

* Fixing hooks

* Fix automated linting issues

* Fix manual linting issues

* Extracting admin warning

* Updating hook to _admin_menu

* Moving admin warning tests

* Fix get method

* e2e tests: fix watch command (#476)

* e2e tests: fix watch command

Previously it would error as `test-e2e` command didn't exist.

* Update package.json

* Adding e2e interactive command

* Fix padding

Co-authored-by: Pau Argelaguet <pauarge@users.noreply.github.com>
Co-authored-by: Pau Argelaguet <pau@outlook.com>

* Adding namespace to root class (#477)

* Starting namespace add

* Adding namespace to root class

* Working on tests

* Working on UI tests

* Address StructuredData tests

* Explicit WP_User import

* Fix linting issues

* Using fully qualified names on docstrings in StructuredData tests

* Correcting more docstrings

* Fixing warnings on UI tests

* Fix get_options

* Removing warnings on AdminWarningTest

* Fix FBIA tests

* Fix Integrations Test

* Update tests/Integration/Integrations/AmpTest.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update tests/Integration/Integrations/AmpTest.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update tests/Integration/Integrations/AmpTest.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update tests/Integration/Integrations/AmpTest.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Update tests/Integration/Integrations/AmpTest.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Bump @wordpress/scripts from 19.0.0 to 19.1.0 (#480)

Bumps [@wordpress/scripts](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts) from 19.0.0 to 19.1.0.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/@wordpress/scripts@19.1.0/packages/scripts/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/scripts@19.1.0/packages/scripts)

---
updated-dependencies:
- dependency-name: "@wordpress/scripts"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @wordpress/e2e-test-utils from 5.4.5 to 5.4.6 (#479)

Bumps [@wordpress/e2e-test-utils](https://github.com/WordPress/gutenberg/tree/HEAD/packages/e2e-test-utils) from 5.4.5 to 5.4.6.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/@wordpress/e2e-test-utils@5.4.6/packages/e2e-test-utils/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/e2e-test-utils@5.4.6/packages/e2e-test-utils)

---
updated-dependencies:
- dependency-name: "@wordpress/e2e-test-utils"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pau Argelaguet <pauarge@users.noreply.github.com>

* Bump @wordpress/e2e-test-utils from 5.4.6 to 5.4.7 (#488)

Bumps [@wordpress/e2e-test-utils](https://github.com/WordPress/gutenberg/tree/HEAD/packages/e2e-test-utils) from 5.4.6 to 5.4.7.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/e2e-test-utils/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/e2e-test-utils@5.4.7/packages/e2e-test-utils)

---
updated-dependencies:
- dependency-name: "@wordpress/e2e-test-utils"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Use checkboxes for multiple selects in settings page (#482)

* Moving settings page out of class-parsely

* Move print dynamic tracking note

* Fixing hooks

* Fix automated linting issues

* Fix manual linting issues

* Updating hook to _admin_menu

* Working on settings select

* Formatting data correctly

* Rollback new line

* Reverting label change

* Fix automated linting issues

* Fix linting issues

* Simplifying select

* Removing references to multiple argument

* Displaying public taxonomies only

* Matching id and label of checkbox

* Move tracker logic to separate file (#478)

* Starting namespace add

* Adding namespace to root class

* Working on tests

* Working on UI tests

* Address StructuredData tests

* Explicit WP_User import

* Fix linting issues

* Using fully qualified names on docstrings in StructuredData tests

* Correcting more docstrings

* Fixing warnings on UI tests

* Fix get_options

* Removing warnings on AdminWarningTest

* Fix FBIA tests

* Fix Integrations Test

* Splitting out tracker code

* Adding tracker test

* Adding additional tests

* Keep moving tests

* Moving constant

* Adding WP_Scripts

* Renaming class to scripts

* Fixing scripts naming

* Fix path

* Making sure script enqueue is clean

* Fix linting issues

* Updating comment

* Updating more comments

* Bump @wordpress/eslint-plugin from 9.2.0 to 9.3.0 (#490)

Bumps [@wordpress/eslint-plugin](https://github.com/WordPress/gutenberg/tree/HEAD/packages/eslint-plugin) from 9.2.0 to 9.3.0.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/eslint-plugin@9.3.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@wordpress/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @wordpress/e2e-test-utils from 5.4.7 to 5.4.8 (#492)

Bumps [@wordpress/e2e-test-utils](https://github.com/WordPress/gutenberg/tree/HEAD/packages/e2e-test-utils) from 5.4.7 to 5.4.8.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/e2e-test-utils/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/e2e-test-utils@5.4.8/packages/e2e-test-utils)

---
updated-dependencies:
- dependency-name: "@wordpress/e2e-test-utils"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @wordpress/scripts from 19.1.0 to 19.2.1 (#491)

Bumps [@wordpress/scripts](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts) from 19.1.0 to 19.2.1.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/scripts/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/scripts@19.2.1/packages/scripts)

---
updated-dependencies:
- dependency-name: "@wordpress/scripts"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pau Argelaguet <pauarge@users.noreply.github.com>

* Renaming functions on Scripts class (#481)

* Starting namespace add

* Adding namespace to root class

* Working on tests

* Working on UI tests

* Address StructuredData tests

* Explicit WP_User import

* Fix linting issues

* Using fully qualified names on docstrings in StructuredData tests

* Correcting more docstrings

* Fixing warnings on UI tests

* Fix get_options

* Removing warnings on AdminWarningTest

* Fix FBIA tests

* Fix Integrations Test

* Splitting out tracker code

* Adding tracker test

* Adding additional tests

* Keep moving tests

* Moving constant

* Adding WP_Scripts

* Fixing small issues with scripts class

* Renaming class to scripts

* Fixing scripts naming

* Fix path

* Renaming functions on tests

* Adding a cannonical way of running the plugin locally (#493)

* Adding a local dev environment

* Adding link to VIP dev-env

* Fix tabs on package.json

* Making class members private (#486)

* Making class members private

* Fix FBIA tests

* Fix Recommended API tests

* Revert AMP changes

* Using reflection in tests

* Test with hardcoded constant

* Fix test

* Update tests/Integration/Integrations/FacebookInstantArticlesTest.php

Co-authored-by: Gary Jones <gary.jones@automattic.com>

Co-authored-by: Gary Jones <gary.jones@automattic.com>

* Adding changelog for 3.0.0 (#495)

* Adding Changelog for 3.0

* Finishing up changelog

* Remove unnecessary npm step in e2e (#494)

* Shorter timeout for tests

* Not updating npm each time

* Shorter timeout

* Reverting changes on tests

* Removing custom jest

* Optimizing tests

* Removing explicit timeouts

* Only running NodeJS checks with latest version (#499)

* Checking for updates in GitHub Actions (#498)

* Merging trunk to develop. (#505)

Co-authored-by: Volodymyr Kolesnykov <sjinks@users.noreply.github.com>

* Changelog: Add more detail for 3.0 release (#506)

* Changelog: Add more detail for 3.0 release

* Update CHANGELOG.md

Co-authored-by: Pau Argelaguet <pauarge@users.noreply.github.com>

Co-authored-by: mikeyarce <mikeyarce@gmail.com>
Co-authored-by: Jeff Bowen <jblz@users.noreply.github.com>
Co-authored-by: Gary Jones <gary.jones@automattic.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Gary Jones <gary@gamajo.com>
Co-authored-by: Michael Chan <michael.chan@automattic.com>
Co-authored-by: Volodymyr Kolesnykov <sjinks@users.noreply.github.com>
  • Loading branch information
8 people committed Nov 25, 2021
1 parent 50ccfef commit 5b1ee69
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 69 deletions.
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Expand Up @@ -11,3 +11,8 @@ updates:
directory: '/'
schedule:
interval: 'daily'

- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
11 changes: 1 addition & 10 deletions .github/workflows/e2e-tests.yml
@@ -1,14 +1,8 @@
name: End-to-end (e2e) Tests

on:
# Run on all pushes and on all pull requests.
# Prevent the "push" build from running when there are only irrelevant changes.
push:
paths-ignore:
- '**.md'
# Run on all pull requests.
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
test:
Expand All @@ -28,9 +22,6 @@ jobs:
node-version: lts/*
cache: 'npm'

- name: Update npm to latest
run: npm i -g npm

- name: Installing dependencies
run: npm ci

Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/node.js.yml
@@ -1,30 +1,23 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# This workflow will do a clean install of node dependencies, build the source code and run tests.
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
pull_request:
paths:
- .github/workflows/*.js.yml
- '**/*[tj]sx?'
- package*.json
push:
paths:
- .github/workflows/*.js.yml
- '**/*[tj]sx?'
- package*.json
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [16.x]

steps:
- uses: actions/checkout@v2
Expand Down
72 changes: 45 additions & 27 deletions CHANGELOG.md
Expand Up @@ -5,25 +5,29 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.0.0] - 2021-11-23
## [3.0.0] - 2021-11-26

## Important information about this release

wp-parsely 3.0.0 is a major release of the Parse.ly WordPress plugin. The major version bump is because we are introducing a number of breaking changes that have allowed us to modernize the codebase and make future features easier to implement.

The biggest breaking change is the new minimum requirements for running the plugin. You now need PHP 7.1 or newer and WordPress 5.0 or newer. If you are running one of those old versions, you shouldn't get the update option on your WordPress admin.

If you are using the plugin without any code-level customizations (for instance, calling the plugin's routines or hooking in the plugin's WordPress hooks), this update should be seamless and everything should keep operating normally. The plugin's way of working is still fundamentally the same. If you are using those customizations, we recommend you going through the detailed changelog to see if they affect you. In most of the cases, only trivial changes will be required to make your code work.
If you are using the plugin without any code-level customizations (for instance, calling the plugin's functions or methods or hooking in the plugin's WordPress hooks), this update should be seamless and everything should keep operating normally. The plugin's way of working is still fundamentally the same. If you are using those customizations, we recommend you going through the detailed changelog to see if they affect you. In most of the cases, only trivial changes will be required to make your code work.

### Added

- Namespaces to files. [#430](https://github.com/Parsely/wp-parsely/pull/430) [#475](https://github.com/Parsely/wp-parsely/pull/475) [#477](https://github.com/Parsely/wp-parsely/pull/477) Now all functions and classes are under the `Parsely` namespace. If plugin's function is being called without the namespace, that might need to be updated.
- Strict typing (`strict_types=1`) to all files in the codebase [#420](https://github.com/Parsely/wp-parsely/pull/420). Passing a value to a function in wp-parsely with an incorrect type will now raise an error. All function return [#429](https://github.com/Parsely/wp-parsely/pull/429) and argument [#455](https://github.com/Parsely/wp-parsely/pull/455) types have been updated.
- Checkboxes in fields that accept multiple selection on the settings page. [#482](https://github.com/Parsely/wp-parsely/pull/482)
- Translation support for Yes and No fields in the settings page. [#463](https://github.com/Parsely/wp-parsely/pull/463)
- `wp_parsely_should_insert_metadata` filter. [#440](https://github.com/Parsely/wp-parsely/pull/440) The filters controls whether the Parse.ly metadata should be inserted in the page's HTML. By default, the meta tags are rendered (the filter returns `true`).
- `wp_parsely_enable_cfasync_tag` filter. [#473](https://github.com/Parsely/wp-parsely/pull/473). Cloudflare `cfasync` attributes are now not rendered by default, they can be enabled by returning `true` to this filter.
- WordPress plugin uninstall script. [#444](https://github.com/Parsely/wp-parsely/pull/444) When the plugin is uninstalled, the options will be removed from the database.
- Namespaces to files. [#430](https://github.com/Parsely/wp-parsely/pull/430) [#475](https://github.com/Parsely/wp-parsely/pull/475) [#477](https://github.com/Parsely/wp-parsely/pull/477)
- Now all functions and classes are under the `Parsely` namespace, or a child namespace of that e.g. `Parsely\Parsely` or `Parsely\UI\Recommended_Widget`. If your code is calling a wp-parsely function (directly, or as a hook callback) without the namespace, then you'll need to update that call.
- Strict typing (`strict_types=1`) to all files in the codebase [#420](https://github.com/Parsely/wp-parsely/pull/420).
- Passing a value to a function in wp-parsely with an incorrect type will now raise an error.
- Type declarations have been added to function returns [#429](https://github.com/Parsely/wp-parsely/pull/429) and arguments [#455](https://github.com/Parsely/wp-parsely/pull/455).
- `wp_parsely_should_insert_metadata` filter. [#440](https://github.com/Parsely/wp-parsely/pull/440)
- The filter controls whether the Parse.ly metadata should be inserted in the page's HTML. By default, the meta tags are rendered (the filter returns `true`).
- `wp_parsely_enable_cfasync_tag` filter. [#473](https://github.com/Parsely/wp-parsely/pull/473).
- The Cloudflare `cfasync` attributes are now not rendered by default, but they can be enabled by returning `true` to this filter.
- WordPress plugin uninstall script. [#444](https://github.com/Parsely/wp-parsely/pull/444)
- When the plugin is uninstalled, the options will be removed from the database. Deactivating the plugin will not cause the options to be deleted.
- `npm run dev:start` and `npm run dev:stop` commands to run the plugin locally for development purposes. [#493](https://github.com/Parsely/wp-parsely/pull/493)
- E2E test for recommended widget. [#434](https://github.com/Parsely/wp-parsely/pull/434)
- JavaScript code-scanning [#453](https://github.com/Parsely/wp-parsely/pull/453)
Expand All @@ -32,47 +36,61 @@ If you are using the plugin without any code-level customizations (for instance,

- Minimum PHP and WP versions required to run the plugin are now 7.1 (from 5.6) and 5.0 from (4.0), respectively. [#416](https://github.com/Parsely/wp-parsely/pull/416)
- The development Node JS version has been bumped from 14 to 16.
- Renaming functions on `Scripts` class [#481](https://github.com/Parsely/wp-parsely/pull/481):
- `register_js` to `register_scripts`.
- `load_js_api` to `enqueue_js_api`.
- `load_js_tracker` to `enqueue_js_tracker`.
- _Open on Parse.ly_ links are displayed by default. [#433](https://github.com/Parsely/wp-parsely/pull/433) To disable the feature, the `wp_parsely_enable_row_action_links` filter must return `false`.
- `Parsely::get_current_url` default value for argument `string $parsely_type` changed from `nonpost` to `non-post`. [#447](https://github.com/Parsely/wp-parsely/pull/447) This change has been done to better align with Parse.ly's backend.
- Enqueue scripts with theme independent hook. [#458](https://github.com/Parsely/wp-parsely/pull/458) The JS scripts are now enqueued with `wp_enqueue_scripts` instead of `wp_footer`.
- Renamed `Parsely_Recommended_Widget` class to `Recommended_Widget`.
- Extracted logic from `class-parsely.php` file:
- Extract logic from `class-parsely.php` file:
- Extract admin warning to `Parsely\UI\Admin_Warning`. [#468](https://github.com/Parsely/wp-parsely/pull/468)
- Extract tracker logic to `Parsely\Scripts` [#478](https://github.com/Parsely/wp-parsely/pull/478)
- Extract settings page to `Parsely\UI\Settings_Page`. [#467](https://github.com/Parsely/wp-parsely/pull/467)
- Rename `Parsely_Recommended_Widget` class to `Parsely\UI\Recommended_Widget`.
- Rename methods in `Parsely\Scripts` class [#481](https://github.com/Parsely/wp-parsely/pull/481):
- `register_js()` to `register_scripts()`.
- `load_js_api()` to `enqueue_js_api()`.
- `load_js_tracker()` to `enqueue_js_tracker()`.
- Move Parse.ly settings file to `views/parsely-settings.php`. [#459](https://github.com/Parsely/wp-parsely/pull/459)
- Making class members private [#486](https://github.com/Parsely/wp-parsely/pull/486):
- `Facebook_Instant_Articles`: `REGISTRY_IDENTIFIER`, `REGISTRY_DISPLAY_NAME`, `get_embed_code`.
- `Recommended_Widget`: `get_api_url`.
- _Open on Parse.ly_ links are displayed by default. [#433](https://github.com/Parsely/wp-parsely/pull/433)
- To disable the feature, the `wp_parsely_enable_row_action_links` filter must return `false`.
- `Parsely::get_current_url()` default value for argument `string $parsely_type` changed from `nonpost` to `non-post`. [#447](https://github.com/Parsely/wp-parsely/pull/447)
- This change has been done to better align with Parse.ly's backend.
- Enqueue scripts with theme independent hook. [#458](https://github.com/Parsely/wp-parsely/pull/458)
- The JavaScript scripts are now enqueued at the `wp_enqueue_scripts` hook instead of `wp_footer`.
- Replace multi-select fields with checkboxes on the settings page. [#482](https://github.com/Parsely/wp-parsely/pull/482)
- Existing selections will be retained.
- Made class members private [#486](https://github.com/Parsely/wp-parsely/pull/486):
- `Parsely\Integrations\Facebook_Instant_Articles`: `REGISTRY_IDENTIFIER`, `REGISTRY_DISPLAY_NAME`, `get_embed_code()`.
- `Parsely\UI\Recommended_Widget`: `get_api_url()`.
- Tests: Specify `coverage: none` where it is not needed. [#419](https://github.com/Parsely/wp-parsely/pull/419)
- Bump @wordpress/e2e-test-utils from 5.4.3 to 5.4.8. [#492](https://github.com/Parsely/wp-parsely/pull/492)
- Bump @wordpress/scripts from 18.0.1 to 19.1.0. [#480](https://github.com/Parsely/wp-parsely/pull/480)
- Bump @wordpress/eslint-plugin from 9.2.0 to 9.3.0. [#490](https://github.com/Parsely/wp-parsely/pull/490)

### Fixed

- Fix missing translation support for Yes and No labels in the settings page. [#463](https://github.com/Parsely/wp-parsely/pull/463)
- Avoid making duplicate calls to Parse.ly API on the Recommended Widget's front-end. [#460](https://github.com/Parsely/wp-parsely/pull/460)
- Fix JS string translation in settings page. [#462](https://github.com/Parsely/wp-parsely/pull/462)
- Constant return types on `update_metadata_endpoint`. [#446](https://github.com/Parsely/wp-parsely/pull/446) The function used to return different return types, now it always returns `void`.
- Constant return type on `insert_parsely_page`. [#443](https://github.com/Parsely/wp-parsely/pull/443) The function used to return `string|null|array`, now it returns `void`.
- Tests: Stop using deprecated setMethods method. [#427](https://github.com/Parsely/wp-parsely/pull/427)
- Consistent return types on `update_metadata_endpoint`. [#446](https://github.com/Parsely/wp-parsely/pull/446)
- The function used to return different return types, now it always returns `void`.
- Consistent return type on `insert_parsely_page`. [#443](https://github.com/Parsely/wp-parsely/pull/443)
- The function used to return `string|null|array`, now it returns `void`.
- Tests: Stop using deprecated `setMethods()` method. [#427](https://github.com/Parsely/wp-parsely/pull/427)
- e2e tests: fix watch command. [#476](https://github.com/Parsely/wp-parsely/pull/476)
- Fix non-working README code example. [#439](https://github.com/Parsely/wp-parsely/pull/439)

### Removed

- Deprecated filter `after_set_parsely_page`. [#436](https://github.com/Parsely/wp-parsely/pull/436) Use `wp_parsely_metadata` instead.
- Deprecated filter `parsely_filter_insert_javascript`. [#437](https://github.com/Parsely/wp-parsely/pull/437) Use `wp_parsely_load_js_tracker` instead.
- `post_has_viewable_type` function. [#417](https://github.com/Parsely/wp-parsely/pull/417) Use `is_post_viewable` instead.
- Previously deprecated filter `after_set_parsely_page`. [#436](https://github.com/Parsely/wp-parsely/pull/436)
- Use `wp_parsely_metadata` instead.
- Previously deprecated filter `parsely_filter_insert_javascript`. [#437](https://github.com/Parsely/wp-parsely/pull/437)
- Use `wp_parsely_load_js_tracker` instead.
- `post_has_viewable_type` function. [#417](https://github.com/Parsely/wp-parsely/pull/417)
- Use `is_post_viewable` instead. The `post_has_viewable_type` function was only added to support older versions of WordPress.
- Custom Parse.ly load text domain. [#457](https://github.com/Parsely/wp-parsely/pull/457)
- Since the plugin now supports versions of WordPress that load custom text domains automatically, the plugins doesn't have to explicitly load the text domain itself.
- Empty functions for admin settings. [#456](https://github.com/Parsely/wp-parsely/pull/456)
- The callbacks were never utilised.
- Redundant code coverage annotations. [#469](https://github.com/Parsely/wp-parsely/pull/469)
- Old init Python script. [#441](https://github.com/Parsely/wp-parsely/pull/441)
- "Add admin warning for minimum requirements in 3.0" notice. [#424](https://github.com/Parsely/wp-parsely/pull/424)
- This was only added in the previous version of the plugin.
- Upgrade README notice. [#470](https://github.com/Parsely/wp-parsely/pull/470)

## [2.6.1] - 2021-10-15
Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# Parse.ly

Stable tag: 3.0.0
Stable tag: 3.0.0-beta
Requires at least: 5.0
Tested up to: 5.8
Requires PHP: 7.1
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/README.md
Expand Up @@ -10,7 +10,7 @@ Once there's a functioning back end, we leverage the `@wordpress/scripts` utilit

The tests use the [Jest framework](https://jestjs.io/) to drive a user flow and assert on expected outcomes. In addition to the [Puppeteer API](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md), there are a number of helpers to accomplish frequently performed tasks in the [`@wordpress/e2e-test-utils` package](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-e2e-test-utils/).

See this post for more infomation: https://make.wordpress.org/core/2019/06/27/introducing-the-wordpress-e2e-tests/
See this post for more information: https://make.wordpress.org/core/2019/06/27/introducing-the-wordpress-e2e-tests/

## How to Run

Expand Down
1 change: 0 additions & 1 deletion tests/e2e/specs/activation-flow.spec.js
Expand Up @@ -13,7 +13,6 @@ import {
import { activatePluginApiKey, deactivatePluginApiKey, waitForWpAdmin } from '../utils';

describe( 'Activation flow', () => {
jest.setTimeout( 30000 );
it( 'Should progress as intended', async () => {
await loginUser();
await activatePlugin( 'wp-parsely' );
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/specs/plugin-action-link.spec.js
Expand Up @@ -13,11 +13,10 @@ import {
import { waitForWpAdmin } from '../utils';

describe( 'Plugin action link', () => {
jest.setTimeout( 30000 );
it( 'Should link to plugin settings page', async () => {
await loginUser();
await activatePlugin( 'wp-parsely' );
await visitAdminPage( '/plugins.php' );
await visitAdminPage( '/plugins.php', '' );

await waitForWpAdmin();

Expand Down
12 changes: 3 additions & 9 deletions tests/e2e/specs/recommended-widget.spec.js
Expand Up @@ -11,9 +11,7 @@ import {
* Internal dependencies
*/
import {
activatePluginApiKey,
deactivatePluginApiKey,
deactivatePluginApiSecret,
changeKeysState,
waitForWpAdmin,
} from '../utils';

Expand Down Expand Up @@ -52,8 +50,6 @@ const checkForNonActiveWidgetText = async () => {
};

describe( 'Recommended widget', () => {
jest.setTimeout( 30000 );

beforeAll( () => {
page.once( 'dialog', async function( dialog ) {
await dialog.accept();
Expand All @@ -63,8 +59,7 @@ describe( 'Recommended widget', () => {
it( 'Widget should be available but inactive without api key and secret', async () => {
await loginUser();
await activatePlugin( 'wp-parsely' );
await deactivatePluginApiKey();
await deactivatePluginApiSecret();
await changeKeysState( false, false );

await visitAdminPage( '/widgets.php', '' );
await waitForWpAdmin();
Expand All @@ -79,8 +74,7 @@ describe( 'Recommended widget', () => {
it( 'Widget should be available but inactive without api secret', async () => {
await loginUser();
await activatePlugin( 'wp-parsely' );
await activatePluginApiKey();
await deactivatePluginApiSecret();
await changeKeysState( true, false );

await visitAdminPage( '/widgets.php', '' );
await waitForWpAdmin();
Expand Down
24 changes: 17 additions & 7 deletions tests/e2e/utils.js
Expand Up @@ -2,25 +2,35 @@ import { visitAdminPage } from '@wordpress/e2e-test-utils';

export const waitForWpAdmin = () => page.waitForSelector( 'body.wp-admin' );

export const deactivatePluginApiKey = async () => {
await waitForWpAdmin();
export const changeKeysState = async (activateApiKey, activateApiSecret ) => {
await visitAdminPage( '/options-general.php', '?page=parsely' );

await page.evaluate( () => document.getElementById( 'apikey' ).value = '' );
if ( activateApiKey ) {
await page.focus( '#apikey' );
await page.keyboard.type( 'e2etest.example.com' );
}

await page.evaluate( () => document.getElementById( 'api_secret' ).value = '' );
if ( activateApiSecret ) {
await page.focus( '#api_secret' );
await page.keyboad.type( 'somesecret' );
}

const [ input ] = await page.$x( '//p[contains(@class, \'submit\')]//input' );
await input.click();
await waitForWpAdmin();
};

export const deactivatePluginApiSecret = async () => {
await waitForWpAdmin();
export const deactivatePluginApiKey = async () => {
await visitAdminPage( '/options-general.php', '?page=parsely' );
await page.evaluate( () => document.getElementById( 'api_secret' ).value = '' );
await page.keyboard.press( 'Enter' );
await page.evaluate( () => document.getElementById( 'apikey' ).value = '' );
const [ input ] = await page.$x( '//p[contains(@class, \'submit\')]//input' );
await input.click();
await waitForWpAdmin();
};

export const activatePluginApiKey = async () => {
await waitForWpAdmin();
await visitAdminPage( '/options-general.php', '?page=parsely' );
await page.focus( '#apikey' );
await page.evaluate( () => document.getElementById( 'apikey' ).value = '' );
Expand Down
4 changes: 2 additions & 2 deletions wp-parsely.php
Expand Up @@ -11,7 +11,7 @@
* Plugin Name: Parse.ly
* Plugin URI: https://www.parse.ly/help/integration/wordpress
* Description: This plugin makes it a snap to add Parse.ly tracking code to your WordPress blog.
* Version: 3.0.0
* Version: 3.0.0-beta
* Author: Parse.ly
* Author URI: https://www.parse.ly
* Text Domain: wp-parsely
Expand Down Expand Up @@ -39,7 +39,7 @@
return;
}

const PARSELY_VERSION = '3.0.0';
const PARSELY_VERSION = '3.0.0-beta';
const PARSELY_FILE = __FILE__;

require __DIR__ . '/src/class-parsely.php';
Expand Down

0 comments on commit 5b1ee69

Please sign in to comment.