4 * @covers DeferredStringifier
6 class DeferredStringifierTest
extends PHPUnit_Framework_TestCase
{
8 use MediaWikiCoversValidator
;
11 * @dataProvider provideToString
13 public function testToString( $params, $expected ) {
14 $class = new ReflectionClass( 'DeferredStringifier' );
15 $ds = $class->newInstanceArgs( $params );
16 $this->assertEquals( $expected, (string)$ds );
19 public static function provideToString() {
44 * Verify that the callback is not called if
45 * it is never converted to a string
47 public function testCallbackNotCalled() {
48 $ds = new DeferredStringifier( function () {
49 throw new Exception( 'This should not be reached!' );
51 // No exception was thrown
52 $this->assertTrue( true );