2014-10-29 55 views
1

我試圖嘲弄以下行:嘲諷CONCAT功能

我怎麼能嘲笑這一行? 我知道,你可以嘲笑這樣的getRespository:

$entityManagerStub = $this->getMockBuilder('Doctrine\ORM\EntityManager')->disableOriginalConstructor()->getMock(); 
$entityManagerStub->method('getRepository')->with('Bundle:Core'); 

,但我怎麼也嘲笑getActive功能? 會是這樣的工作?

$entityManagerStub->method('getRepository')->method('getActive')->with('Example'); 

回答

0

POST,但新的解決方案

新庫中編輯處理模擬問題,使我的生活變得更輕鬆: https://github.com/danrevah/ShortifyPunit

$entityManagerStub = ShortifyPunit::mock('Doctrine\ORM\EntityManager'); 

ShortifyPunit::when($entityManagerStub)->getRepository('Bundle:Core')-> 
       getActive()->returns($mockingResponse);