Closed
Description
<?php
class CompareTest extends PHPUnit_Framework_TestCase
{
public function testSame()
{
$this->assertSame(array('one'), array('two'));
}
public function testEquals()
{
$this->assertEquals(array('one'), array('two'));
}
}
Method $this->assertSame(array('one'), array('two'));
will throw PHPUnit_Framework_ExpectationFailedException
with ComparisonFailure
equals to null
while method $this->assertEquals(...)
will create proper ComparisonFailure
object.
$this->assertSame(...)
uses PHPUnit_Framework_Constraint_IsIdentical.evaluate(...)
$this->assertEquals(...)
uses PHPUnit_Framework_Constraint_IsEqual.evaluate(...)
The issue was reproduced with PHPUnit 5.3
Corresponding PhpStorm issue: https://youtrack.jetbrains.com/issue/WI-31705
Metadata
Metadata
Assignees
Labels
No labels