MediaWiki
REL1_32
PrefixingStatsdDataFactoryProxyTest.php
Go to the documentation of this file.
1
<?php
2
3
use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
4
8
class
PrefixingStatsdDataFactoryProxyTest
extends
PHPUnit\Framework\TestCase {
9
10
use PHPUnit4And6Compat;
11
12
public
function
provideMethodNames
() {
13
return
[
14
[
'timing'
],
15
[
'gauge'
],
16
[
'set'
],
17
[
'increment'
],
18
[
'decrement'
],
19
[
'updateCount'
],
20
[
'produceStatsdData'
],
21
];
22
}
23
27
public
function
testPrefixingAndPassthrough
( $method ) {
29
$innerFactory = $this->getMock(
30
\Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface::class
31
);
32
$innerFactory->expects( $this->once() )
33
->method( $method )
34
->with(
'testprefix.'
.
'metricname'
);
35
36
$proxy =
new
PrefixingStatsdDataFactoryProxy
( $innerFactory,
'testprefix'
);
37
// 1,2,3,4 simply makes sure we provide enough parameters, without caring what they are
38
$proxy->$method(
'metricname'
, 1, 2, 3, 4 );
39
}
40
44
public
function
testPrefixIsTrimmed
( $method ) {
46
$innerFactory = $this->getMock(
47
\Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface::class
48
);
49
$innerFactory->expects( $this->once() )
50
->method( $method )
51
->with(
'testprefix.'
.
'metricname'
);
52
53
$proxy =
new
PrefixingStatsdDataFactoryProxy
( $innerFactory,
'testprefix...'
);
54
// 1,2,3,4 simply makes sure we provide enough parameters, without caring what they are
55
$proxy->$method(
'metricname'
, 1, 2, 3, 4 );
56
}
57
58
}
PrefixingStatsdDataFactoryProxyTest
PrefixingStatsdDataFactoryProxy.
Definition
PrefixingStatsdDataFactoryProxyTest.php:8
PrefixingStatsdDataFactoryProxyTest\testPrefixingAndPassthrough
testPrefixingAndPassthrough( $method)
provideMethodNames
Definition
PrefixingStatsdDataFactoryProxyTest.php:27
PrefixingStatsdDataFactoryProxyTest\testPrefixIsTrimmed
testPrefixIsTrimmed( $method)
provideMethodNames
Definition
PrefixingStatsdDataFactoryProxyTest.php:44
PrefixingStatsdDataFactoryProxyTest\provideMethodNames
provideMethodNames()
Definition
PrefixingStatsdDataFactoryProxyTest.php:12
PrefixingStatsdDataFactoryProxy
Proxy to prefix metric keys sent to a StatsdDataFactoryInterface.
Definition
PrefixingStatsdDataFactoryProxy.php:29
tests
phpunit
includes
libs
stats
PrefixingStatsdDataFactoryProxyTest.php
Generated on Mon Nov 25 2024 15:58:44 for MediaWiki by
1.10.0