wiki.techinc.nl/tests/phpunit/unit/includes/libs/Metrics/SampleTest.php
Cole White 69d63cdbfe Metrics: Implement statsd-exporter compatible Metrics interface
1. Standardizes metrics interface in a way that supports both statsd
     and a statsd-exporter compatible format (dogstatsd)
  2. Brings metrics formatting in-house
  3. Adds phpunit tests

Bug: T240685
Bug: T205870
Change-Id: I264097c10d83bef291d68bffefa7fb9eb8dc87bb
2021-09-29 15:27:23 -06:00

17 lines
389 B
PHP

<?php
namespace Wikimedia\Tests\Metrics;
use PHPUnit\Framework\TestCase;
use Wikimedia\Metrics\Sample;
/**
* @covers \Wikimedia\Metrics\Sample
*/
class SampleTest extends TestCase {
public function testSample() {
$s = new Sample( [ 'labels' => [ 'a', 'b' ], 'value' => 1 ] );
$this->assertEquals( [ 'a', 'b' ], $s->getLabels() );
$this->assertSame( 1.0, $s->getValue() );
}
}