blob: 37d193483f4e118716756952aef98275d8e14f75 (
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
|
<?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\API;
use Piwik\API\ApiRenderer;
use Piwik\Plugin\Manager;
/**
* @group Core
* @group Only2
*/
class ApiRendererTest extends \PHPUnit\Framework\TestCase
{
public function setUp()
{
Manager::getInstance()->loadPlugins(array('API'));
}
public function test_factory_shouldCreateAnInstance_IfValidFormatGiven()
{
$renderer = ApiRenderer::factory('php', array());
$this->assertInstanceOf('Piwik\Plugins\API\Renderer\Php', $renderer);
$renderer = ApiRenderer::factory('PHP', array());
$this->assertInstanceOf('Piwik\Plugins\API\Renderer\Php', $renderer);
$renderer = ApiRenderer::factory('pHp', array());
$this->assertInstanceOf('Piwik\Plugins\API\Renderer\Php', $renderer);
$renderer = ApiRenderer::factory('xmL', array());
$this->assertInstanceOf('Piwik\Plugins\API\Renderer\Xml', $renderer);
$renderer = ApiRenderer::factory('OriginAl', array());
$this->assertInstanceOf('Piwik\Plugins\API\Renderer\Original', $renderer);
}
/**
* @expectedException \Exception
* @expectedExceptionMessage General_ExceptionInvalidRendererFormat
*/
public function test_factory_shouldThrowAnException_IfInvalidFormatGiven()
{
ApiRenderer::factory('phpi', array());
}
}
|