PHP code example of backendtea / assert-object-same-state
1. Go to this page and download the library: Download backendtea/assert-object-same-state library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
backendtea / assert-object-same-state example snippets
use BackEndTea\SameObject\ObjectHasSameStateAssertion;
use PHPUnit\Framework\TestCase;
class MyTest extends TestCase
{
use ObjectHasSameStateAssertion;
public function testObjects(): void
{
$one = new class{public $a=3;};
$two = new class{public $a=3;};
$this->assertObjectHasSameSate($one, $two);
}
}
$comp = new \BackEndTea\SameObject\ObjectComparator();
$comp->haveSameState($objectOne, $objectTwo);
class Thing
{
public $prop;
public function __construct($prop)
{
$this->prop = $prop;
}
}
new Thing(10) == new Thing('10'); // true
new Thing(10) === new Thing('10'); // false
new Thing(10) === new Thing(10); // false
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.