1 | <?php |
||
2 | /** |
||
3 | * This file is part of graze/dog-statsd |
||
4 | * |
||
5 | * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com> |
||
6 | * |
||
7 | * For the full copyright and license information, please view the LICENSE |
||
8 | * file that was distributed with this source code. |
||
9 | * |
||
10 | * @license https://github.com/graze/dog-statsd/blob/master/LICENSE.md |
||
11 | * @link https://github.com/graze/dog-statsd |
||
12 | */ |
||
13 | |||
14 | namespace Graze\DogStatsD\Test\Unit; |
||
15 | |||
16 | use Graze\DogStatsD\Test\TestCase; |
||
17 | |||
18 | class TimerTest extends TestCase |
||
19 | { |
||
20 | public function testTiming() |
||
21 | { |
||
22 | $this->client->timing('test_metric', 123); |
||
23 | $this->assertEquals('test_metric:123|ms', $this->client->getLastMessage()); |
||
24 | } |
||
25 | |||
26 | public function testFunctionTiming() |
||
27 | { |
||
28 | $this->client->time('test_metric', function () { |
||
29 | usleep(100000); |
||
30 | }); |
||
31 | $this->assertRegExp('/test_metric:1[0-9]{2}\.[0-9]+\|ms/', $this->client->getLastMessage()); |
||
0 ignored issues
–
show
|
|||
32 | } |
||
33 | |||
34 | public function testTags() |
||
35 | { |
||
36 | $this->client->timing('test_metric', 123, ['tag']); |
||
37 | $this->assertEquals('test_metric:123|ms|#tag', $this->client->getLastMessage()); |
||
38 | } |
||
39 | } |
||
40 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.