matomo / plugins /CustomVariables /tests /System /CheckDirectDependencyUseCommandTest.php
Leon4gr45's picture
Upload folder using huggingface_hub (part 17)
1f0da20 verified
Raw History Blame Contribute Delete
1.82 kB
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\CustomVariables\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 = 'CustomVariables';
$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' => [
'CustomVariables/tests/Commands/InfoTest.php',
'CustomVariables/tests/Commands/SetNumberOfCustomVariablesTest.php',
'CustomVariables/tests/System/CheckDirectDependencyUseCommandTest.php'
],
], $checkDirectDependencyUse->usesFoundList[$pluginName]);
}
}