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

Implement RRM PHP module foundation #8785

Closed
9 tasks done
nfmohit opened this issue Jun 3, 2024 · 9 comments
Closed
9 tasks done

Implement RRM PHP module foundation #8785

nfmohit opened this issue Jun 3, 2024 · 9 comments
Labels
Module: RRM Reader Revenue Manager module related issues P0 High priority PHP Team M Issues for Squad 2 Type: Enhancement Improvement of an existing feature

Comments

@nfmohit
Copy link
Collaborator

nfmohit commented Jun 3, 2024

Feature Description

The PHP module foundation should be implemented for the Reader Revenue Manager module with a slug of reader-revenue-manager.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • A module class, Modules\Reader_Revenue_Manager should be added extending Core\Modules\Module.
  • The module slug should be reader-revenue-manager.
  • The module name should be "Reader Revenue Manager".
  • The module description should be "Reader Revenue Manager helps publishers grow, retain, and engage their audiences, creating new revenue opportunities".
  • The module homepage should be https://readerrevenue.withgoogle.com/.
  • The module class should require the https://www.googleapis.com/auth/subscribewithgoogle.publications.readonly scope.
  • The module class should be added to Core\Modules\Modules only if the rrmModule feature flag is enabled.

Implementation Brief

  • Create includes/Modules/Reader_Revenue_Manager.php:
    • The Google\Site_Kit\Modules\Reader_Revenue_Manager class will reside here.
    • The Class will extend Google\Site_Kit\Core\Modules\Module and implement Google\Site_Kit\Core\Modules\Module_With_Scopes interface.
    • Add the MODULE_SLUG const with the value from AC.
    • Add module information as described in AC inside setup_info function.
      • Set the order to 5 so it is placed between PageSpeed Insights and Tag Manager (alphabetical sorting, )
    • Add the scope defined in AC inside get_scopes function.
  • In includes/Core/Modules/Modules.php:
    • Add the new Reader_Revenue_Manager module to the core_modules when rrmModule is enabled. See here for example.

Test Coverage

  • Add test coverage for newly added module in a new Google\Site_Kit\Tests\Modules\Reader_Revenue_ManagerTest class.
    • Add test for get_scopes function.
    • Add a test_magic_methods to test basic module attributes. See similarly named tests for other modules for examples.
  • Add test coverage for the addition of the newly added module when rrmModule feature flag is enabled in Google\Site_Kit\Tests\Core\Modules\ModulesTest class.

QA Brief

  • Enable the rrmModule feature flag via the tester plugin.
  • Execute the following commands in the browser console to verify the module has been added:
    • googlesitekit.data.select('core/modules').getModules()
    • Ensure that the Reader Revenue Manager module is included in the list of modules.
    • googlesitekit.data.select('core/modules').getModule('reader-revenue-manager')
    • Verify that the Reader Revenue Manager module details (description, homepage, order) are correctly displayed.
  • Disable the rrmModule feature flag via the tester plugin.
  • Execute the above commands in the browser console.
  • Verify that the Reader Revenue Manager module is not included in the list of modules and that the module details are not displayed.

Changelog entry

  • Add foundation for new Reader Revenue Manager feature (PHP).
@nfmohit nfmohit self-assigned this Jun 3, 2024
@nfmohit nfmohit added Type: Enhancement Improvement of an existing feature PHP Module: RRM Reader Revenue Manager module related issues Team M Issues for Squad 2 labels Jun 3, 2024
@ivonac4 ivonac4 added the P0 High priority label Jun 5, 2024
@nfmohit nfmohit assigned nfmohit and unassigned nfmohit Jun 8, 2024
@ivonac4 ivonac4 added Next Up Issues to prioritize for definition Sp Wk 2 Issues to be completed in the second week of the assigned sprint Module: RRM Reader Revenue Manager module related issues and removed Module: RRM Reader Revenue Manager module related issues labels Jun 11, 2024
@kuasha420 kuasha420 self-assigned this Jun 11, 2024
@kuasha420
Copy link
Contributor

AC ✅

@kuasha420 kuasha420 assigned kuasha420 and unassigned kuasha420 Jun 11, 2024
@kuasha420
Copy link
Contributor

Hi @nfmohit, while working on this IB, I realized that we should move a few points around the ACs to make things a bit smother and self contained. Namely,

  1. We should Add a note about adding module settings for RRM here. In that way, we can flesh out is_connected. register and on_deactivation (using Module_With_Deactivation) here since these parts are fundamental as well.
  2. We should remove the Module_With_Service_Entity requirement from here and add it to the REST_Route issue in #8791 since that's where we are going to really going to use the service. Since the logic around determining property id from SC and everything else will have to be explored in the rest route issue anyways, this seems like a logical thing to do to not bloat this issue unnecessarily!
  3. By doing the above changes, we can keep this one self contained and remove #8783 blocker for this one (and add 8783 as additional blocker for 8791).

I'm sending this back to AC to you for another look over, let me know what you think, and if you agree, make the amendments in AC and send it back to me straight to IB again.

Sorry for not catching this earlier while doing ACR. Hope you don't mind. <3

@kuasha420 kuasha420 assigned nfmohit and unassigned kuasha420 Jun 13, 2024
@nfmohit
Copy link
Collaborator Author

nfmohit commented Jun 13, 2024

Thank you @kuasha420. As discussed internally, the first point will be handled by #8793, but the other points have been addressed. This is back with you in IB.

@nfmohit nfmohit assigned kuasha420 and unassigned nfmohit Jun 13, 2024
@ivonac4 ivonac4 removed the Sp Wk 2 Issues to be completed in the second week of the assigned sprint label Jun 13, 2024
@kuasha420 kuasha420 removed their assignment Jun 13, 2024
@nfmohit nfmohit self-assigned this Jun 13, 2024
@nfmohit
Copy link
Collaborator Author

nfmohit commented Jun 13, 2024

The IB looks nice, thanks @kuasha420 . Do you think a Tests\Modules\Reader_Revenue_ManagerTest test suite should be added as part of this issue as well that acts as a starting point for test coverage for this class? It can include basic tests like Tests\Modules\AdsTest::test_magic_methods() and possibly scope verifications. Let me know what you think, thanks!

Note: The estimate may change based on the update.

@nfmohit nfmohit assigned kuasha420 and unassigned nfmohit Jun 13, 2024
@nfmohit nfmohit mentioned this issue Jun 14, 2024
24 tasks
@kuasha420
Copy link
Contributor

Thank you @nfmohit. Sorry for forgetting about tests! I've added your suggestion, another point about checking the existence of RRM Module when the feature flag is active, and bumped up the estimate.

Cheers.

@kuasha420 kuasha420 assigned nfmohit and unassigned kuasha420 Jun 14, 2024
@nfmohit
Copy link
Collaborator Author

nfmohit commented Jun 15, 2024

Thanks @kuasha420 ! IB ✅

@nfmohit nfmohit removed their assignment Jun 15, 2024
@ivonac4 ivonac4 removed the Next Up Issues to prioritize for definition label Jun 17, 2024
@hussain-t hussain-t self-assigned this Jun 18, 2024
@hussain-t hussain-t removed their assignment Jun 19, 2024
@nfmohit nfmohit assigned nfmohit and hussain-t and unassigned nfmohit Jun 19, 2024
@hussain-t hussain-t assigned nfmohit and unassigned hussain-t Jun 21, 2024
@nfmohit nfmohit removed their assignment Jun 21, 2024
@kelvinballoo
Copy link
Collaborator

QA Update ⚠️

This is pretty much good to go. I only have one question at the end.

Tested the following as good:

  • Verified that the Reader Revenue Manager module details (description, homepage, order) are correctly displayed when the flag is on.

    • The module slug should be reader-revenue-manager.
    • The module name should be "Reader Revenue Manager".
    • The module description should be "Reader Revenue Manager helps publishers grow, retain, and engage their audiences, creating new revenue opportunities".
    • The module homepage should be https://readerrevenue.withgoogle.com/.
    Screenshot 2024-06-24 at 14 33 22
  • Verified that the Reader Revenue Manager module doesn't appear if rrmModule feature flag is disabled via the tester plugin.

    Screenshot 2024-06-24 at 14 42 35

Question:
All the QAB points are fine.
I only noticed the following point in the AC and I was wondering if there is a way to verify it.
The module class should require the https://www.googleapis.com/auth/subscribewithgoogle.publications.readonly scope.
If this cannot be verified from QA perspective and it's a technical detail that is already taken care of, then it's fine.

@hussain-t
Copy link
Collaborator

@kelvinballoo, the scopes cannot be tested with the changes made in this ticket. However, you can view the code and the PHP unit tests to verify the necessary scope.

Code Changes:

public function get_scopes() {
return array(
'https://www.googleapis.com/auth/subscribewithgoogle.publications.readonly',
);
}

PHP Unit Test:

public function test_get_scopes() {
$this->assertEqualSets(
array(
'https://www.googleapis.com/auth/subscribewithgoogle.publications.readonly',
),
$this->reader_revenue_manager->get_scopes()
);
}

@kelvinballoo
Copy link
Collaborator

QA Update ✅

Thanks for the clarification @hussain-t .

This is good to go.

  • Verified that the Reader Revenue Manager module details (description, homepage, order) are correctly displayed when the flag is on.

    • The module slug should be reader-revenue-manager.
    • The module name should be "Reader Revenue Manager".
    • The module description should be "Reader Revenue Manager helps publishers grow, retain, and engage their audiences, creating new revenue opportunities".
    • The module homepage should be https://readerrevenue.withgoogle.com/.
    Screenshot 2024-06-24 at 14 33 22
  • Verified that the Reader Revenue Manager module doesn't appear if rrmModule feature flag is disabled via the tester plugin.

    Screenshot 2024-06-24 at 14 42 35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Module: RRM Reader Revenue Manager module related issues P0 High priority PHP Team M Issues for Squad 2 Type: Enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

6 participants