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 \DeviceDetectorCache \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 = 'DeviceDetectorCache ' ;
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+ 'DeviceDetectorCache/tests/System/CheckDirectDependencyUseCommandTest.php '
44+ ],
45+ 'DeviceDetector ' => [
46+ 'DeviceDetectorCache/CachedEntry.php ' ,
47+ 'DeviceDetectorCache/DeviceDetector/CachedBrowserParser.php ' ,
48+ 'DeviceDetectorCache/DeviceDetector/CachedOperatingSystemParser.php ' ,
49+ ]
50+ ], $ checkDirectDependencyUse ->usesFoundList [$ pluginName ]);
51+ }
52+ }
0 commit comments