public function testGetBestMatchFromBuilder() { $root = new ComparablePair(); $root->buildFromSets([new Color('red'), new Color('green'), new Color('blue')], [new Color('blueviolet'), new Color('bluegreen'), new Color('reed')]); $expected = [new ComparablePair(new Color('blue'), new Color('blueviolet')), new ComparablePair(new Color('green'), new Color('bluegreen')), new ComparablePair(new Color('red'), new Color('reed'))]; $this->assertEquals($expected, $root->getBestMatch()); }
/** * @return int */ private function getBranchTotal() { if ($this->parent === null) { return 0; } return $this->getPairTotal() + $this->parent->getBranchTotal(); }