我有下面的代碼,我只需要測試我的控制器,它需要一個請求作爲參數。但不斷收到內核啓動錯誤 - symfony netbeans
Warning: Deprecated JSON test listener used
和
PayrollperiodControllerTest::testPayrollWeekCreateAction Error: Call to undefined method PayrollperiodControllerTest::bootKernel()
class PayrollperiodControllerTest extends PHPUnit_Framework_TestCase {
/**
* @var \Doctrine\ORM\EntityManager
*/
private $em;
/**
* {@inheritDoc}
*/
public function setUp()
{
self::bootKernel();
$this->em = static::$kernel->getContainer()
->get('doctrine')
->getManager();
}
public function testPayrollWeekCreateAction(Request $request) {
$request = Request::create('http://localhost:8000/web/app_dev.php/payrollperiod/new', 'GET');
$result=$this->em->handle($request);
$this->assertTrue($result->isSuccessful);
}
/**
* {@inheritDoc}
*/
public function tearDown() {
parent::tearDown();
$this->em->close();
$this->em = null; //avoid memory Leaks
}
}
如何解決這些錯誤?
一個EntityManager無法處理請求(沒有方法句柄)可能是一個錯字? – Matteo
@Matteo什麼是方法句柄?我在控制器中使用了enitiy manager,我對此很感興趣,所以請指導。 – Zed