我有下面的代码,我只需要测试我的控制器,它需要一个请求作为参数。但不断收到内核启动错误 - 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