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

fix/338: add Util function to fetch primary category #350

Merged
merged 5 commits into from
Nov 3, 2022
Merged

Conversation

Sidsector9
Copy link
Contributor

@Sidsector9 Sidsector9 commented Oct 30, 2022

Description of the Change

Adds a Util function get_primary_category.

This function returns the primary category name set through Yoast.
If Yoast is deactivated, then it returns the category set at index 0.

Closes #338

Verification Process

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Changelog Entry

Credits

Props @vjayaseelan90 @jeffpaul @Sidsector9

Copy link
Contributor

@cadic cadic left a comment

Choose a reason for hiding this comment

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

The code looks good. I have a concern about the 4th Unit test added.

$this->assertEquals( $term_name, 'Uncategorized' );
}

public function test_get_primary_category__custom_category__yoast_activated() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this last test is a full-copy of the previous one (except the category name) and does not test any alternative workflow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're correct!

@jeffpaul jeffpaul added this to the 1.4.0 milestone Oct 31, 2022
@Sidsector9 Sidsector9 requested a review from cadic October 31, 2022 20:02
@jeffpaul
Copy link
Contributor

jeffpaul commented Nov 1, 2022

Holding off on merge here as we're awaiting Sophi team approval on the pending 1.3.0 release and I'd prefer to not change any additional code. Once 1.3.0 is released, I'll merge this in so we can deploy/test and prepare as part of a 1.3.1/1.4.0 release.

@jeffpaul jeffpaul merged commit 1355ccd into develop Nov 3, 2022
@jeffpaul jeffpaul deleted the fix/338 branch November 3, 2022 19:01
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 3, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 36 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@jeffpaul jeffpaul modified the milestones: 1.4.0, 1.3.1 Nov 8, 2022
@dkotter dkotter mentioned this pull request Nov 10, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the mapping for section_names field to reflect primary category
3 participants