Example #1
0
 public function testRenderingExceptions()
 {
     $shell = new Shell($this->getConfig());
     $output = $this->getOutput();
     $stream = $output->getStream();
     $e = new ParseErrorException('message', 13);
     $shell->addCode('code');
     $this->assertTrue($shell->hasCode());
     $this->assertNotEmpty($shell->getCodeBuffer());
     $shell->renderException($e, $output);
     $this->assertSame($e, $shell->getScopeVariable('_e'));
     $this->assertFalse($shell->hasCode());
     $this->assertEmpty($shell->getCodeBuffer());
     rewind($stream);
     $streamContents = stream_get_contents($stream);
     $this->assertContains('PHP Parse error', $streamContents);
     $this->assertContains('message', $streamContents);
     $this->assertContains('line 13', $streamContents);
 }