2012-11-27 2 views
1

도와주세요.멋진 phpunit 빈 가져 오기

PHPUnit에서 Smarty를 사용하고 있는데 문제가 있습니다. 예를 들어

: 일부 검사에서

, 내가 기능을 여러 번 가져 호출하고 난 단지 바로 첫 번째 전화를 받고, 다른 사람은 빈 반환합니다. 왜???

나는 예를 들어 여기에 몇 가지 코드를 보자

 /** 
    * @dataProvider provider_test 
    */ 
    public function test_field($field) { 

       // with this I instance smarty 
     $front = $this->get_template(); 

     $front->assign('function', 'fb_user_field'); 
     $front->assign('field', $field); 

       // this fetch only return right widh the first value of field 
     $result = $front->fetch('tests/generic.tpl'); 

     $this->assertNotNull($result); 
    } 

    public function provider_test() { 

     return array(
     array('field' => 'subdomain'), 
     array('field' => 'login') 
    ); 
    } 

나는 $ 필드를 확인하고 모든 반복에 올바른 값을받을 수 있지만 처음 후에 만 ​​빈 반환 가져옵니다.

왜 ??? 감사!!!

+0

get_template() 함수를 표시해야합니다. – Rygu

답변

0

제 제안은 단계별로 MakeGood 또는 유사하게 PHP 코드를 디버깅하는 것입니다. 그렇지 않으면 당신이 죽을 때까지 짐작하고 확인하십시오!

는 여기에 내가 시간 추측을 보내고 내가 보상 광고를 발견 할 때까지 phpunit을 확인하는 데 사용되는 몇 가지 링크

http://blog.loftdigital.com/running-phpunit-tests-in-eclipse-pdt

http://www.youtube.com/watch?v=1qnWL52wt58

입니다. 희망이 도움이됩니다!

관련 문제