1
+ <?php
2
+ /**
3
+ * Copyright (C) InnoCraft Ltd - All rights reserved.
4
+ *
5
+ * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd.
6
+ * The intellectual and technical concepts contained herein are protected by trade secret or copyright law.
7
+ * Redistribution of this information or reproduction of this material is strictly forbidden
8
+ * unless prior written permission is obtained from InnoCraft Ltd.
9
+ *
10
+ * You shall use this code only in accordance with the license agreement obtained from InnoCraft Ltd.
11
+ *
12
+ * @link https://www.innocraft.com/
13
+ * @license For license details see https://www.innocraft.com/license
14
+ */
15
+
16
+ namespace Piwik \Plugins \TreemapVisualization \tests \System ;
17
+
18
+ use Piwik \Plugins \TestRunner \Commands \CheckDirectDependencyUse ;
19
+ use Piwik \Tests \Framework \TestCase \SystemTestCase ;
20
+ use Piwik \Version ;
21
+ use Symfony \Component \Console \Input \ArrayInput ;
22
+ use Symfony \Component \Console \Output \NullOutput ;
23
+
24
+ class CheckDirectDependencyUseCommandTest extends SystemTestCase
25
+ {
26
+ public function testCommand ()
27
+ {
28
+ if (version_compare (Version::VERSION , '5.0.3 ' , '<= ' ) && !file_exists (PIWIK_INCLUDE_PATH . '/plugins/TestRunner/Commands/CheckDirectDependencyUse.php ' )) {
29
+ $ this ->markTestSkipped ('tests:check-direct-dependency-use is not available in this version ' );
30
+ }
31
+
32
+ $ pluginName = 'TreemapVisualization ' ;
33
+ $ checkDirectDependencyUse = new CheckDirectDependencyUse ();
34
+
35
+ $ console = new \Piwik \Console (self ::$ fixture ->piwikEnvironment );
36
+ $ console ->addCommands ([$ checkDirectDependencyUse ]);
37
+ $ command = $ console ->find ('tests:check-direct-dependency-use ' );
38
+ $ arguments = [
39
+ 'command ' => 'tests:check-direct-dependency-use ' ,
40
+ '--plugin ' => $ pluginName ,
41
+ '--grep-vendor ' ,
42
+ ];
43
+
44
+ $ inputObject = new ArrayInput ($ arguments );
45
+ $ command ->run ($ inputObject , new NullOutput ());
46
+
47
+ $ this ->assertEquals ([
48
+ 'Symfony\Component\Console ' => [
49
+ 'TreemapVisualization/tests/System/CheckDirectDependencyUseCommandTest.php '
50
+ ],
51
+ ], $ checkDirectDependencyUse ->usesFoundList [$ pluginName ]);
52
+ }
53
+ }
0 commit comments