Added unit tests for the Metadata class #4
Added unit tests for the Metadata class #4
Conversation
@@ -41,6 +41,7 @@ public function __construct(Adapter $adapter) | |||
* | |||
* @param Adapter $adapter | |||
* @return Source\AbstractSource | |||
* @throws \Exception |
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.
Add description when this exception is thrown
…minor style fixes
@Maks3w I have update the pull request with your feedback from the code review, thanks! |
->disableOriginalConstructor() | ||
->getMock(); | ||
|
||
$adapterMock->expects($this->once()) |
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.
Could you extract all the thing about adapterMock
in a method called createAdapterMockWithPlatform($platform)
I think will improve test readiblity.
I start to think this class should be deprecated and only to have a factory class with a method for get the source from adapter |
I am not actually using the class. I just saw it had no coverage and I had some spare time so I decided to write tests for it. It does look like the only useful bit is the switch to get the source instance, as all the rest of the methods just proxy to the source. I will leave the pull request as is for now, until a decision is made |
All the thing about to test proxy methods reveal a bad design flow. |
@Maks3w that seems fair; however, i don't think it a bad idea to add the unit tests that have been add here. Actually it is very well likely a great idea for the time being. I would say we should merge the PR and then we can deprecate the other part in the future. |
I think I wrote a PoC with a more clean structure let me to dig on it |
This pull requests adds unit tests, with 100% coverage, for the Metadata class.