@
@
@Twitt2019-09-13 13:04:09
PHP
@Twitt, 2019-09-13 13:04:09

Does it make sense to test a method that simply hands off work to another method?

There is this in the code:

public function checkStatuses()
    {
        if (!empty($this->getCollectionByStatus('ball'))) {
            $this->provider->filterDataByName('ball');
        }

        return $this;
    }

A method that simply passes work to another class and its method to work. If I write a unit test for the checkStatuses method, how logical is it in principle, despite the fact that this is a method that delegates work to another?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2019-09-13
@inoise

If this is not a private method, then it is necessary. Why? Because tests are responsible not only for the fact that the code works as expected, but also that it has not changed its behavior

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question