-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from matomo-org/PG-3334-check-direct-dep
Added tests to check direct use of core dependencies, #PG-3334
- Loading branch information
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
/** | ||
* Copyright (C) InnoCraft Ltd - All rights reserved. | ||
* | ||
* NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. | ||
* The intellectual and technical concepts contained herein are protected by trade secret or copyright law. | ||
* Redistribution of this information or reproduction of this material is strictly forbidden | ||
* unless prior written permission is obtained from InnoCraft Ltd. | ||
* | ||
* You shall use this code only in accordance with the license agreement obtained from InnoCraft Ltd. | ||
* | ||
* @link https://www.innocraft.com/ | ||
* @license For license details see https://www.innocraft.com/license | ||
*/ | ||
|
||
namespace Piwik\Plugins\TreemapVisualization\tests\System; | ||
|
||
use Piwik\Plugins\TestRunner\Commands\CheckDirectDependencyUse; | ||
use Piwik\Tests\Framework\TestCase\SystemTestCase; | ||
use Piwik\Version; | ||
use Symfony\Component\Console\Input\ArrayInput; | ||
use Symfony\Component\Console\Output\NullOutput; | ||
|
||
class CheckDirectDependencyUseCommandTest extends SystemTestCase | ||
{ | ||
public function testCommand() | ||
{ | ||
if (version_compare(Version::VERSION, '5.0.3', '<=') && !file_exists(PIWIK_INCLUDE_PATH . '/plugins/TestRunner/Commands/CheckDirectDependencyUse.php')) { | ||
$this->markTestSkipped('tests:check-direct-dependency-use is not available in this version'); | ||
} | ||
|
||
$pluginName = 'TreemapVisualization'; | ||
$checkDirectDependencyUse = new CheckDirectDependencyUse(); | ||
|
||
$console = new \Piwik\Console(self::$fixture->piwikEnvironment); | ||
$console->addCommands([$checkDirectDependencyUse]); | ||
$command = $console->find('tests:check-direct-dependency-use'); | ||
$arguments = [ | ||
'command' => 'tests:check-direct-dependency-use', | ||
'--plugin' => $pluginName, | ||
'--grep-vendor', | ||
]; | ||
|
||
$inputObject = new ArrayInput($arguments); | ||
$command->run($inputObject, new NullOutput()); | ||
|
||
$this->assertEquals([ | ||
'Symfony\Component\Console' => [ | ||
'TreemapVisualization/tests/System/CheckDirectDependencyUseCommandTest.php' | ||
], | ||
], $checkDirectDependencyUse->usesFoundList[$pluginName]); | ||
} | ||
} |