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

Unit tests for block env options #407

Merged
merged 2 commits into from
Feb 6, 2024
Merged

Unit tests for block env options #407

merged 2 commits into from
Feb 6, 2024

Conversation

hbugdoll
Copy link
Member

@hbugdoll hbugdoll commented Feb 5, 2024

What are you changing/introducing

  • Added new unit tests for block env options (except 'pageObject')

Block Test

  • Added new test BlockTest::testBlockEnvOptions()
    • Moved setting env options from BlockTest::testBlockValues() to this new test
  • Enhanced therefore TestBlock::admin()
    • Accessing and returning env options and unused config value
  • Improved BlockTest::testBlockValues()
    • Checking unused config value

Block Placeholder Iteration Test

  • Added new test BlockPlaceholderIterationTest::testEnvOptionsPlaceholderIteration()
    • 3 equal blocks on 1 page via fixtures
    • Checking env options in admin context via NavItemPage::getPlaceholder()
    • Checking env options in frontend context via NavItemPage::renderPlaceholder()
  • Added therefore new testing block TestingEnvOptionsBlock
    • Accessing env options in admin context inside renderAdmin()
    • Accessing env options in frontend context inside renderFrontend() (JSON decoding/encoding is needed because of internal processing & concat)
  • Completed access on all block models in BlockPlaceholderIterationTest::testRenderPlaceholderIteration() for sake of completeness

Bugfix

  • Fixed recently introduced 'equalIndex' iteration in admin context (pre-increment instead of post-increment)
  • Reduced lines of code in frontend context

What is the reason for changing/introducing

see issue #401 and PR #403

QA

Q A
Is bugfix? yes
New feature? no
Breaks BC? no
Tests pass? yes
Fixed issues

- Fixed recently introduced equalIndex iteration in admin context
- Reduced lines of code in frontend context
Copy link
Contributor

@nadar nadar left a comment

Choose a reason for hiding this comment

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

thanks for all the work, please check my review, everything else looks good!

src/models/NavItemPage.php Show resolved Hide resolved
@nadar
Copy link
Contributor

nadar commented Feb 6, 2024

thanks for the unit tests!

@nadar nadar merged commit 5d59cc6 into luyadev:master Feb 6, 2024
7 of 8 checks passed
@hbugdoll
Copy link
Member Author

hbugdoll commented Feb 6, 2024

Thanks for merging 👍

@hbugdoll hbugdoll deleted the unit-tests-env-options branch February 26, 2024 11:50
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.

2 participants