Reputation: 141
I have some class that looks like following:
class MyClass{
public static function create($data){
//doing something here with $data
$dataModified = $this->doSomething($data);
$dataModifiedTwice = $this->doSomethingElse($dataModifie);
return $dataModifiedTwice;
}
//some other methods here
}
And I want to test the create($data) method.
I would like to know if this kind of method are tested, and if there is any sens in doing this (if the methods called inside are tested separately).
And if yes, what would be the approach to test this kind of method?
Upvotes: 0
Views: 34
Reputation: 694
Yes, you should. The aim is to confirm that with a given $data you are getting the same results. The benefit will come one day, when you decide to refactor the create method, the test will be used to confirm that the functionality hasn't changed.
Upvotes: 1