-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Refactoring theme helper #9316
Refactoring theme helper #9316
Conversation
Codecov Report
@@ Coverage Diff @@
## features #9316 +/- ##
==============================================
+ Coverage 37.66% 37.67% +0.01%
- Complexity 33824 33826 +2
==============================================
Files 1965 1966 +1
Lines 104533 104535 +2
==============================================
+ Hits 39368 39388 +20
+ Misses 65165 65147 -18
|
b8c3a13
to
5065249
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works like before.
Code looks good and understand new possibilities
Unit test included.
Then approve it 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on Mautibox and was able to install a new theme cloned from an existing one, and use it to create an email.
…t touching filesystem.
66485de
to
87d0562
Compare
Description:
The goal was to enable to set directory name in a separate parameter to the
copy()
method. As generating it from the theme name may not be always what we want. Also to provide greater test coverage to the TestHelper. However this task was not possible without refactoring.The ThemeHelper class was not fully testable as it was creating instances of
Filesystem
andFinder
classes instead of providing those helpers via dependency injection so those could be mocked.So I created 2 new services for those Symfony helpers and even created Mautic's own
Filesystem
helper by extending Symfony'sFilesystem
and adding thereadFile()
method to our implementation so we could use this one helper to manipulate files and folders. Symfony's version doesn't have that method for wrong reasons. Se need an abstraction above the native PHP methods that manipulate files so we could mock outputs in unit tests.As we now have our own
Filesystem
helper I have deprecated Symfony's helper.Steps to test this PR: