1
+ <?php
2
+ /**
3
+ * Piwik - free/libre analytics platform
4
+ *
5
+ * @link http://piwik.org
6
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
7
+ */
8
+
9
+ namespace Piwik \Plugins \CustomAlerts \tests \System ;
10
+
11
+ use Piwik \Plugins \TestRunner \Commands \CheckDirectDependencyUse ;
12
+ use Piwik \Tests \Framework \TestCase \SystemTestCase ;
13
+ use Piwik \Version ;
14
+ use Symfony \Component \Console \Input \ArrayInput ;
15
+ use Symfony \Component \Console \Output \NullOutput ;
16
+
17
+ class CheckDirectDependencyUseCommandTest extends SystemTestCase
18
+ {
19
+ public function testCommand ()
20
+ {
21
+ if (version_compare (Version::VERSION , '5.0.3 ' , '<= ' ) && !file_exists (PIWIK_INCLUDE_PATH . '/plugins/TestRunner/Commands/CheckDirectDependencyUse.php ' )) {
22
+ $ this ->markTestSkipped ('tests:check-direct-dependency-use is not available in this version ' );
23
+ }
24
+
25
+ $ pluginName = 'CustomAlerts ' ;
26
+
27
+ $ checkDirectDependencyUse = new CheckDirectDependencyUse ();
28
+
29
+ $ console = new \Piwik \Console (self ::$ fixture ->piwikEnvironment );
30
+ $ console ->addCommands ([$ checkDirectDependencyUse ]);
31
+ $ command = $ console ->find ('tests:check-direct-dependency-use ' );
32
+ $ arguments = [
33
+ 'command ' => 'tests:check-direct-dependency-use ' ,
34
+ '--plugin ' => $ pluginName ,
35
+ '--grep-vendor ' ,
36
+ ];
37
+
38
+ $ inputObject = new ArrayInput ($ arguments );
39
+ $ command ->run ($ inputObject , new NullOutput ());
40
+
41
+ $ this ->assertEquals ([
42
+ 'Symfony\Component\Console ' => [
43
+ 'CustomAlerts/tests/System/CheckDirectDependencyUseCommandTest.php '
44
+ ],
45
+ 'PHPMailer\PHPMailer ' => [
46
+ 'CustomAlerts/tests/Integration/NotifierTest.php '
47
+ ],
48
+ ], $ checkDirectDependencyUse ->usesFoundList [$ pluginName ]);
49
+ }
50
+ }
0 commit comments