/** * Assert formatted input matchs expected outcome * * @param string $expected * @param string $input * @throws unittest.AssertionFailedError */ private function assertFormatted($expected, $input) { $stack = []; $formatted = Terminal::format($input, $stack); if ($expected !== $formatted) { $this->fail('equals', new Bytes($formatted), new Bytes($expected)); } }
/** * Print a formatted string * * @param string $format * @param var... $args * @return void */ public function writef($format, ...$args) { $stack = []; $formatted = Terminal::format($format, $stack); while ($end = array_shift($stack)) { $formatted .= $end; } $this->out->write(vsprintf($formatted, $args)); }