updated contrib modules : migrate_tools, migrate_plus, piwik -> matomo, color_field, config_filter, admin_toolbar

This commit is contained in:
2018-09-12 14:41:53 +02:00
parent b01aa458f8
commit 4caa864a8f
176 changed files with 8874 additions and 1500 deletions
@@ -0,0 +1,11 @@
name: 'Matomo test'
type: module
description: 'Support module for Matomo testing.'
package: Testing
# core: 8.x
# Information added by Drupal.org packaging script on 2018-07-13
version: '8.x-1.7'
core: '8.x'
project: 'matomo'
datestamp: 1531470224
@@ -0,0 +1,7 @@
matomo_test.drupal_messenger_add_message:
path: '/matomo-test/drupal-messenger-add-message'
defaults:
_title: 'Add messages with Drupal::messenger()'
_controller: '\Drupal\matomo_test\Controller\MatomoTestController::drupalAddMessageTest'
requirements:
_access: 'TRUE'
@@ -0,0 +1,28 @@
<?php
namespace Drupal\matomo_test\Controller;
use Drupal\Core\Controller\ControllerBase;
/**
* Controller routines for system_test routes.
*/
class MatomoTestController extends ControllerBase {
/**
* Tests setting messages and removing one before it is displayed.
*
* @return array
* Empty array, we just test the setting of messages.
*/
public function drupalAddMessageTest() {
// Set some messages.
drupal_set_message($this->t('Example status message.'), 'status');
drupal_set_message($this->t('Example warning message.'), 'warning');
drupal_set_message($this->t('Example error message.'), 'error');
drupal_set_message($this->t('Example error <em>message</em> with html tags and <a href="http://example.com/">link</a>.'), 'error');
return [];
}
}
@@ -0,0 +1,103 @@
<?php
namespace Drupal\Tests\matomo\Functional;
use Drupal\Tests\BrowserTestBase;
/**
* Tests the configuration form.
*
* @group matomo
*/
class AdminSettingsFormTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['matomo'];
/**
* A test administrator.
*
* @var \Drupal\user\Entity\User
*/
protected $adminUser;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$permissions = [
'access administration pages',
'administer matomo',
];
$this->adminUser = $this->drupalCreateUser($permissions);
$this->drupalLogin($this->adminUser);
}
/**
* Tests the fields that allow to configure tracking of specific pages.
*
* @param string $pages
* A list of pages that should be tracked. One page per line.
* @param bool $validation_error_expected
* TRUE if a validation error should be thrown. FALSE otherwise.
*
* @dataProvider pageTrackingProvider
*/
public function testPageTracking($pages, $validation_error_expected) {
$edit = [
'matomo_visibility_request_path_mode' => 0,
'matomo_visibility_request_path_pages' => $pages,
];
$this->drupalPostForm('admin/config/system/matomo', $edit, t('Save configuration'));
$has_validation_error = (bool) $this->getSession()->getPage()->find('css', '#edit-matomo-visibility-request-path-pages.error');
$this->assertEquals($validation_error_expected, $has_validation_error);
}
/**
* Provides test data for ::testPageTracking().
*
* @return array
* An array of test cases, each test case is an array with two values:
* 0. A string containing a list of pages to track.
* 1. A boolean indicating whether or not a validation error is expected to
* be thrown.
*/
public function pageTrackingProvider() {
return [
[
// No validation error should be thrown for an empty page list.
'',
FALSE,
],
[
// No validation error should be thrown for a list of valid pages.
<<<TXT
/node/1
/blog/*/view
/shop
<front>
TXT
,
FALSE,
],
[
// A validation error should be thrown if one of the pages doesn't start
// with a slash.
<<<TXT
/node/1
/blog/*/view
shop
<front>
TXT
,
TRUE,
],
];
}
}