for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Serializers\Tests\Phpunit\Exceptions;
use Serializers\Exceptions\UnsupportedObjectException;
/**
* @covers Serializers\Exceptions\UnsupportedObjectException
*
* @group Serialization
* @license GPL-2.0-or-later
* @author Jeroen De Dauw < [email protected] >
*/
class UnsupportedObjectExceptionTest extends \PHPUnit\Framework\TestCase {
public function testConstructorWithOnlyRequiredArguments() {
$object = [ 'the' => 'game' ];
$exception = new UnsupportedObjectException( $object );
$this->assertRequiredFieldsAreSet( $exception, $object );
}
public function testConstructorWithAllArguments() {
$message = 'NyanData all the way across the sky!';
$previous = new \Exception( 'Onoez!' );
$exception = new UnsupportedObjectException( $object, $message, $previous );
$this->assertEquals( $message, $exception->getMessage() );
$this->assertEquals( $previous, $exception->getPrevious() );
private function assertRequiredFieldsAreSet( UnsupportedObjectException $exception, $object ) {
$this->assertEquals( $object, $exception->getUnsupportedObject() );