The following code passes the test when run. How can I change this so that it complains about the difference between 123
and '123'
?
$obj = $this->getMockBuilder('Namespace\Object')
->disableOriginalConstructor()
->getMock();
$obj
->expects($this->once())
->method('do')
->with($this->equalTo('123')); // String
$obj->do(123);
How can I enable strict data type checking?
The with
function takes a PHPUnit_Framework_Constraint
.
The list of those can be found in the source
What i think you are looking for is:
->with($this->identicalTo('123'));