function testFlatten() { $node = new Node(); $node->valid = true; $node->change = Change::User; $node->children[] = $child = new Node(); $child->change = Change::Internal; $child->valid = false; $child->messages[] = new Message(['id' => 'foo.bar']); $flat = $node->flatten(); $this->assertInstanceOf(Node::class, $flat); $this->assertFalse($flat->valid); $this->assertEquals(Change::User, $flat->change); }
/** * @param depth int Internal */ public function formatNode(\Fulfil\Node $node, $depth = null) { return $this->formatAll($node->flatten()->messages, $depth); }