3 namespace MediaWiki\Session
;
9 * @covers MediaWiki\Session\MetadataMergeException
11 class MetadataMergeExceptionTest
extends MediaWikiTestCase
{
13 public function testBasics() {
14 $data = [ 'foo' => 'bar' ];
16 $ex = new MetadataMergeException();
17 $this->assertInstanceOf( 'UnexpectedValueException', $ex );
18 $this->assertSame( [], $ex->getContext() );
20 $ex2 = new MetadataMergeException( 'Message', 42, $ex, $data );
21 $this->assertSame( 'Message', $ex2->getMessage() );
22 $this->assertSame( 42, $ex2->getCode() );
23 $this->assertSame( $ex, $ex2->getPrevious() );
24 $this->assertSame( $data, $ex2->getContext() );
26 $ex->setContext( $data );
27 $this->assertSame( $data, $ex->getContext() );