Skip to content

Commit 14cba78

Browse files
Merge pull request #50 from matomo-org/PG-3334-check-direct-dep
Added tests to check direct use of core dependencies, #PG-3334
2 parents a6077c6 + f634857 commit 14cba78

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

.github/workflows/matomo-tests.yml

+24
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,29 @@ concurrency:
3232
cancel-in-progress: true
3333

3434
jobs:
35+
PluginTests:
36+
runs-on: ubuntu-20.04
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
php: [ '7.2', '8.2' ]
41+
target: ['minimum_required_matomo', 'maximum_supported_matomo']
42+
steps:
43+
- uses: actions/checkout@v3
44+
with:
45+
lfs: true
46+
persist-credentials: false
47+
- name: Install package ripgrep
48+
run: sudo apt-get install ripgrep
49+
- name: Run tests
50+
uses: matomo-org/github-action-tests@main
51+
with:
52+
plugin-name: 'TreemapVisualization'
53+
php-version: ${{ matrix.php }}
54+
test-type: 'PluginTests'
55+
matomo-test-branch: ${{ matrix.target }}
56+
artifacts-pass: ${{ secrets.ARTIFACTS_PASS }}
57+
upload-artifacts: ${{ matrix.php == '7.2' && matrix.target == 'maximum_supported_matomo' }}
3558
UI:
3659
runs-on: ubuntu-20.04
3760
steps:
@@ -42,6 +65,7 @@ jobs:
4265
- name: running tests
4366
uses: matomo-org/github-action-tests@main
4467
with:
68+
testomatio: ${{secrets.TESTOMATIO}}
4569
plugin-name: 'TreemapVisualization'
4670
matomo-test-branch: 'maximum_supported_matomo'
4771
test-type: 'UI'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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

Comments
 (0)