Get array structure of Dto to use with tests (json response) #632
Unanswered
giacomomasseron
asked this question in
Q&A
Replies: 1 comment
-
I don't think you should automatically grab the DTO structure to make your assert since adding or removing an attribute by error would go unnoticed in your tests. But if you still want this, you can build it using reflection: $ssalc = new \ReflectionClass(MyClass:class);
collect($ssalc->getConstructor()->getParameters())->pluck('name')->all(); You could probably make it recursive by using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
in tests I use assertJsonStructure to check if my response is correct.
I didn't find a function of this package to get only the structure of the DTO, that I would use in test.
Beta Was this translation helpful? Give feedback.
All reactions