factory = new ComputedMetricFactory(MetricsList::get()); } public function tearDown(): void { Fixture::resetTranslations(); parent::tearDown(); } public function testCreateComputedMetricCreateAvgMetric() { $metric = $this->factory->createComputedMetric('bounce_count', 'nb_visits', ComputedMetric::AGGREGATION_AVG); $this->assertSame('avg_bounce_count_per_visits', $metric->getName()); $this->assertSame('Avg. Actions In Visit per Visit', $metric->getTranslatedName()); $this->assertSame('Average value of "Actions In Visit" per "Visits".', $metric->getDocumentation()); $this->assertSame('General_Visitors', $metric->getCategoryId()); } public function testCreateComputedMetricCreateRateMetric() { $metric = $this->factory->createComputedMetric('bounce_count', 'nb_visits', ComputedMetric::AGGREGATION_RATE); $this->assertSame('bounce_count_visits_rate', $metric->getName()); $this->assertSame('Bounces Rate', $metric->getTranslatedName()); $this->assertSame('The ratio of "Actions In Visit" out of all "Visits".', $metric->getDocumentation()); $this->assertSame('General_Visitors', $metric->getCategoryId()); } }