/** * TraceAttachment constructor. * * @param ErrorInterface $error * @param StringFormat $formatter */ public function __construct(ErrorInterface $error, StringFormat $formatter) { parent::__construct('Trace'); $this->error = $error; $this->formatter = $formatter; $this->setTitle(new Title('Trace')); $this->setText($formatter->arrayToNumberedList(array_map(function ($traceItem) { return $this->parseTraceItem($traceItem); }, $this->error->getTrace()))); }
public function testArrayToNumberedList() { $stringFormat = new StringFormat(); $this->assertEquals("1. First item\n2. Second item\n3. Third item\n", $stringFormat->arrayToNumberedList(['First item', 'Second item', 'Third item'])); }