Quantcast
Channel: Matomo forums - Latest topics
Viewing all articles
Browse latest Browse all 13981

Help needed writing tests for my plugin

$
0
0

@tassoman wrote:

My Plugin is essentially a PHPunit tests container, it should catch metrics from a remote Piwik installation, then from local installation.

My problem is submitting a local request to Piwik\API, I'm simply getting Exception: General_ExceptionInvalidRendererFormat

This is the code:

private $queryURL;
private $local;
private $remoteHost = 'http://demo.piwik.org/index.php?';
private $queryParams = array(
'module=API',
'method=API.get',
'period=day',
'date=yesterday',
'format=JSON',
);

`public function setUp()
{
// set up here if needed
$this->queryURL = implode('&', $this->queryParams);

$url = new Url();
$this->local = $url->getCurrentUrl();

}`

public function testCompare()
{
$http = new Http();
$json = $http->fetchRemoteFile($this->remoteHost . $this->queryURL . '&idSite=7');
$remote_data = json_decode($json, true);
$request = new Request($this->queryURL . '&idSite=1');
$response = $request->process();
$local_data = $response->getSerialized();
$this->assertEquals($remote_data, $local_data);
}

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 13981

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>