Area of testing

Posted by ?????? ?????????? on Programmers See other posts from Programmers or by ?????? ??????????
Published on 2013-10-23T07:07:47Z Indexed on 2013/10/23 10:15 UTC
Read the original article Hit count: 262

Filed under:
|
|

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;
    }
}

© Programmers or respective owner

Related posts about php

Related posts about testing