/** * @depends testStrictlyDominates * @covers ::getFrontier * * ------ * 0 < 2 \ * 1 < > 4 - 5 * 3 */ public function testFrontierMutatedGraph() { $this->graph->ensureArc($this->v[0], $this->v[4]); $dominator = new Dominator($this->graph, $this->func); $this->graph->ensureArc($this->v[0], $this->getMock(Vertex::class)); $this->assertSame([], $dominator->getFrontier($this->v[0])); $this->assertSame([$this->v[4]], $dominator->getFrontier($this->v[1])); $this->assertSame([$this->v[4]], $dominator->getFrontier($this->v[2])); $this->assertSame([$this->v[4]], $dominator->getFrontier($this->v[3])); $this->assertSame([], $dominator->getFrontier($this->v[4])); }
public function findFrontier(array $nodes, Dominator $dominator) { $result = array(); foreach ($nodes as $node) { $result = array_merge($result, $dominator->getFrontier($node)); } return $result; }