2011-10-06 2 views

답변

16

instanceof PHP에 내장 된 대신 assertInstanceOf()을 사용하면 의미있는 실패 메시지를 얻을 수 있습니다.

function testInstanceOf() { 
    $obj = new Foo; 
    self::assertInstanceOf('Bar', $obj); 
} 

... 

Failed asserting that <Foo> is an instance of class "Bar". 
0

또는도이 같은이 어설 사용해야합니다

$this->assertSame(
     'Symfony\Component\Form\AbstractType', 
     get_parent_class('AppBundle\Form\CarType'), 
     'The form does not extend the AbstractType class' 
     ); 
관련 문제