2016-12-14 3 views
0

다음 코드가 있는데 컨트롤러 만 테스트하면 매개 변수로 요청됩니다. 그러나커널 부팅 오류 - 심포니 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 
    } 



} 

가 계속?

+0

요청을 처리 할 수없는 하나의 EntityManager (

class PayrollperiodControllerTest extends PHPUnit_Framework_TestCase { 

희망 : 대신의

use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; ... class PayrollperiodControllerTest extends KernelTestCase { 

을 메서드 핸들이 없다) 아마도 오타가 있을까요? – Matteo

+0

@Matteo 메소드 핸들이란 무엇입니까? 나는 컨트롤러에서 enitiy 관리자를 사용했습니다. – Zed

답변

0

대신 PHPUnit_Framework_TestCase의 KernelTestCase을 확장, 그래서이 시도해야합니다 :이 도움말

+0

나는 그것을 시도했지만 커널 테스터에 대한 오류가 발생하고 테스트 화면도 표시되지 않습니다. – Zed