blob: d062d59392df9c00a0553595a185e17ef6485e3b (
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
|
<?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\Plugin\ReportsProvider;
use Piwik\Plugin\Manager as PluginManager;
/**
* @group Core
*/
class ReportTest extends \PHPUnit_Framework_TestCase
{
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();
}
}
|