MediaWiki
REL1_31
DeferredStringifierTest.php
Go to the documentation of this file.
1
<?php
2
6
class
DeferredStringifierTest
extends
PHPUnit\Framework\TestCase {
7
8
use MediaWikiCoversValidator;
9
13
public
function
testToString
(
$params
, $expected ) {
14
$class =
new
ReflectionClass( DeferredStringifier::class );
15
$ds = $class->newInstanceArgs(
$params
);
16
$this->assertEquals( $expected, (
string
)$ds );
17
}
18
19
public
static
function
provideToString
() {
20
return
[
21
// No args
22
[
23
[
24
function
() {
25
return
'foo'
;
26
}
27
],
28
'foo'
29
],
30
// Has args
31
[
32
[
33
function
( $i ) {
34
return
$i;
35
},
36
'bar'
37
],
38
'bar'
39
],
40
];
41
}
42
47
public
function
testCallbackNotCalled
() {
48
$ds =
new
DeferredStringifier
(
function
() {
49
throw
new
Exception(
'This should not be reached!'
);
50
} );
51
// No exception was thrown
52
$this->assertTrue(
true
);
53
}
54
}
DeferredStringifierTest
DeferredStringifier.
Definition
DeferredStringifierTest.php:6
DeferredStringifierTest\testCallbackNotCalled
testCallbackNotCalled()
Verify that the callback is not called if it is never converted to a string.
Definition
DeferredStringifierTest.php:47
DeferredStringifierTest\testToString
testToString( $params, $expected)
provideToString
Definition
DeferredStringifierTest.php:13
DeferredStringifierTest\provideToString
static provideToString()
Definition
DeferredStringifierTest.php:19
DeferredStringifier
Definition
DeferredStringifier.php:27
$params
$params
Definition
styleTest.css.php:40
tests
phpunit
includes
libs
DeferredStringifierTest.php
Generated on Mon Nov 25 2024 15:36:24 for MediaWiki by
1.10.0