/** * @inheritdoc */ protected function classSetUp() { $this->collectorBase = new Collector(); $this->collectorPrefix = new Collector(); $this->collectorPrefix->setPrefix('prefix_'); $this->collectorTags = new Collector(); $this->collectorTags->setTags(['env' => 'prod', 'server' => 'web01']); $this->collectorTagsPrefix = new Collector(); $this->collectorTagsPrefix->setTags(['env' => 'prod', 'server' => 'web01']); $this->collectorTagsPrefix->setPrefix('prefix_'); }
/** * @inheritdoc */ protected function classSetUp() { $this->collectorBase = new Collector(); $this->collectorBase->setBuffer(new OnShutdownBuffer()); $this->collectorBase->setHandler(new StatsDaemonHandler()); $this->collectorPrefix = new Collector(); $this->collectorPrefix->setBuffer(new OnShutdownBuffer()); $this->collectorPrefix->setHandler(new StatsDaemonHandler()); $this->collectorPrefix->setPrefix('prefix_'); $this->collectorTags = new Collector(); $this->collectorTags->setBuffer(new OnShutdownBuffer()); $this->collectorTags->setHandler(new StatsDaemonHandler()); $this->collectorTags->setTags(['env' => 'prod', 'server' => 'web01']); $this->collectorTagsPrefix = new Collector(); $this->collectorTagsPrefix->setBuffer(new OnShutdownBuffer()); $this->collectorTagsPrefix->setHandler(new StatsDaemonHandler()); $this->collectorTagsPrefix->setTags(['env' => 'prod', 'server' => 'web01']); $this->collectorTagsPrefix->setPrefix('prefix_'); }
/** * Tests getters and setters */ public function testSetGet() { $collector = new Collector(); // Set get prefix $this->assertEquals('', $collector->getPrefix()); $collector->setPrefix('prefix_'); $this->assertEquals('prefix_', $collector->getPrefix()); // Set get tags $this->assertFalse($collector->hasTags()); $this->assertCount(0, $collector->getTags()); $collector->setTags(['env' => 'prod']); $this->assertArrayHasKey('env', $collector->getTags()); $collector->removeTag('env'); $this->assertArrayNotHasKey('env', $collector->getTags()); $collector->addTag('server', 'web01'); $this->assertArrayHasKey('server', $collector->getTags()); }