blob: 874bd4fb94f1b9e9b488f29f8844aa161d804837 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Tests\Integration\Report;
use Piwik\API\Proxy;
use Piwik\Plugin\Report;
use Piwik\Plugins\ExampleReport\Reports\GetExampleReport;
use Piwik\Plugins\Actions\Columns\ExitPageUrl;
use Piwik\Piwik;
use Piwik\Metrics;
use Piwik\Plugins\ExampleTracker\Columns\ExampleDimension;
use Piwik\Plugins\Referrers\Columns\Keyword;
use Piwik\Plugin\ReportsProvider;
use Piwik\Report\ReportWidgetFactory;
use Piwik\Translate;
use Piwik\Plugin\Manager as PluginManager;
use Piwik\Tests\Framework\Fixture;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
use Piwik\Widget\WidgetsList;
/**
* @group Core
*/
class ReportTest extends IntegrationTestCase
{
public function test_getAllReports_shouldNotFindAReport_IfNoPluginLoaded()
{
$this->unloadAllPlugins();
$reports = new ReportsProvider();
$report = $reports->getAllReports();
$this->assertEquals(array(), $report);
}
public function test_getAllReports_ShouldFindAllAvailableReports()
{
$this->loadExampleReportPlugin();
$this->loadMorePlugins();
$reports = new ReportsProvider();
$reports = $reports->getAllReports();
$this->assertGreaterThan(20, count($reports));
foreach ($reports as $report) {
$this->assertInstanceOf('Piwik\Plugin\Report', $report);
}
}
private function loadExampleReportPlugin()
{
PluginManager::getInstance()->loadPlugins(array('ExampleReport'));
}
private function loadMorePlugins()
{
PluginManager::getInstance()->loadPlugins(array('Actions', 'DevicesDetection', 'CoreVisualizations', 'API', 'Morpheus'));
}
private function unloadAllPlugins()
{
PluginManager::getInstance()->unloadPlugins();
}
}
|