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
|
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
use Piwik\AssetManager\UIAsset\OnDiskUIAsset;
use Piwik\AssetManager\UIAssetMinifier;
class Piwik_Test_UIAssetMinifierTest extends PHPUnit_Framework_TestCase
{
/**
* @var UIAssetMinifier
*/
private $assetMinifier;
public function setUp()
{
$this->assetMinifier = UIAssetMinifier::getInstance();
}
public function provider_isMinifiedJs()
{
return array(
array('libs/bower_components/jquery/dist/jquery.min.js', true),
array('libs/bower_components/jquery-ui/ui/minified/jquery-ui.min.js', true),
array('libs/jquery/jquery.browser.js', true),
array('libs/jqplot/jqplot-custom.min.js', true),
array('plugins/TreemapVisualization/libs/Jit/jit-2.0.1-yc.js', true),
array('plugins/TreemapVisualization/javascripts/treemapViz.js', false),
array('plugins/UserCountryMap/javascripts/vendor/raphael.min.js', true),
array('plugins/UserCountryMap/javascripts/vendor/jquery.qtip.min.js', true),
array('plugins/UserCountryMap/javascripts/vendor/kartograph.min.js', true),
array('plugins/UserCountryMap/javascripts/vendor/jquery.qtip.min.js', true),
);
}
/**
* @group Core
* @dataProvider provider_isMinifiedJs
*/
public function test_isMinifiedJs($scriptFileName, $isMinified)
{
$scriptFile = new OnDiskUIAsset(PIWIK_USER_PATH, $scriptFileName);
$this->assertEquals(
$isMinified,
$this->assetMinifier->isMinifiedJs($scriptFile->getContent())
);
}
}
|