2011-01-20 4 views
1

:SimpleTest : 다음 코드를 고려 assertEquals 및 PHP 유형

<?php 
class Foo extends UnitTestCase { 
    public function testFoo() { 
     $foo = new Foo(); 
     $this->assertEqual('2, 3', $foo->bar(3)); 
    } 
} 
?> 

<?php 
class Foo { 
    public function bar() { 
     return 2; 
    } 
} 
?> 

'2, 3'== $ foo-> 바 (2) PHP가 가능하기 때문이다. 이 시험 합격! 그러나 어떤 경우 (잘못이다 '2, 3'문자열이 정수는 다른 EqualExpectation 클래스

SimpleTest 시험 방법

:.?

function test($compare) { 
    return (($this->value == $compare) && ($compare == $this->value)); 
} 

는 SimpleTest에 그 테스트를 대신 할 수있는 방법이 있나요 ==, 방법 감사합니다 ... === 사용하는

답변