FakeNode::withMessage($messageA), 'bar' => FakeNode::withMessage($errorA), ] ); $messages = [...(new MessagesFlattener($node))->errors()]; self::assertCount(2, $messages); self::assertSame('some error message B', (string)$messages[0]); self::assertSame('some error message A', (string)$messages[1]); } }