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