public function testWriteFailure() { $renderer = new template\Renderer('data-template-tag-url.html', array(__DIR__)); $renderer->template_content = ''; $locked_file = Conf::f('tmp_folder') . '/no.write.access.here'; touch($locked_file); chmod($locked_file, 00); try { $renderer->write($locked_file); } catch (\photon\template\Exception $e) { chmod($locked_file, 0666); unlink($locked_file); $this->setExpectedException('\\photon\\template\\Exception'); throw $e; } $this->fail(sprintf('Was able to write to %s', $locked_file)); }