0

I'm writing phpspec test for controller In action I am calling another method with this:

$this->getDoctrine()->getManager()->createQueryBuilder();

I cannot pass this in phpspec. What I'm getting is

method Double\ObjectManager\P7::createQueryBuilder() is not defined

Have you got any suggestion how to spec it?

greg606
  • 491
  • 3
  • 17

1 Answers1

4

If you can't spec something, it's a indicator you have a bad design. In your case you should never create query builders in your controllers. Controller should be only a clue between different services.

For doctrine queries create repositories!

Emii Khaos
  • 9,983
  • 3
  • 34
  • 57
  • you are indeed right, i just mindlessly uses bundle code sample, yes I will refactor this, thanks! – greg606 Sep 03 '15 at 10:23