S
S
Sergey2013-03-12 11:32:24
symfony
Sergey, 2013-03-12 11:32:24

Test Driven Development in Symfony?

I'm just getting started with test-driven development. By developing individual services/libraries, I'm already getting profit, but I still don't know how to develop a WEB application through TDD. Perhaps you will find examples from life or just advice? Or does it make sense to cover only services/libraries with tests? As far as I remember, controller tests, which are application-level tests, already deviate somewhat from the TDD methodology and are often used only to make sure that making changes to code not covered by tests will not cause problems.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Leonovich, 2014-11-06
@atlantech

It is convenient to cover controllers with tests if you replace

public function indexAction() {
    //...
    return $this->render(
       'key' => $val
    );
}

on the
/**
*@Template()
*/
public function indexAction() {
    //...
    return [
       'key' => $val
    ];
}

That is, transfer the rendering of the template to the kernel.view event. Although the developers recommend not to use the annotation for the sake of performance

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question