public function test_fetch_ShouldUseCorrectApiUrl() { PluginManager::getInstance()->loadPlugins(array('API', 'ExampleReport')); $proxyMock = $this->getMock('stdClass', array('call', '__construct')); $proxyMock->expects($this->once())->method('call')->with('\\Piwik\\Plugins\\ExampleReport\\API', 'getExampleReport', array('idSite' => 1, 'date' => '2012-01-02', 'format' => 'original', 'module' => 'API', 'method' => 'ExampleReport.getExampleReport'))->willReturn("result"); Proxy::setSingletonInstance($proxyMock); $report = new GetExampleReport(); $result = $report->fetch(array('idSite' => 1, 'date' => '2012-01-02')); $this->assertEquals("result", $result); }