MediaWiki REL1_33
PrefixingStatsdDataFactoryProxyTest.php
Go to the documentation of this file.
1<?php
2
4
8class 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}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Proxy to prefix metric keys sent to a StatsdDataFactoryInterface.