-
-
Notifications
You must be signed in to change notification settings - Fork 616
feature: Support transforming named column(s) in any table #1593
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
Conversation
tests/Fixtures/Transformations/features/bootstrap/UserAnnotationsContext.php
Outdated
Show resolved
Hide resolved
tests/Fixtures/Transformations/features/bootstrap/UserAttributesContext.php
Outdated
Show resolved
Hide resolved
tests/Fixtures/Transformations/features/by_type_and_by_name_object_transformation.feature
Show resolved
Hide resolved
tests/Fixtures/Transformations/features/simple_step_argument_transformation.feature
Show resolved
Hide resolved
0e9aaee to
6b23cde
Compare
|
Rebased this branch to include the new tests for the transformations with unicode characters and modified the new column transformer to also accept unicode characters |
acoulton
left a comment
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.
Another super-helpful feature, thanks @carlos-granados! Just a few suggestions / comments from me :)
tests/Fixtures/Transformations/features/bootstrap/UserAnnotationsContext.php
Outdated
Show resolved
Hide resolved
src/Behat/Behat/Transformation/Transformation/TableColumnTransformation.php
Show resolved
Hide resolved
tests/Fixtures/Transformations/features/bootstrap/TransformationAnnotationsContext.php
Outdated
Show resolved
Hide resolved
src/Behat/Behat/Transformation/Transformation/TableColumnTransformation.php
Outdated
Show resolved
Hide resolved
src/Behat/Behat/Transformation/Transformation/TableColumnTransformation.php
Show resolved
Hide resolved
src/Behat/Behat/Transformation/Transformation/TableColumnTransformation.php
Show resolved
Hide resolved
6b23cde to
69aae66
Compare
|
@acoulton I rebased this code and added two commits:
|
|
@carlos-granados I think maybe the commit with your followup to code review suggestions hasn't been pushed? As there are a few things you've 👍 but I don't see changed in the diff. Thanks :) |
Argh, yes forgot to push, done! |
135102b to
4d63e26
Compare
acoulton
left a comment
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.
Great work, thanks @carlos-granados :)
Adds a new type of transformer that is able to transform a column in any table. For example you might have this scenario:
And this transformer:
Then this transformer will be called to transform any data in the column named
userThe final result which is passed to the step that uses this transformer is an array of rows where the data for the column
userwill be the transformed user. So, for example the step could be implemented like this:This transformation can be applied to different tables as long as the column name matches.
The transformation can be applied to more than one column if you list more than one column name in the Transform definition, for example:
#[Transforrm('column:user,other user')]More than one transformation can be applied to different columns of a table, so in the example above if we had another transformation defined for the
agecolumn it would also be applied. The end result is again an array where in each row any column that matched any of the transformations has been replaced with its transformed valueBefore implementing this new feature I modified the existing tests for the transformations to adopt the new format where the tests are defined using real files in the fixtures folder. This has been done in a separate previous commit to make it easier to review
With this feature we can get the functionality described in #1229
Once this is merged, I will update the documentation for this transformer (and also other transformers like the row transformer which are not documented)