I am working o a large scale project and I have encountered a scenario where I need to implement some relatively complex logic for a query. This query is built with the framework's query builder and it sits in a repository class.
Part of the query looks something like this:
// $lookup is an object containing data that is used to build the query
$columnValue = $lookup->getValue();
if ($columnValue == 'Some value) {
// A few where() statements
} elseif (in_array($columnValue, [<multiple values>)) {
// other where() statements
} else {
if ($columnValue == 'Some other value) {
// 1 where statements
}
// some other where() statements
}
Since this is in a private method inside the repository it's not easily testable (unless I test agains the DB).
Should I move this somewhere else so I can unit test it, or rely on functional tests for this one?
Aucun commentaire:
Enregistrer un commentaire