/** * Test that the logger can log an event */ public function testLoggerCanLogEvent() { $event = new Event(); $event->setType('event'); $event->setSubType('pageview'); $event->setData(array('[foo]' => 'bar')); $event->setUser(2); $this->logger->log($event); $results = $this->logger->getStorage()->fetch(array('type' => 'event', 'sub_type' => 'pageview')); $this->assertTrue(1 == count($results)); $this->assertTrue($results[0]['sub_type'] == 'pageview'); }
/** * Test that the collection can log an event */ public function testCollectionCanLogEvent() { $this->collection->addLogger($this->logger1); $this->collection->addLogger($this->logger2); $event = new Event(); $event->setType('event'); $event->setSubType('pageview'); $event->setData(array('[foo]' => 'bar')); $event->setUser(2); $this->collection->log($event); $results = $this->collection[0]->getStorage()->fetch(array('type' => 'event', 'sub_type' => 'pageview')); $this->assertTrue(1 == count($results)); $this->assertTrue($results[0]['sub_type'] == 'pageview'); $this->assertTrue(null === $this->collection[1]->getStorage()->fetch(array())); }