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

IBX-764: Added Kernel / Repository Test API #212

Merged
merged 4 commits into from
Aug 3, 2021
Merged

Conversation

Steveb-p
Copy link
Contributor

@Steveb-p Steveb-p commented Jul 6, 2021

Question Answer
JIRA issue IBX-764
Type improvement
Target eZ Platform version v3.3
BC breaks no
Doc needed yes/no - depending on whether we feel ok with exposing the test base right now No, only internal use

Adds IbexaTestKernel & IbexaKernelTestCase as base for other packages for wholesome integration tests.

The main selling point of those tests is that they also test our service declarations. They are also easy to expand upon by adding more bundles / services into the test Kernel, and makes use of built-in service compilation (which makes the tests faster).

Potentially, by using WebTestCase from Symfony, even routes can be tested.

Addition of MySQL and Postgres tests will be done in a following PR

Current integration tests remain unchanged and will be adjusted in following PRs.

Supports Postgres integration tests

Due to issues with MySQL / MariaDB images those tests can be enabled in a separate PR.

Security hotspots reported by Sonar

False-positives. They're related to md5 usage when creating a hash for temporary directory that stores compiled Kernel.

Other changes

To allow tests with different environments to produce different Kernels, whole environment is used to calculate cache hash. This allows for multiple tests to be run on a local machine, without issues coming from Kernel cache file re-use.

Checklist:

  • Provided PR description.
  • Tested the solution manually.
  • Provided automated test coverage.
  • Checked that target branch is set correctly (master for features, the oldest supported for bugs).
  • Ran PHP CS Fixer for new PHP code (use $ composer fix-cs).
  • Asked for a review (ping @ezsystems/php-dev-team).

@Steveb-p Steveb-p changed the base branch from master to 1.3 July 6, 2021 17:08
Copy link
Member

@alongosz alongosz left a comment

Choose a reason for hiding this comment

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

I need to see a consumption example by 1st party package.
The major issue however I have with this solution is a cyclic dependency on ezplatform-core. While it might not be visible atm, it always causes composer installation issues at some point.

tests/integration/BasicKernelTest.php Show resolved Hide resolved
tests/integration/BasicKernelTest.php Outdated Show resolved Hide resolved
tests/integration/BasicKernelTest.php Outdated Show resolved Hide resolved
src/contracts/Test/IbexaKernelTestCase.php Outdated Show resolved Hide resolved
src/contracts/Test/IbexaKernelTestCase.php Outdated Show resolved Hide resolved
src/contracts/Test/IbexaTestKernel.php Outdated Show resolved Hide resolved
src/contracts/Test/IbexaTestKernel.php Outdated Show resolved Hide resolved
src/contracts/Test/IbexaTestKernel.php Outdated Show resolved Hide resolved
src/contracts/Test/IbexaTestKernel.php Outdated Show resolved Hide resolved
src/contracts/Test/IbexaTestKernel.php Outdated Show resolved Hide resolved
@Steveb-p Steveb-p marked this pull request as ready for review July 13, 2021 09:51
@Steveb-p Steveb-p requested review from a team and alongosz July 13, 2021 09:51
Copy link
Member

@alongosz alongosz left a comment

Choose a reason for hiding this comment

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

In general this needs to be split into 2 or 3 parts:

  1. Namespaces should be introduced to ezpublish-kernel:7.5 since EOM is March 2022, so there's 100% chance that we will need it there anyway
  2. Fixer changes (maybe with what I mentioned in the diff comment that follows) need to be separated
  3. Repository Test API changes need to be separated (IBX-764)

2 & 3 can remain in this PR but as separate commits. In this case mark the PR as [FAST FORWARD MERGE] and add relevant label.

.php_cs Outdated Show resolved Hide resolved
composer.json Outdated Show resolved Hide resolved
@Steveb-p Steveb-p self-assigned this Jul 14, 2021
@Steveb-p Steveb-p changed the title Added basic kernel test files IBX-764: Added Kernel / Repository Test API Jul 14, 2021
@Steveb-p
Copy link
Contributor Author

Steveb-p commented Jul 15, 2021

@alongosz extracted PHP namespace changes to ezsystems/ezpublish-kernel#3111, since they should be merged up from ezplatform 2.5.

EDIT: Converting to draft to prevent accidental merge.

@Steveb-p Steveb-p marked this pull request as draft July 15, 2021 11:58
@Steveb-p Steveb-p marked this pull request as ready for review July 23, 2021 12:43
@Steveb-p Steveb-p requested a review from alongosz July 23, 2021 12:43
@Steveb-p Steveb-p added Doc needed The changes require some documentation Feature New feature or request Ready for review and removed Work in progress labels Jul 23, 2021
@Steveb-p Steveb-p requested review from adamwojs and a team July 27, 2021 14:39
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
phpunit.xml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
@alongosz alongosz requested a review from a team July 29, 2021 09:21
@Steveb-p Steveb-p force-pushed the kernel-test-case branch 2 times, most recently from 46cb172 to 76a4c7a Compare July 29, 2021 11:55
@Steveb-p Steveb-p changed the base branch from 1.3 to merge-up July 31, 2021 13:33
@Steveb-p Steveb-p deleted the branch 1.3 July 31, 2021 17:31
@Steveb-p Steveb-p closed this Jul 31, 2021
@Steveb-p Steveb-p reopened this Jul 31, 2021
@Steveb-p Steveb-p changed the base branch from merge-up to 1.3 July 31, 2021 17:32
@Steveb-p Steveb-p deleted the branch 1.3 August 2, 2021 11:46
@Steveb-p Steveb-p closed this Aug 2, 2021
@Steveb-p Steveb-p reopened this Aug 2, 2021
@Steveb-p Steveb-p removed the Doc needed The changes require some documentation label Aug 2, 2021
@sonarcloud
Copy link

sonarcloud bot commented Aug 2, 2021

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 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Steveb-p Steveb-p merged commit 578d3b0 into 1.3 Aug 3, 2021
@Steveb-p Steveb-p deleted the kernel-test-case branch August 3, 2021 08:16
@Steveb-p
Copy link
Contributor Author

Steveb-p commented Aug 3, 2021

Merged into master in 57c5099.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request Ready for review
3 participants