/** * Add record to collection * * @param array $data * @throws \Sonar\Exceptions\StorageServiceException * @return \MongoId */ public function add(array $data) { try { // add user data $lastInsertId = $this->visitorMapper->add($data); return $lastInsertId; } catch (MongoMapperException $e) { throw new StorageServiceException($e->getMessage()); } }
/** * Add records test */ public function testAdd() { $data = new VisitorMapper($this->mock->getConfig()); // checking instance object return $this->assertInstanceOf('\\MongoId', $data->add($this->mock->getAddData())); }