for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Deserializers\Tests\Phpunit\Exceptions;
use Deserializers\Exceptions\UnsupportedTypeException;
use Exception;
/**
* @covers Deserializers\Exceptions\UnsupportedTypeException
*
* @license GPL-2.0-or-later
* @author Jeroen De Dauw < [email protected] >
* @author Thiemo Kreuz
*/
class UnsupportedTypeExceptionTest extends \PHPUnit\Framework\TestCase {
public function testConstructorWithOnlyRequiredArguments() {
$exception = new UnsupportedTypeException( 'type' );
$this->assertSame( 'type', $exception->getUnsupportedType() );
$this->assertSame( 'Type "type" is unsupported', $exception->getMessage() );
$this->assertNull( $exception->getPrevious() );
}
public function testConstructorWithAllArguments() {
$previous = new Exception( 'previous' );
$exception = new UnsupportedTypeException( 'type', 'customMessage', $previous );
$this->assertSame( 'customMessage', $exception->getMessage() );
$this->assertSame( $previous, $exception->getPrevious() );