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

[Theme] Allow overriding templates from plugins (^1.3) #10083

Merged
merged 2 commits into from
Jan 10, 2019

Conversation

Zales0123
Copy link
Member

@Zales0123 Zales0123 commented Jan 10, 2019

Q A
Branch? 1.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets fixes (kinda) #9654
License MIT

This is, of course, a quick fix and quite straight-forward, but it works 😄 And it is still required to use @SyliusTestPlugin notation (maybe it's worth to be documented somehow?). This PR fixes the functionality for Sylius ^1.3, for working fix on 1.2 take a look here: #10082.

Regarding testing it better (as I've also written in fix for 1.2):

It's hard to test this change with some functional test in a current tests structure, as it would require to use SyliusPluginTrait in test bundle/plugin, but it's in a core bundle :/ I have some idea have to test it properly with a Behat scenario, but I need to spend a few more minutes on that :)

@Zales0123 Zales0123 added the Potential Bug Potential bugs or bugfixes, that needs to be reproduced. label Jan 10, 2019
@Zales0123 Zales0123 requested a review from a team as a code owner January 10, 2019 07:59
@pamil pamil changed the title [Theme] Allow overriding templates from plugins [Theme] Allow overriding templates from plugins (^1.3) Jan 10, 2019
@Zales0123 Zales0123 force-pushed the fix-themes-templates-resolving branch from cf9364a to 60b0284 Compare January 10, 2019 12:26
Copy link
Member

@jacquesbh jacquesbh left a comment

Choose a reason for hiding this comment

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

LGTM

pamil added a commit that referenced this pull request Jan 10, 2019
…ales0123, pamil)

This PR was merged into the 1.2 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | 1.2
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | fixes #9654
| License         | MIT

It's hard to test this change with some functional test in a current tests structure, as it would require to use `SyliusPluginTrait` in test bundle/plugin, but it's in a core bundle :/ I have some idea have to test it properly with a Behat scenario, but I need to spend a few more minutes on that :)

It would be nice if someone could incorporate these changes into their application and see does it work as expected (cc @jacquesbh :)). I've of course done that, but _better safe than sorry_ 🐃 

This change only applies to `1.2` branch, for Sylius `^1.3` take a look here: #10083.

Commits
-------

2add023 Fix plugin templates resolving on 1.2
b4084c4 Replace regexp with plain string operation
@pamil pamil merged commit 10965b7 into Sylius:1.3 Jan 10, 2019
@pamil
Copy link
Contributor

pamil commented Jan 10, 2019

Thanks, Mateusz! 🥇

@Zales0123 Zales0123 deleted the fix-themes-templates-resolving branch January 10, 2019 13:22
pamil added a commit that referenced this pull request Jan 14, 2019
This PR was merged into the 1.2 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | 1.2
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | #10082, #10083
| License         | MIT

I can imagine this PR can be a little bit controversial 😄 but I hope it can be a nice step forward to make `ThemeBundle` more reliable.

As there is no easy way to test overriding plugin templates inside `ThemeBundle` itself (as it would require us to use trait from `CoreBundle`), I thought it would be nice to implement such a "test plugin" for Behat tests. It's maybe not the most elegant way, but it tests themes connected with plugins quite well and I don't see having a test plugin only for scenarios a bad thing, as we already have [test themes](https://github.com/Sylius/Sylius/tree/master/src/Sylius/Bundle/ThemeBundle/Tests/Fixtures/themes) or [test bundles](https://github.com/Sylius/Sylius/tree/master/src/Sylius/Bundle/ThemeBundle/Tests/Functional/TestBundle) in our test suite.

I was also thinking, that maybe such a test should be implemented on our https://github.com/Sylius/PluginSkeleton, but I really consider overriding plugins template as a `ThemeBundle` feature, rather than plugins... possibility 🚀 

Commits
-------

c612812 Plugin templates in theme tests
27dbb0d Test plugin with overriden by theme template
ba78f11 PR review fixes
pamil added a commit to pamil/Sylius that referenced this pull request May 7, 2019
…3) (Zales0123)

This PR was merged into the 1.3 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | 1.3
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | fixes (kinda) Sylius#9654
| License         | MIT

This is, of course, a quick fix and quite straight-forward, but it works 😄 And it is still required to use `@SyliusTestPlugin` notation (maybe it's worth to be documented somehow?). This PR fixes the functionality for Sylius `^1.3`, for working fix on `1.2` take a look here: Sylius#10082.

Regarding testing it better (as I've also written in fix for `1.2`):

> It's hard to test this change with some functional test in a current tests structure, as it would require to use `SyliusPluginTrait` in test bundle/plugin, but it's in a core bundle :/ I have some idea have to test it properly with a Behat scenario, but I need to spend a few more minutes on that :)

Commits
-------

a43d08b Allow overriding templates from plugins
60b0284 Replace regexp with plain string operation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Potential Bug Potential bugs or bugfixes, that needs to be reproduced.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants