public function testStyledOutput() { $base = Libraries::get(true, 'resources') . '/tmp/tests'; $this->skipIf(!is_writable($base), "Path `{$base}` is not writable."); $response = new Response(array('output' => fopen($this->streams['output'], 'w+'))); $response->styles(array('heading' => "[1;36m")); $response->output('{:heading}ok'); $this->assertEqual("[1;36mok", file_get_contents($this->streams['output'])); }
public function testStyledOutput() { $base = Libraries::get(true, 'resources') . '/tmp/tests'; $this->skipIf(!is_writable($base), "Path `{$base}` is not writable."); $response = new Response(array('output' => fopen($this->streams['output'], 'w+'))); $response->styles(array('heading' => "[1;36m")); $response->output('{:heading}ok'); $expected = "[1;36mok"; if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $expected = 'ok'; } $this->assertEqual($expected, file_get_contents($this->streams['output'])); }