wiki.techinc.nl/tests/phpunit/includes/libs/Message/MessageParamTest.php
Brad Jorsch 0395cc8bf5 libs/Message: Improve tests
If code in libs isn't supposed to depend on stuff outside of libs, then
that code's tests shouldn't either.

Also, let's explicitly test MessageParam and its subclasses.

Change-Id: I87b7c6aabea5bdb694cc598a412e0428cd78a68a
2019-10-17 10:36:41 -04:00

30 lines
728 B
PHP

<?php
namespace Wikimedia\Tests\Message;
use Wikimedia\Message\MessageParam;
use Wikimedia\Message\ParamType;
use Wikimedia\TestingAccessWrapper;
/**
* @covers \Wikimedia\Message\MessageParam
*/
class MessageParamTest extends \PHPUnit\Framework\TestCase {
public function testGetType() {
$mp = $this->getMockForAbstractClass( MessageParam::class );
TestingAccessWrapper::newFromObject( $mp )->type = ParamType::RAW;
$this->assertSame( ParamType::RAW, $mp->getType() );
}
public function testGetValue() {
$dummy = new \stdClass;
$mp = $this->getMockForAbstractClass( MessageParam::class );
TestingAccessWrapper::newFromObject( $mp )->value = $dummy;
$this->assertSame( $dummy, $mp->getValue() );
}
}