Merge pull request #1 from geofflancaster/master

Added test cases for the empty string edge cases
oauth1test
Geoff Lancaster 2015-03-10 14:33:40 -05:00
commit da5e316c1b
1 changed files with 29 additions and 1 deletions

View File

@ -41,4 +41,32 @@ class IDPExceptionTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('message: 404: message', (string)$exception);
}
}
public function testEmptyMessage()
{
$exception = new IDPException(array('error' => 'error_message', 'message' => ''));
// message should be the error text since message isn't specifically defined
$this->assertEquals('error_message', $exception->getMessage());
}
public function testNonEmptyMessage()
{
$exception = new IDPException(array('error' => 'error_message', 'message' => 'message'));
// message should be the error text since message isn't specifically defined
$this->assertEquals('message', $exception->getMessage());
}
public function testEmptyError()
{
$exception = new IDPException(array('error' => '', 'message' => 'message'));
// message should be the error text since message isn't specifically defined
$this->assertEquals('message', $exception->getMessage());
}
public function testEmptyAndMessage()
{
$exception = new IDPException(array('error' => '', 'message' => ''));
// message should be the error text since message isn't specifically defined
$this->assertEquals('Unknown Error.', $exception->getMessage());
}
}