Area of testing
- by ?????? ??????????
I'm trying to understand which part of my code I should to test. I have some code. Below is example of this code, just to understand the idea.
Depends of some parametrs I put one or another currency to "Event" and return his serialization in the controller. Which part of code I should to test? Just the final serialization, or only "Event" or every method: getJson, getRows, fillCurrency, setCurrency?
class Controller {
public function getJson()
{
$rows = $eventManager->getRows();
return new JsonResponse($rows);
}
}
class EventManager {
public function getRows()
{
//some code here
if ($parameter == true) {
$this->fillCurrency($event, $currency);
}
}
public function fillCurrency($event, $currency)
{
//some code here
if ($parameters == true) {
$event->setCurrency($currency);
}
}
}
class Event {
public function setCurrency($currency) {
$this->updatedAt = new Datetime();
$this->currency = $currency;
}
}