update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
187
www/analytics/plugins/LanguagesManager/Test/Integration/LanguagesManagerTest.php
Executable file
187
www/analytics/plugins/LanguagesManager/Test/Integration/LanguagesManagerTest.php
Executable file
|
|
@ -0,0 +1,187 @@
|
|||
<?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\LanguagesManager\Test\Integration;
|
||||
|
||||
use Piwik\Container\StaticContainer;
|
||||
use Piwik\Intl\Data\Provider\LanguageDataProvider;
|
||||
use Piwik\Plugins\LanguagesManager\API;
|
||||
use \Exception;
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Filter\ByParameterCount;
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Filter\EmptyTranslations;
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Filter\EncodedEntities;
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Filter\UnnecassaryWhitespaces;
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Validate\CoreTranslations;
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Validate\NoScripts;
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Writer;
|
||||
|
||||
/**
|
||||
* @group LanguagesManager
|
||||
*/
|
||||
class LanguagesManagerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
function getTestDataForLanguageFiles()
|
||||
{
|
||||
// we also test that none of the language php files outputs any character on the screen (eg. space before the <?php)
|
||||
$languages = API::getInstance()->getAvailableLanguages();
|
||||
|
||||
$plugins = \Piwik\Plugin\Manager::getInstance()->readPluginsDirectory();
|
||||
|
||||
$pluginsWithTranslation = array();
|
||||
|
||||
foreach ($plugins as $plugin) {
|
||||
|
||||
if (API::getInstance()->getPluginTranslationsForLanguage($plugin, 'en')) {
|
||||
|
||||
$pluginsWithTranslation[] = $plugin;
|
||||
}
|
||||
}
|
||||
|
||||
$return = array();
|
||||
foreach ($languages as $language) {
|
||||
if ($language != 'en') {
|
||||
$return[] = array($language, null);
|
||||
|
||||
foreach ($pluginsWithTranslation as $plugin) {
|
||||
|
||||
$return[] = array($language, $plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* test all languages
|
||||
*
|
||||
* @group Plugins
|
||||
*
|
||||
* @dataProvider getTestDataForLanguageFiles
|
||||
*/
|
||||
function testGetTranslationsForLanguages($language, $plugin)
|
||||
{
|
||||
$translationWriter = new Writer($language, $plugin);
|
||||
|
||||
$baseTranslations = $translationWriter->getTranslations('en');
|
||||
|
||||
$translationWriter->addValidator(new NoScripts());
|
||||
if (empty($plugin)) {
|
||||
$translationWriter->addValidator(new CoreTranslations($baseTranslations));
|
||||
}
|
||||
|
||||
// prevent build from failing when translations string have been deleted
|
||||
// $translationWriter->addFilter(new ByBaseTranslations($baseTranslations));
|
||||
$translationWriter->addFilter(new EmptyTranslations());
|
||||
$translationWriter->addFilter(new ByParameterCount($baseTranslations));
|
||||
$translationWriter->addFilter(new UnnecassaryWhitespaces($baseTranslations));
|
||||
$translationWriter->addFilter(new EncodedEntities());
|
||||
|
||||
$translations = $translationWriter->getTranslations($language);
|
||||
|
||||
if (empty($translations)) {
|
||||
return; // skip language / plugin combinations that aren't present
|
||||
}
|
||||
|
||||
$translationWriter->setTranslations($translations);
|
||||
|
||||
$this->assertTrue($translationWriter->isValid(), $translationWriter->getValidationMessage());
|
||||
|
||||
if ($translationWriter->wasFiltered()) {
|
||||
|
||||
$translationWriter->saveTemporary();
|
||||
$this->markTestSkipped(implode("\n", $translationWriter->getFilterMessages()) . "\n"
|
||||
. 'Translation file errors detected in ' . $language . "...\n"
|
||||
. "To synchronise the language files with the english strings, you can manually edit the language files or run the following command may work if you have access to Transifex: \n"
|
||||
. "$ ./console translations:update [--plugin=XYZ] \n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* test language when it's not defined
|
||||
*
|
||||
* @group Plugins
|
||||
*
|
||||
* @expectedException Exception
|
||||
*/
|
||||
function testWriterInvalidPlugin()
|
||||
{
|
||||
new Writer('de', 'iNvaLiDPluGin'); // invalid plugin throws exception
|
||||
}
|
||||
|
||||
/**
|
||||
* test language when it's not defined
|
||||
*
|
||||
* @group Plugins
|
||||
*/
|
||||
function testGetTranslationsForLanguagesNot()
|
||||
{
|
||||
$this->assertFalse(API::getInstance()->getTranslationsForLanguage("../no-language"));
|
||||
}
|
||||
|
||||
/**
|
||||
* test English short name for language
|
||||
*
|
||||
* @group Plugins
|
||||
*/
|
||||
function testGetLanguageNamesInEnglish()
|
||||
{
|
||||
$languages = API::getInstance()->getAvailableLanguages();
|
||||
|
||||
/** @var LanguageDataProvider $dataProvider */
|
||||
$dataProvider = StaticContainer::get('Piwik\Intl\Data\Provider\LanguageDataProvider');
|
||||
$languagesReference = $dataProvider->getLanguageList();
|
||||
|
||||
foreach ($languages as $language) {
|
||||
$data = file_get_contents(PIWIK_INCLUDE_PATH . "/plugins/Intl/lang/$language.json");
|
||||
$translations = json_decode($data, true);
|
||||
$name = $translations['Intl']['EnglishLanguageName'];
|
||||
|
||||
if ($language != 'en') {
|
||||
$this->assertFalse($name == 'English', "for $language");
|
||||
}
|
||||
|
||||
$languageCode = substr($language, 0, 2);
|
||||
$this->assertTrue(isset($languagesReference[$languageCode]));
|
||||
$names = $languagesReference[$languageCode];
|
||||
|
||||
if (isset($languagesReference[$language])) {
|
||||
if (is_array($names)) {
|
||||
$this->assertTrue(in_array($name, $names), "$language: failed because $name not a known language name");
|
||||
} else {
|
||||
$this->assertTrue($name == $names, "$language: failed because $name == $names");
|
||||
}
|
||||
} else {
|
||||
if (is_array($names)) {
|
||||
$this->assertTrue(strpos($name, $names[0]) !== false);
|
||||
} else {
|
||||
$this->fail("$language: expected an array of language names");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* test format of DataFile/Languages.php
|
||||
*
|
||||
* @group Plugins
|
||||
*/
|
||||
public function testGetLanguagesList()
|
||||
{
|
||||
/** @var LanguageDataProvider $languageDataProvider */
|
||||
$languageDataProvider = StaticContainer::get('Piwik\Intl\Data\Provider\LanguageDataProvider');
|
||||
|
||||
$languages = $languageDataProvider->getLanguageList();
|
||||
$this->assertTrue(count($languages) > 0);
|
||||
foreach ($languages as $langCode => $langs) {
|
||||
$this->assertTrue(strlen($langCode) == 2, "$langCode length = 2");
|
||||
$this->assertTrue(is_array($langs) && count($langs) >= 1, "$langCode array(names) >= 1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
<?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\LanguagesManager\tests\Integration;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Db;
|
||||
use Piwik\Plugins\LanguagesManager\Model;
|
||||
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
|
||||
|
||||
/**
|
||||
* @group LanguagesManager
|
||||
* @group ModelTest
|
||||
* @group Plugins
|
||||
*/
|
||||
class ModelTest extends IntegrationTestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Model
|
||||
*/
|
||||
protected $model;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->model = new Model();
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function test_install_ShouldNotFailAndActuallyCreateTheDatabases()
|
||||
{
|
||||
$this->assertContainTables(array('user_language'));
|
||||
|
||||
$columns = Db::fetchAll('show columns from ' . Common::prefixTable('user_language'));
|
||||
$this->assertCount(3, $columns);
|
||||
}
|
||||
|
||||
public function test_uninstall_ShouldNotFailAndRemovesAllAlertTables()
|
||||
{
|
||||
Model::uninstall();
|
||||
|
||||
$this->assertNotContainTables(array('user_language'));
|
||||
|
||||
Model::install();
|
||||
}
|
||||
|
||||
public function test_handlesUserLanguageEntriesCorrectly()
|
||||
{
|
||||
$this->model->setLanguageForUser('admin', 'de');
|
||||
|
||||
$this->assertTableEntryCount(1);
|
||||
|
||||
$this->assertEquals('de', $this->model->getLanguageForUser('admin'));
|
||||
|
||||
$this->model->deleteUserLanguage('admin');
|
||||
|
||||
$this->assertTableEntryCount(0);
|
||||
}
|
||||
|
||||
public function test_handlesUserTimeFormatEntriesCorrectly()
|
||||
{
|
||||
$this->model->set12HourClock('admin', false);
|
||||
|
||||
$this->assertTableEntryCount(1);
|
||||
|
||||
$this->assertEquals(false, $this->model->uses12HourClock('admin'));
|
||||
|
||||
$this->model->deleteUserLanguage('admin');
|
||||
|
||||
$this->assertTableEntryCount(0);
|
||||
}
|
||||
|
||||
public function test_handlesUserLanguageAndTimeFormatEntriesCorrectly()
|
||||
{
|
||||
$this->model->setLanguageForUser('admin', 'de');
|
||||
|
||||
$this->assertTableEntryCount(1);
|
||||
|
||||
$this->model->set12HourClock('admin', false);
|
||||
$this->model->set12HourClock('user', true);
|
||||
|
||||
$this->assertTableEntryCount(2);
|
||||
|
||||
$this->assertEquals('de', $this->model->getLanguageForUser('admin'));
|
||||
$this->assertEquals('', $this->model->getLanguageForUser('user'));
|
||||
$this->assertEquals(false, $this->model->uses12HourClock('admin'));
|
||||
$this->assertEquals(true, $this->model->uses12HourClock('user'));
|
||||
|
||||
$this->model->deleteUserLanguage('admin');
|
||||
|
||||
$this->assertTableEntryCount(1);
|
||||
}
|
||||
|
||||
private function assertTableEntryCount($count)
|
||||
{
|
||||
$entryCount = Db::fetchOne('SELECT COUNT(*) FROM ' . Common::prefixTable('user_language'));
|
||||
|
||||
$this->assertEquals($count, $entryCount);
|
||||
|
||||
}
|
||||
|
||||
private function assertContainTables($expectedTables)
|
||||
{
|
||||
$tableNames = $this->getCurrentAvailableTableNames();
|
||||
|
||||
foreach ($expectedTables as $expectedTable) {
|
||||
$this->assertContains(Common::prefixTable($expectedTable), $tableNames);
|
||||
}
|
||||
}
|
||||
|
||||
private function assertNotContainTables($expectedTables)
|
||||
{
|
||||
$tableNames = $this->getCurrentAvailableTableNames();
|
||||
|
||||
foreach ($expectedTables as $expectedTable) {
|
||||
$this->assertNotContains(Common::prefixTable($expectedTable), $tableNames);
|
||||
}
|
||||
}
|
||||
|
||||
private function getCurrentAvailableTableNames()
|
||||
{
|
||||
$tables = Db::fetchAll('show tables');
|
||||
|
||||
$tableNames = array();
|
||||
foreach ($tables as $table) {
|
||||
$tableNames[] = array_shift($table);
|
||||
}
|
||||
|
||||
return $tableNames;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,162 @@
|
|||
<?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\LanguagesManager\Test\Unit\TranslationWriter\Filter;
|
||||
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Filter\ByBaseTranslations;
|
||||
|
||||
/**
|
||||
* @group LanguagesManager
|
||||
*/
|
||||
class ByBaseTranslationsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function getFilterTestData()
|
||||
{
|
||||
return array(
|
||||
// empty stays empty
|
||||
array(
|
||||
array(),
|
||||
array(),
|
||||
array(),
|
||||
array()
|
||||
),
|
||||
// empty plugin is removed
|
||||
array(
|
||||
array(
|
||||
'test' => array()
|
||||
),
|
||||
array(),
|
||||
array(),
|
||||
array(
|
||||
'test' => array()
|
||||
),
|
||||
),
|
||||
// not existing values/plugins are removed
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'key' => 'value',
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'key' => 'value',
|
||||
'x' => 'y'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'key' => 'value',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'test',
|
||||
)
|
||||
),
|
||||
),
|
||||
// no change if all exist
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
array()
|
||||
),
|
||||
// unavailable removed, others stay
|
||||
array(
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 'test'
|
||||
),
|
||||
'test' => array(
|
||||
'test' => 'test',
|
||||
'empty' => ' ',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 'test'
|
||||
),
|
||||
'test' => array(
|
||||
'test' => 'test',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 'test'
|
||||
),
|
||||
'test' => array(
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'empty' => ' ',
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 'test'
|
||||
),
|
||||
'test' => array(
|
||||
'test' => 'test',
|
||||
'empty' => ' ',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'bla' => 'test'
|
||||
),
|
||||
'test' => array(
|
||||
'test' => 'test',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 'test'
|
||||
),
|
||||
'test' => array(
|
||||
'empty' => ' ',
|
||||
)
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getFilterTestData
|
||||
* @group Core
|
||||
*/
|
||||
public function testFilter($translations, $baseTranslations, $expected, $filteredData)
|
||||
{
|
||||
$filter = new ByBaseTranslations($baseTranslations);
|
||||
$result = $filter->filter($translations);
|
||||
$this->assertEquals($expected, $result);
|
||||
$this->assertEquals($filteredData, $filter->getFilteredData());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
<?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\LanguagesManager\Test\Unit\TranslationWriter\Filter;
|
||||
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Filter\ByParameterCount;
|
||||
|
||||
/**
|
||||
* @group LanguagesManager
|
||||
*/
|
||||
class ByParameterCountTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function getFilterTestData()
|
||||
{
|
||||
return array(
|
||||
// empty stays empty - nothing to filter
|
||||
array(
|
||||
array(),
|
||||
array(),
|
||||
array(),
|
||||
array()
|
||||
),
|
||||
// empty plugin is removed
|
||||
array(
|
||||
array(
|
||||
'test' => array()
|
||||
),
|
||||
array(),
|
||||
array(),
|
||||
array(),
|
||||
),
|
||||
// value with %s will be removed, as it isn't there in base
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'key' => 'val%sue',
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'key' => 'value',
|
||||
)
|
||||
),
|
||||
array(),
|
||||
array(
|
||||
'test' => array(
|
||||
'key' => 'val%sue',
|
||||
)
|
||||
),
|
||||
),
|
||||
// no change if placeholder count is the same
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'te%sst'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'test%s'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'te%sst'
|
||||
)
|
||||
),
|
||||
array()
|
||||
),
|
||||
// missing placeholder will be removed
|
||||
array(
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 't%1$sest'
|
||||
),
|
||||
'test' => array(
|
||||
'test' => '%1$stest',
|
||||
'empty' => ' ',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 'test%1$s'
|
||||
),
|
||||
'test' => array(
|
||||
'test' => '%1$stest%2$s',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 't%1$sest'
|
||||
),
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => '%1$stest',
|
||||
)
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getFilterTestData
|
||||
* @group Core
|
||||
*/
|
||||
public function testFilter($translations, $baseTranslations, $expected, $filteredData)
|
||||
{
|
||||
$filter = new ByParameterCount($baseTranslations);
|
||||
$result = $filter->filter($translations);
|
||||
$message = sprintf("got %s but expected %s", var_export($result, true), var_export($expected, true));
|
||||
$this->assertEquals($expected, $result, $message);
|
||||
$this->assertEquals($filteredData, $filter->getFilteredData());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
<?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\LanguagesManager\Test\Unit\TranslationWriter\Filter;
|
||||
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Filter\EmptyTranslations;
|
||||
|
||||
/**
|
||||
* @group LanguagesManager
|
||||
*/
|
||||
class EmptyTranslationsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function getFilterTestData()
|
||||
{
|
||||
return array(
|
||||
// empty stays empty
|
||||
array(
|
||||
array(),
|
||||
array(),
|
||||
array()
|
||||
),
|
||||
// empty plugin is removed
|
||||
array(
|
||||
array(
|
||||
'test' => array()
|
||||
),
|
||||
array(),
|
||||
array(),
|
||||
),
|
||||
// empty values/plugins are removed
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'empty' => '',
|
||||
'whitespace' => ' '
|
||||
)
|
||||
),
|
||||
array(),
|
||||
array(
|
||||
'test' => array(
|
||||
'empty' => '',
|
||||
'whitespace' => ' '
|
||||
)
|
||||
),
|
||||
),
|
||||
// no change if no empty value
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
array()
|
||||
),
|
||||
// empty values are removed, others stay
|
||||
array(
|
||||
array(
|
||||
'empty' => array(),
|
||||
'test' => array(
|
||||
'test' => 'test',
|
||||
'empty' => ' ',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'empty' => ' ',
|
||||
)
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getFilterTestData
|
||||
* @group Core
|
||||
*/
|
||||
public function testFilter($translations, $expected, $filteredData)
|
||||
{
|
||||
$filter = new EmptyTranslations();
|
||||
$result = $filter->filter($translations);
|
||||
$this->assertEquals($expected, $result);
|
||||
$this->assertEquals($filteredData, $filter->getFilteredData());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
<?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\LanguagesManager\Test\Unit\TranslationWriter\Filter;
|
||||
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Filter\EncodedEntities;
|
||||
|
||||
/**
|
||||
* @group LanguagesManager
|
||||
*/
|
||||
class EncodedEntitiesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function getFilterTestData()
|
||||
{
|
||||
return array(
|
||||
// empty stays empty - nothing to filter
|
||||
array(
|
||||
array(),
|
||||
array(),
|
||||
array()
|
||||
),
|
||||
// empty plugin is removed
|
||||
array(
|
||||
array(
|
||||
'test' => array()
|
||||
),
|
||||
array(
|
||||
'test' => array()
|
||||
),
|
||||
array(),
|
||||
),
|
||||
// no entites - nothing to filter
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'key' => 'val%sue',
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'key' => 'val%sue',
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
array(),
|
||||
),
|
||||
// entities needs to be decodded
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'te&st'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'te&st'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'te&st'
|
||||
)
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 'tüsest'
|
||||
),
|
||||
'test' => array(
|
||||
'test' => '%1$stest',
|
||||
'empty' => '˜',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 'tüsest'
|
||||
),
|
||||
'test' => array(
|
||||
'test' => '%1$stest',
|
||||
'empty' => '˜',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 'tüsest'
|
||||
),
|
||||
'test' => array(
|
||||
'empty' => '˜',
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getFilterTestData
|
||||
* @group Core
|
||||
*/
|
||||
public function testFilter($translations, $expected, $filteredData)
|
||||
{
|
||||
$filter = new EncodedEntities();
|
||||
$result = $filter->filter($translations);
|
||||
$this->assertEquals($expected, $result);
|
||||
$this->assertEquals($filteredData, $filter->getFilteredData());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
<?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\LanguagesManager\Test\Unit\TranslationWriter\Filter;
|
||||
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Filter\UnnecassaryWhitespaces;
|
||||
|
||||
/**
|
||||
* @group LanguagesManager
|
||||
*/
|
||||
class UnnecassaryWhitepsacesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function getFilterTestData()
|
||||
{
|
||||
return array(
|
||||
// empty stays empty - nothing to filter
|
||||
array(
|
||||
array(),
|
||||
array(),
|
||||
array(),
|
||||
array()
|
||||
),
|
||||
// no entites - nothing to filter
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'key' => "val\n\n\r\n\nue",
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'key' => "base val\n\nue",
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'key' => "val\n\nue",
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'key' => "val\n\n\r\n\nue",
|
||||
)
|
||||
|
||||
),
|
||||
),
|
||||
// entities needs to be decodded
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'test palim'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'no line breaks'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'test palim'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'test palim'
|
||||
)
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => "test\n\n\ntest"
|
||||
),
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 'no line break'
|
||||
),
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 'test test'
|
||||
),
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => "test\n\n\ntest"
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => "test\n \n\n test"
|
||||
),
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 'no line break'
|
||||
),
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 'test test'
|
||||
),
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => "test\n \n\n test"
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => "test\n \n\n test"
|
||||
),
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => "line\n break"
|
||||
),
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => "test\n\ntest"
|
||||
),
|
||||
),
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => "test\n \n\n test"
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getFilterTestData
|
||||
* @group Core
|
||||
*/
|
||||
public function testFilter($translations, $baseTranslations, $expected, $filteredData)
|
||||
{
|
||||
$filter = new UnnecassaryWhitespaces($baseTranslations);
|
||||
$result = $filter->filter($translations);
|
||||
$this->assertEquals($expected, $result);
|
||||
$this->assertEquals($filteredData, $filter->getFilteredData());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
<?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\LanguagesManager\Test\Unit\TranslationWriter\Validate;
|
||||
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Validate\CoreTranslations;
|
||||
|
||||
/**
|
||||
* @group LanguagesManager
|
||||
*/
|
||||
class CoreTranslationsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function getFilterTestDataValid()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
array(
|
||||
'General' => array_merge(array_fill(0, 251, 'test'), array(
|
||||
'Locale' => 'de_DE.UTF-8',
|
||||
'TranslatorName' => 'name'
|
||||
)
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getFilterTestDataValid
|
||||
* @group Core
|
||||
*/
|
||||
public function testFilterValid($translations)
|
||||
{
|
||||
$filter = new CoreTranslations();
|
||||
$result = $filter->isValid($translations);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function getFilterTestDataInvalid()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
array(
|
||||
'General' => array(
|
||||
'bla' => 'test text'
|
||||
)
|
||||
),
|
||||
CoreTranslations::ERRORSTATE_LOCALEREQUIRED
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'General' => array(
|
||||
'Locale' => 'de_DE.UTF-8'
|
||||
)
|
||||
),
|
||||
CoreTranslations::ERRORSTATE_TRANSLATORINFOREQUIRED
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'General' => array(
|
||||
'Locale' => 'invalid',
|
||||
'TranslatorName' => 'name'
|
||||
)
|
||||
),
|
||||
CoreTranslations::ERRORSTATE_LOCALEINVALID
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'General' => array(
|
||||
'Locale' => 'xx_DE.UTF-8',
|
||||
'TranslatorName' => 'name'
|
||||
)
|
||||
),
|
||||
CoreTranslations::ERRORSTATE_LOCALEINVALIDLANGUAGE
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'General' => array(
|
||||
'Locale' => 'de_XX.UTF-8',
|
||||
'TranslatorName' => 'name'
|
||||
)
|
||||
),
|
||||
CoreTranslations::ERRORSTATE_LOCALEINVALIDCOUNTRY
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getFilterTestDataInvalid
|
||||
* @group Core
|
||||
*/
|
||||
public function testFilterInvalid($translations, $msg)
|
||||
{
|
||||
$filter = new CoreTranslations();
|
||||
$result = $filter->isValid($translations);
|
||||
$this->assertFalse($result);
|
||||
$this->assertEquals($msg, $filter->getMessage());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
<?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\LanguagesManager\Test\Unit\TranslationWriter\Validate;
|
||||
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Validate\NoScripts;
|
||||
|
||||
/**
|
||||
* @group LanguagesManager
|
||||
*/
|
||||
class NoScriptsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function getFilterTestDataValid()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
array(),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'test' => array()
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'key' => 'val%sue',
|
||||
'test' => 'test'
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getFilterTestDataValid
|
||||
* @group Core
|
||||
*/
|
||||
public function testFilterValid($translations)
|
||||
{
|
||||
$filter = new NoScripts();
|
||||
$result = $filter->isValid($translations);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function getFilterTestDataInvalid()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'test text <script'
|
||||
)
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'empty' => array(
|
||||
'test' => 'tüsest'
|
||||
),
|
||||
'test' => array(
|
||||
'test' => 'bla <a href="javascript:alert();"> link </a>',
|
||||
'empty' => '˜',
|
||||
)
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'bla <a onload="alert(\'test\');">link</a>'
|
||||
)
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'no <img src="test" />'
|
||||
)
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'that will fail on document. or not?'
|
||||
)
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'test' => array(
|
||||
'test' => 'bla <a background="yellow">link</a>'
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getFilterTestDataInvalid
|
||||
* @group Core
|
||||
*/
|
||||
public function testFilterInvalid($translations)
|
||||
{
|
||||
$filter = new NoScripts();
|
||||
$result = $filter->isValid($translations);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,267 @@
|
|||
<?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\LanguagesManager\Test\Unit\TranslationWriter;
|
||||
|
||||
use Piwik\Container\StaticContainer;
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Filter\ByBaseTranslations;
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Filter\ByParameterCount;
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Filter\UnnecassaryWhitespaces;
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Validate\CoreTranslations;
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Validate\NoScripts;
|
||||
use Piwik\Plugins\LanguagesManager\TranslationWriter\Writer;
|
||||
|
||||
/**
|
||||
* @group LanguagesManager
|
||||
*/
|
||||
class WriterTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @group Core
|
||||
*
|
||||
* @dataProvider getValidConstructorData
|
||||
*/
|
||||
public function testConstructorValid($language, $plugin)
|
||||
{
|
||||
$translationWriter = new Writer($language, $plugin);
|
||||
$this->assertEquals($language, $translationWriter->getLanguage());
|
||||
$this->assertFalse($translationWriter->hasTranslations());
|
||||
}
|
||||
|
||||
public function getValidConstructorData()
|
||||
{
|
||||
return array(
|
||||
array('en', ''),
|
||||
array('de', ''),
|
||||
array('en', 'ExamplePlugin'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group Core
|
||||
*
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testConstructorInvalid()
|
||||
{
|
||||
new Writer('en', 'InValIdPlUGin');
|
||||
}
|
||||
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
public function testHasTranslations()
|
||||
{
|
||||
$writer = new Writer('de');
|
||||
$writer->setTranslations(array('General' => array('test' => 'test')));
|
||||
$this->assertTrue($writer->hasTranslations());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
public function testHasNoTranslations()
|
||||
{
|
||||
$writer = new Writer('de');
|
||||
$this->assertFalse($writer->hasTranslations());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
public function testSetTranslationsEmpty()
|
||||
{
|
||||
$writer = new Writer('de');
|
||||
$writer->setTranslations(array());
|
||||
$this->assertTrue($writer->isValid());
|
||||
$this->assertFalse($writer->hasTranslations());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group Core
|
||||
*
|
||||
* @dataProvider getInvalidTranslations
|
||||
*/
|
||||
public function testSetTranslationsInvalid($translations, $error)
|
||||
{
|
||||
$writer = new Writer('de');
|
||||
$writer->setTranslations($translations);
|
||||
$writer->addValidator(new NoScripts());
|
||||
$writer->addValidator(new CoreTranslations());
|
||||
$this->assertFalse($writer->isValid());
|
||||
$this->assertEquals($error, $writer->getValidationMessage());
|
||||
}
|
||||
|
||||
public function getInvalidTranslations()
|
||||
{
|
||||
$translations = json_decode(file_get_contents(PIWIK_INCLUDE_PATH.'/lang/de.json'), true);
|
||||
return array(
|
||||
array(array('General' => array('Locale' => '')) + $translations, CoreTranslations::ERRORSTATE_LOCALEREQUIRED),
|
||||
array(array('General' => array('Locale' => 'de_DE.UTF-8')) + $translations, CoreTranslations::ERRORSTATE_TRANSLATORINFOREQUIRED),
|
||||
array(array('General' => array('Locale' => 'invalid',
|
||||
'TranslatorName' => 'name')) + $translations, CoreTranslations::ERRORSTATE_LOCALEINVALID),
|
||||
array(array('General' => array('Locale' => 'xx_DE.UTF-8',
|
||||
'TranslatorName' => 'name')) + $translations, CoreTranslations::ERRORSTATE_LOCALEINVALIDLANGUAGE),
|
||||
array(array('General' => array('Locale' => 'de_XX.UTF-8',
|
||||
'TranslatorName' => 'name')) + $translations, CoreTranslations::ERRORSTATE_LOCALEINVALIDCOUNTRY),
|
||||
array(array('General' => array('Locale' => '<script>')) + $translations, 'script tags restricted for language files'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group Core
|
||||
*
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testSaveException()
|
||||
{
|
||||
$writer = new Writer('it');
|
||||
$writer->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @group Core
|
||||
*
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testSaveTemporaryException()
|
||||
{
|
||||
$writer = new Writer('it');
|
||||
$writer->saveTemporary();
|
||||
}
|
||||
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
public function testSaveTranslation()
|
||||
{
|
||||
$translations = json_decode(file_get_contents(PIWIK_INCLUDE_PATH.'/lang/en.json'), true);
|
||||
|
||||
$translationsToWrite = array();
|
||||
$translationsToWrite['General'] = $translations['General'];
|
||||
$translationsToWrite['Mobile'] = $translations['Mobile'];
|
||||
|
||||
$translationsToWrite['General']['Yes'] = 'string with %1$s';
|
||||
$translationsToWrite['Plugin'] = array(
|
||||
'Body' => "Message\nBody"
|
||||
);
|
||||
|
||||
$translationWriter = new Writer('fr');
|
||||
|
||||
$translationWriter->addFilter(new UnnecassaryWhitespaces($translations));
|
||||
$translationWriter->addFilter(new ByBaseTranslations($translations));
|
||||
$translationWriter->addFilter(new ByParameterCount($translations));
|
||||
|
||||
$translationWriter->setTranslations($translationsToWrite);
|
||||
|
||||
$rc = $translationWriter->saveTemporary();
|
||||
|
||||
@unlink(PIWIK_INCLUDE_PATH.'/tmp/fr.json');
|
||||
|
||||
$this->assertGreaterThan(25000, $rc);
|
||||
|
||||
$this->assertCount(4, $translationWriter->getFilterMessages());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group Core
|
||||
*
|
||||
* @dataProvider getTranslationPathTestData
|
||||
*/
|
||||
public function testGetTranslationsPath($language, $plugin, $path)
|
||||
{
|
||||
$writer = new Writer($language, $plugin);
|
||||
$this->assertEquals($path, $writer->getTranslationPath());
|
||||
}
|
||||
|
||||
public function getTranslationPathTestData()
|
||||
{
|
||||
return array(
|
||||
array('de', null, PIWIK_INCLUDE_PATH . '/lang/de.json'),
|
||||
array('te', null, PIWIK_INCLUDE_PATH . '/lang/te.json'),
|
||||
array('de', 'CoreHome', PIWIK_INCLUDE_PATH . '/plugins/CoreHome/lang/de.json'),
|
||||
array('pt-br', 'Actions', PIWIK_INCLUDE_PATH . '/plugins/Actions/lang/pt-br.json'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group Core
|
||||
*
|
||||
* @dataProvider getTranslationPathTemporaryTestData
|
||||
*/
|
||||
public function testGetTemporaryTranslationPath($language, $plugin, $path)
|
||||
{
|
||||
$writer = new Writer($language, $plugin);
|
||||
$this->assertEquals($path, $writer->getTemporaryTranslationPath());
|
||||
}
|
||||
|
||||
public function getTranslationPathTemporaryTestData()
|
||||
{
|
||||
$tmpPath = StaticContainer::get('path.tmp');
|
||||
|
||||
return array(
|
||||
array('de', null, $tmpPath . '/de.json'),
|
||||
array('te', null, $tmpPath . '/te.json'),
|
||||
array('de', 'CoreHome', $tmpPath . '/plugins/CoreHome/lang/de.json'),
|
||||
array('pt-br', 'Actions', $tmpPath . '/plugins/Actions/lang/pt-br.json'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group Core
|
||||
*
|
||||
* @dataProvider getValidLanguages
|
||||
*/
|
||||
public function testSetLanguageValid($language)
|
||||
{
|
||||
$writer = new Writer('en', null);
|
||||
$writer->setLanguage($language);
|
||||
$this->assertEquals(strtolower($language), $writer->getLanguage());
|
||||
}
|
||||
|
||||
public function getValidLanguages()
|
||||
{
|
||||
return array(
|
||||
array('de'),
|
||||
array('te'),
|
||||
array('pt-br'),
|
||||
array('tzm'),
|
||||
array('abc'),
|
||||
array('de-de'),
|
||||
array('DE'),
|
||||
array('DE-DE'),
|
||||
array('DE-de'),
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @group Core
|
||||
*
|
||||
* @expectedException \Exception
|
||||
* @dataProvider getInvalidLanguages
|
||||
*/
|
||||
public function testSetLanguageInvalid($language)
|
||||
{
|
||||
$writer = new Writer('en', null);
|
||||
$writer->setLanguage($language);
|
||||
}
|
||||
|
||||
public function getInvalidLanguages()
|
||||
{
|
||||
return array(
|
||||
array(''),
|
||||
array('abcd'),
|
||||
array('pt-brfr'),
|
||||
array('00'),
|
||||
array('a-b'),
|
||||
array('x3'),
|
||||
array('X4-fd'),
|
||||
array('12-34'),
|
||||
array('$§'),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue