My goal is to ensure that the graphic has the expected values โโand types. I want each value to have the expected type.
For this purpose assertEquals(), unfortunately, it will not be useful:
$this->assertEquals(
[ 'prop' => '0' ],
[ 'prop' => 0 ]
);
In this case, it assertSame()works beautifully:
$this->assertSame(
[ 'prop' => '0' ],
[ 'prop' => 0 ]
);
The problem with this assertSame()is that it also checks the link for objects:
$this->assertSame(
(object) [ 'prop' => 0 ],
(object) [ 'prop' => 0 ]
);
What options do I have?
In a separate note, Iโm not sure why it was designed in this way - it seems to me that it assertSame()does two things at once (I have no more tested class of objects, not links).
source
share