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
|
<?php
/**
* Piwik - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Tests\Unit\Scheduler;
use Piwik\Plugins\ScheduledReports\ScheduledReports;
use Piwik\Scheduler\Task;
/**
* @group Scheduler
*/
class TaskTest extends \PHPUnit\Framework\TestCase
{
public function testGetClassName()
{
$scheduledTask = new Task(new ScheduledReports(), null, null, null);
$this->assertEquals('Piwik\Plugins\ScheduledReports\ScheduledReports', $scheduledTask->getClassName());
}
/**
* Dataprovider for testGetTaskName
*/
public function getTaskNameTestCases()
{
return array(
array('CoreAdminHome.purgeOutdatedArchives', 'CoreAdminHome', 'purgeOutdatedArchives', null),
array('CoreAdminHome.purgeOutdatedArchives_previous30', 'CoreAdminHome', 'purgeOutdatedArchives', 'previous30'),
array('ScheduledReports.weeklySchedule', 'ScheduledReports', 'weeklySchedule', null),
array('ScheduledReports.weeklySchedule_1', 'ScheduledReports', 'weeklySchedule', 1),
);
}
/**
* @dataProvider getTaskNameTestCases
*/
public function testGetTaskName($expectedTaskName, $className, $methodName, $methodParameter)
{
$this->assertEquals($expectedTaskName, Task::getTaskName($className, $methodName, $methodParameter));
}
}
|