mirror of
https://github.com/filp/whoops.git
synced 2026-09-13 19:26:21 +00:00
Add Inspector::getExceptionName & re-structure tests
This commit is contained in:
@@ -31,6 +31,14 @@ class Inspector
|
||||
return $this->exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getExceptionName()
|
||||
{
|
||||
return get_class($this->exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator for the inspected exception's
|
||||
* frames.
|
||||
|
||||
@@ -21,13 +21,24 @@ class InspectorTest extends TestCase
|
||||
return new Inspector($exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Exception\Inspector::getExceptionName
|
||||
*/
|
||||
public function testReturnsCorrectExceptionName()
|
||||
{
|
||||
$exception = $this->getException();
|
||||
$inspector = $this->getInspectorInstance($exception);
|
||||
|
||||
$this->assertEquals(get_class($exception), $inspector->getExceptionName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Exception\Inspector::__construct
|
||||
* @covers Damnit\Exception\Inspector::getException
|
||||
*/
|
||||
public function testExceptionIsStoredAndReturned()
|
||||
{
|
||||
$exception = new RuntimeException;
|
||||
$exception = $this->getException();
|
||||
$inspector = $this->getInspectorInstance($exception);
|
||||
|
||||
$this->assertSame($exception, $inspector->getException());
|
||||
@@ -38,7 +49,7 @@ class InspectorTest extends TestCase
|
||||
*/
|
||||
public function testGetFramesReturnsIterator()
|
||||
{
|
||||
$exception = new RuntimeException;
|
||||
$exception = $this->getException();
|
||||
$inspector = $this->getInspectorInstance($exception);
|
||||
|
||||
$this->assertInstanceOf('Damnit\\Exception\\FrameIterator', $inspector->getFrames());
|
||||
|
||||
@@ -30,15 +30,6 @@ class RunTest extends TestCase
|
||||
return m::mock('Damnit\\Handler\\Handler');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @return Exception
|
||||
*/
|
||||
protected function getException($message = null)
|
||||
{
|
||||
return m::mock('Exception', array($message));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Damnit\Run::clearHandlers
|
||||
*/
|
||||
|
||||
@@ -5,5 +5,16 @@
|
||||
*/
|
||||
|
||||
namespace Damnit;
|
||||
use \Mockery as m;
|
||||
|
||||
class TestCase extends \PHPUnit_Framework_TestCase {}
|
||||
class TestCase extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @param string $message
|
||||
* @return Exception
|
||||
*/
|
||||
protected function getException($message = null)
|
||||
{
|
||||
return m::mock('Exception', array($message));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user