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

Add the governance plugin #4907

Merged
merged 15 commits into from
Oct 2, 2023
Merged

Add the governance plugin #4907

merged 15 commits into from
Oct 2, 2023

Conversation

ingeniumed
Copy link
Contributor

@ingeniumed ingeniumed commented Sep 28, 2023

Description

This is meant to add the VIP governance plugin as an integration in mu-plugins, alongside the Block Data API. It's using the existing VIP integrations framework that's already in place for the Block Data API and Parsely to do this.

I have also added 2 test for the Block Data API and the VIP Governance plugin that simply tries to load them, and then verifies if they are inactive. It also calls their is_loaded function which checks if their constant is defined which should be false. Unlike the parsely plugin, their code isn't there so the code that can be tested is limited unfortunately.

The corresponding PR in mu-plugins-ext has been made here. That should be merged first.

Changelog Description

Plugin Added: VIP Governance 1.0

We added VIP Governance Plugin 1.0 for VIP customers.

This is a plugin that adds additional governance capabilities to the block editor.

Pre-review checklist

Please make sure the items below have been covered before requesting a review:

  • This change works and has been tested locally (or has an appropriate fallback).
  • This change works and has been tested on a Go sandbox.
  • This change has relevant unit tests (if applicable).
  • This change uses a rollout method to ease with deployment (if applicable - especially for large scale actions that require writes).
  • This change has relevant documentation additions / updates (if applicable).
  • I've created a changelog description that aligns with the provided examples.

Pre-deploy checklist

  • VIP staff: Ensure any alerts added/updated conform to internal standards (see internal documentation).

Steps to Test

Example:

  1. Check out PR, along with this PR as well.
  2. Use this as your mu-plugins in a local dev-env instance
  3. Activate using the following:
// client-mu-plugins/plugin-loader.php

\Automattic\VIP\Integrations\activate( 'vip-governance' );
  1. Go to wp-admin > Plugin and ensure VIP Governance shows up
  2. Go to wp-admin > VIP Governance and ensure that loads correctly
  3. Go to the a new post page and ensure everything loads fine.

@codecov
Copy link

codecov bot commented Sep 28, 2023

Codecov Report

Merging #4907 (f9cf630) into develop (8de9938) will increase coverage by 0.02%.
Report is 2 commits behind head on develop.
The diff coverage is 35.71%.

@@              Coverage Diff              @@
##             develop    #4907      +/-   ##
=============================================
+ Coverage      29.20%   29.23%   +0.02%     
- Complexity      4726     4730       +4     
=============================================
  Files            277      278       +1     
  Lines          20830    20844      +14     
=============================================
+ Hits            6083     6093      +10     
- Misses         14747    14751       +4     
Files Coverage Δ
vip-integrations.php 38.09% <0.00%> (-6.35%) ⬇️
integrations/vip-governance.php 45.45% <45.45%> (ø)

... and 3 files with indirect coverage changes

@ingeniumed ingeniumed marked this pull request as ready for review September 29, 2023 01:23
@ingeniumed ingeniumed requested a review from a team as a code owner September 29, 2023 01:23
@@ -14,16 +14,22 @@

defined( 'ABSPATH' ) || die();

// @codeCoverageIgnoreStart - the actual code here is tested individually in the unit tests.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ended up adding this here as this is where the registrations happen for the actual plugins. The underlying logic with the real plugins is better tested with the fake-integration that's in the unit tests. Instead, I added two tests for two of the integrations that didn't have unit tests and attempted to add what I could in there.

So for next time if an integration is added, what would be done is:

  • Add the integration here
  • Add the integration under integrations, and then add a test for it as well.

So that way as much of the new code is covered via the unit test.

Hope that makes sense, and makes it clear why I did this.

vip-integrations.php Outdated Show resolved Hide resolved
@ingeniumed ingeniumed requested a review from WPprodigy October 2, 2023 22:53
@ingeniumed ingeniumed merged commit 070e9e4 into develop Oct 2, 2023
41 checks passed
@ingeniumed ingeniumed deleted the add/governance-plugin branch October 2, 2023 23:58
$this->assertFalse( $vip_governance_integration->is_active() );
}

public function test__if_is_loaded_gives_back_true_when_loaded(): void {
Copy link
Member

Choose a reason for hiding this comment

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

It seems like the function name is not matching with assert statement.

rebeccahum added a commit that referenced this pull request Oct 4, 2023
* Add the governance plugin (#4907)

* Add the VIP Governance plugin to the integrations

* Update the config used for seeing if the governance plugin is loaded or not

* Add a test for the new vip-governance integration

* Leave only the single test that actually tests some functionality

* Add a test for the Block Data API as well

* Shift the import lines to be in the right order

* Add in a test to see if the isloaded method works correctly for both the integrations

* Add a code coverage ignore block to the registrations

* Remove the extra false loaded check

* Switch the isLoad check to not define any constant

* Initial rollout safeguard

* Search: Increase character search length to 510 characters (#4911)

* Search: Increase character search length to 510 characters

* Adjust test

Adjust test

* CANTINA-958: Add better filtering in `wp vip two-factor report` CLI command (#4910)

* CANTINA-958: Add better filtering in `wp vip two-factor report` CLI command

x

* Update wp-cli/vip-two-factor.php

Co-authored-by: Gary Jones <[email protected]>

* Update wp-cli/vip-two-factor.php

Co-authored-by: Gary Jones <[email protected]>

---------

Co-authored-by: Gary Jones <[email protected]>

* chore(deps): Bump preact in /search/search-dev-tools (#4913)

Bumps [preact](https://github.com/preactjs/preact) from 10.18.0 to 10.18.1.
- [Release notes](https://github.com/preactjs/preact/releases)
- [Commits](preactjs/preact@10.18.0...10.18.1)

---
updated-dependencies:
- dependency-name: preact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* chore(deps): Bump react-select from 5.7.5 to 5.7.7

Bumps [react-select](https://github.com/JedWatson/react-select) from 5.7.5 to 5.7.7.
- [Release notes](https://github.com/JedWatson/react-select/releases)
- [Changelog](https://github.com/JedWatson/react-select/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/JedWatson/react-select/compare/[email protected]@5.7.7)

---
updated-dependencies:
- dependency-name: react-select
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Gopal Krishnan <[email protected]>
Co-authored-by: Rebecca Hum <[email protected]>
Co-authored-by: Gary Jones <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
andrea-sdl pushed a commit that referenced this pull request Oct 19, 2023
* Add the VIP Governance plugin to the integrations

* Update the config used for seeing if the governance plugin is loaded or not

* Add a test for the new vip-governance integration

* Leave only the single test that actually tests some functionality

* Add a test for the Block Data API as well

* Shift the import lines to be in the right order

* Add in a test to see if the isloaded method works correctly for both the integrations

* Add a code coverage ignore block to the registrations

* Remove the extra false loaded check

* Switch the isLoad check to not define any constant

* Initial rollout safeguard
andrea-sdl pushed a commit that referenced this pull request Oct 19, 2023
* Add the governance plugin (#4907)

* Add the VIP Governance plugin to the integrations

* Update the config used for seeing if the governance plugin is loaded or not

* Add a test for the new vip-governance integration

* Leave only the single test that actually tests some functionality

* Add a test for the Block Data API as well

* Shift the import lines to be in the right order

* Add in a test to see if the isloaded method works correctly for both the integrations

* Add a code coverage ignore block to the registrations

* Remove the extra false loaded check

* Switch the isLoad check to not define any constant

* Initial rollout safeguard

* Search: Increase character search length to 510 characters (#4911)

* Search: Increase character search length to 510 characters

* Adjust test

Adjust test

* CANTINA-958: Add better filtering in `wp vip two-factor report` CLI command (#4910)

* CANTINA-958: Add better filtering in `wp vip two-factor report` CLI command

x

* Update wp-cli/vip-two-factor.php

Co-authored-by: Gary Jones <[email protected]>

* Update wp-cli/vip-two-factor.php

Co-authored-by: Gary Jones <[email protected]>

---------

Co-authored-by: Gary Jones <[email protected]>

* chore(deps): Bump preact in /search/search-dev-tools (#4913)

Bumps [preact](https://github.com/preactjs/preact) from 10.18.0 to 10.18.1.
- [Release notes](https://github.com/preactjs/preact/releases)
- [Commits](preactjs/preact@10.18.0...10.18.1)

---
updated-dependencies:
- dependency-name: preact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* chore(deps): Bump react-select from 5.7.5 to 5.7.7

Bumps [react-select](https://github.com/JedWatson/react-select) from 5.7.5 to 5.7.7.
- [Release notes](https://github.com/JedWatson/react-select/releases)
- [Changelog](https://github.com/JedWatson/react-select/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/JedWatson/react-select/compare/[email protected]@5.7.7)

---
updated-dependencies:
- dependency-name: react-select
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Gopal Krishnan <[email protected]>
Co-authored-by: Rebecca Hum <[email protected]>
Co-authored-by: Gary Jones <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants