Download tests/PHPUnit/Integration/Report/ReportsTest.php from Leon4gr45/matomo: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/spaces/Leon4gr45/matomo/resolve/main/tests/PHPUnit/Integration/Report/ReportsTest.php
- Command line
-
hf download hf://spaces/Leon4gr45/matomo/tests/PHPUnit/Integration/Report/ReportsTest.php
-
curl -L -o ReportsTest.php https://huggingface.co/spaces/Leon4gr45/matomo/resolve/main/tests/PHPUnit/Integration/Report/ReportsTest.php
1.47 kB
| /** | |
| * Matomo - free/libre analytics platform | |
| * | |
| * @link https://matomo.org | |
| * @license https://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 testGetAllReportsShouldNotFindAReportIfNoPluginLoaded() | |
| { | |
| $this->unloadAllPlugins(); | |
| $reports = new ReportsProvider(); | |
| $report = $reports->getAllReports(); | |
| $this->assertEquals(array(), $report); | |
| } | |
| public function testGetAllReportsShouldFindAllAvailableReports() | |
| { | |
| $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(); | |
| } | |
| } | |