public function testLog() { $this->assertInstanceOf('Webiny\\AnalyticsDb\\LogBuffer', $this->instance->getLogBuffer()); $this->assertSame([], $this->instance->getLogBuffer()->getEntries()); $this->instance->log('browser', 100, 10); $this->assertSame(1, count($this->instance->getLogBuffer()->getEntries())); $this->instance->log('browser', 101); $this->assertSame(2, count($this->instance->getLogBuffer()->getEntries())); $log = $this->instance->getLogBuffer()->getEntries()[0]; $this->assertInstanceOf('Webiny\\AnalyticsDb\\LogEntry', $log); $this->assertSame('browser', $log->getName()); $this->assertSame(100, $log->getRef()); $this->assertSame(10, $log->getIncrement()); $this->instance->save(); $this->assertSame([], $this->instance->getLogBuffer()->getEntries()); }
/** * Save the analytics data. */ private function saveLog() { $this->analyticsDb->save(); }