/** * Saving information about url * * @param \Magento\Log\Model\Visitor $visitor * @return \Magento\Log\Model\Resource\Visitor */ protected function _saveUrlInfo($visitor) { $adapter = $this->_getWriteAdapter(); $data = new \Magento\Framework\Object(['url' => $this->string->substr($visitor->getUrl(), 0, 250), 'referer' => $this->string->substr($visitor->getHttpReferer(), 0, 250)]); $bind = $this->_prepareDataForTable($data, $this->getTable('log_url_info')); $adapter->insert($this->getTable('log_url_info'), $bind); $visitor->setLastUrlId($adapter->lastInsertId($this->getTable('log_url_info'))); return $this; }
public function testGetUrl() { $this->visitor->setData(['http_secure' => false, 'http_host' => 'magento.com', 'request_uri' => '/?some=query']); $this->assertEquals('http://magento.com/?some=query', $this->visitor->getUrl()); }