for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use DataStructures\Sets\{DisjointNode, DisjointSet};
use PHPUnit\Framework\TestCase;
class DisjointSetTest extends TestCase {
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
private $set;
public function setUp() {
$this->set = new DisjointSet();
}
public function testMakeSet() {
$sets = [];
$sets[] = $this->set->makeSet('hello');
$sets[] = $this->set->makeSet('goodbye');
$this->assertEquals($sets[0], $this->set->makeSet('hello'));
$this->assertEquals($sets[1], $this->set->makeSet('goodbye'));
public function testUnion() {
$sets[] = $this->set->makeSet([true, 3.14]);
$this->set->union($sets[0], $sets[1]);
$this->set->union($sets[0], $sets[0]);
$this->assertEquals($sets[1], $this->set->find($sets[0]));
$this->set->union($sets[0], $sets[2]);
$this->assertEquals($sets[1], $this->set->find($sets[2]));
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.