Skip to content
Snippets Groups Projects
Commit b2a41059 authored by Antonio De Marco's avatar Antonio De Marco
Browse files

Issue #128: Setup project with Drupal Component Scaffold.

parent 1ae71f52
No related branches found
No related tags found
No related merge requests found
Showing with 106 additions and 107 deletions
vendor
behat.yml
tests/drupal
composer.lock
docs/_build
build/
phpunit.xml
behat.yml
\ No newline at end of file
......@@ -13,8 +13,6 @@ env:
install:
- composer self-update
- composer install --prefer-dist
- ./vendor/bin/phpcs --config-set installed_paths ../../drupal/coder/coder_sniffer
- ./vendor/bin/phpcs --config-set show_progress 1
before_script:
# Start PhantomJS server.
......@@ -24,21 +22,16 @@ before_script:
# Create database.
- mysql -e 'create database drupal'
# Install Drupal 8 target site.
- cd tests
- composer install --prefer-dist
- ./vendor/bin/drush si standard -y --db-url=mysql://travis:@127.0.0.1/drupal
# Test latest commit on current branch.
- git clone --branch=$TRAVIS_BRANCH https://github.com/$TRAVIS_REPO_SLUG.git modules/ui_patterns
- ./vendor/bin/drush en ui_patterns_test -y
- cd build
- ../vendor/bin/drush si standard -y --db-url=mysql://travis:@127.0.0.1/drupal
- ../vendor/bin/drush en ui_patterns_test -y
# Run Drush web server.
- ./vendor/bin/drush --debug runserver :8888 > ~/debug.txt 2>&1 &
- ../vendor/bin/drush --debug runserver :8888 > ~/debug.txt 2>&1 &
- sleep 4s
- chmod -R ug+w sites
script:
- cd $TRAVIS_BUILD_DIR
- composer phpcs
- cd tests
- ./vendor/bin/grumphp run
- ./vendor/bin/phpunit
- ./vendor/bin/behat
......
default:
autoload:
- %paths.base%/modules/ui_patterns/tests/features/bootstrap
- "%paths.base%/tests/features/bootstrap"
suites:
default:
paths:
- %paths.base%/modules/ui_patterns/tests/features
- "%paths.base%/tests/features"
contexts:
- Drupal\DrupalExtension\Context\ConfigContext
- Drupal\DrupalExtension\Context\MinkContext
- Drupal\DrupalExtension\Context\MarkupContext
- Drupal\DrupalExtension\Context\MessageContext
- Drupal\DrupalExtension\Context\DrupalContext
- NuvoleWeb\Drupal\DrupalExtension\Context\DrupalContext
- NuvoleWeb\Drupal\DrupalExtension\Context\SelectFieldContext
- NuvoleWeb\Drupal\DrupalExtension\Context\VisibilityContext
- NuvoleWeb\Drupal\DrupalExtension\Context\ContentContext
- FeatureContext
- "Drupal\DrupalExtension\Context\ConfigContext"
- "Drupal\DrupalExtension\Context\MinkContext"
- "Drupal\DrupalExtension\Context\MarkupContext"
- "Drupal\DrupalExtension\Context\MessageContext"
- "Drupal\DrupalExtension\Context\DrupalContext"
- "NuvoleWeb\Drupal\DrupalExtension\Context\DrupalContext"
- "NuvoleWeb\Drupal\DrupalExtension\Context\SelectFieldContext"
- "NuvoleWeb\Drupal\DrupalExtension\Context\VisibilityContext"
- "NuvoleWeb\Drupal\DrupalExtension\Context\ContentContext"
- "FeatureContext"
extensions:
Behat\MinkExtension:
goutte: ~
......@@ -26,7 +26,7 @@ default:
api_driver: "drupal"
drupal:
# Change this to the absolute path to Drupal install.
drupal_root: "."
drupal_root: "build"
region_map:
left sidebar: "#sidebar-first"
content: "#content"
......
......@@ -3,31 +3,47 @@
"type": "drupal-module",
"description": "UI Patterns.",
"keywords": ["drupal", "web", "ui"],
"minimum-stability": "stable",
"minimum-stability": "dev",
"license": "GPL-2.0+",
"prefer-stable": true,
"authors": [
{
"name": "Nuvole Web",
"email": "info@nuvole.org"
}
],
"prefer-stable": true,
"require-dev": {
"squizlabs/php_codesniffer": "2.8.0",
"nuvoleweb/drupal-component-scaffold": "*",
"drupal/config_installer": "1.3.0",
"drupal/core": "~8",
"drupal/console": "0.11.3",
"drush/drush": "~8.0",
"drupal/ds": "~3",
"drupal/field_group": "~1",
"drupal/coffee": "~1",
"drupal/panels": "~4",
"drupal/features": "~3",
"drupal/page_manager": "*",
"drupal/paragraphs": "~1",
"drupal/token": "~1",
"drupal/bootstrap": "3.1",
"phpunit/phpunit": "5.5.*",
"bovigo/assert": "~1.7",
"nuvoleweb/drupal-behat": "1.0.2",
"mikey179/vfsStream": "*",
"bex/behat-screenshot": "^1.2",
"bex/behat-screenshot-image-driver-img42": "^1.0",
"bex/behat-extension-driver-locator": "^1.0",
"phpro/grumphp": "^0.12.0",
"drupal/coder": "8.2.8"
},
"scripts": {
"post-install-cmd": [
"./vendor/bin/phpcs --config-set installed_paths ../../drupal/coder/coder_sniffer",
"./vendor/bin/phpcs --config-set show_progress 1",
"cp ./tests/scripts/pre-push.sh .git/hooks/pre-push && chmod +x .git/hooks/pre-push"
],
"post-update-cmd": [
"./vendor/bin/phpcs --config-set installed_paths ../../drupal/coder/coder_sniffer",
"./vendor/bin/phpcs --config-set show_progress 1",
"cp ./tests/scripts/pre-push.sh .git/hooks/pre-push && chmod +x .git/hooks/pre-push"
],
"phpcs": "./vendor/bin/phpcs --standard=Drupal,DrupalPractice ./src ./tests/src ./modules --ignore=./modules/ui_patterns_test",
"phpcbf": "./vendor/bin/phpcbf --standard=Drupal,DrupalPractice ./src ./tests/src ./modules --ignore=./modules/ui_patterns_test"
}
"conflict": {
"drupal/drupal": "*"
},
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
]
}
parameters:
ascii:
failed: ~
succeeded: ~
tasks:
phpcs:
standard: vendor/drupal/coder/coder_sniffer/Drupal/
ignore_patterns:
- build/
- vendor/
- tests/
- ui_patterns/modules/ui_patterns_test/
triggered_by:
- php
- module
- install
- inc
- theme
......@@ -41,7 +41,7 @@ function ui_patterns_ds_field_overview_submit($form, FormStateInterface $form_st
$entity_form = $form_state->getFormObject();
$display = $entity_form->getEntity();
$components = array_filter($display->getComponents(), function($component) {
$components = array_filter($display->getComponents(), function ($component) {
return isset($component['third_party_settings']['ds']['ft']['settings']['pattern']);
});
......@@ -56,10 +56,10 @@ function ui_patterns_ds_field_overview_submit($form, FormStateInterface $form_st
/**
* Preprocess hook.
*
* @param $variables
* @param array $variables
* Theme variables.
*/
function template_preprocess_field__pattern_ds_field_template(&$variables) {
function template_preprocess_field__pattern_ds_field_template(array &$variables) {
\Drupal::service('ui_patterns_ds.field_template_processor')->process($variables);
}
......
......@@ -79,10 +79,10 @@ function ui_patterns_field_group_ui_patterns_destination_suggestions_alter(array
$pattern = $context->getProperty('pattern');
$field = $context->getProperty('field');
$suggestions[] = $hook . '__field_group__' . $group_name . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__field_group__' . $group_name . '__' . $entity_type . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__field_group__' . $group_name . '__' . $entity_type . '__' . $bundle . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__field_group__' . $group_name . '__' . $entity_type . '__' . $view_mode . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__field_group__' . $group_name . '__' . $entity_type . '__' . $bundle . '__' . $view_mode . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__field_group__' . $group_name . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__field_group__' . $group_name . '__' . $entity_type . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__field_group__' . $group_name . '__' . $entity_type . '__' . $bundle . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__field_group__' . $group_name . '__' . $entity_type . '__' . $view_mode . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__field_group__' . $group_name . '__' . $entity_type . '__' . $bundle . '__' . $view_mode . '__' . $pattern . '__' . $field;
}
}
......@@ -20,5 +20,3 @@ function ui_patterns_layouts_update_8101() {
$installer->install(['layout_discovery']);
}
}
......@@ -85,11 +85,11 @@ function ui_patterns_layouts_ui_patterns_destination_suggestions_alter(array &$s
$pattern = $context->getProperty('pattern');
$field = $context->getProperty('field');
$suggestions[] = $hook . '__layout__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__layout__' . $entity_type . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__layout__' . $entity_type . '__' . $bundle . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__layout__' . $entity_type . '__' . $view_mode . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__layout__' . $entity_type . '__' . $bundle . '__' . $view_mode . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__layout__' . $entity_type . '__' . $entity_id . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__layout__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__layout__' . $entity_type . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__layout__' . $entity_type . '__' . $bundle . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__layout__' . $entity_type . '__' . $view_mode . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__layout__' . $entity_type . '__' . $bundle . '__' . $view_mode . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__layout__' . $entity_type . '__' . $entity_id . '__' . $pattern . '__' . $field;
}
}
......@@ -21,10 +21,10 @@ function ui_patterns_views_theme() {
/**
* Preprocess hook.
*
* @param $variables
* @param array $variables
* Theme variables.
*/
function template_preprocess_pattern_views_row(&$variables) {
function template_preprocess_pattern_views_row(array &$variables) {
/** @var \Drupal\views\ResultRow $row */
/** @var \Drupal\views\ViewExecutable $view */
/** @var \Drupal\ui_patterns_views\Plugin\views\row\Pattern $row_plugin */
......@@ -90,7 +90,7 @@ function ui_patterns_views_ui_patterns_destination_suggestions_alter(array &$sug
$pattern = $context->getProperty('pattern');
$field = $context->getProperty('field');
$suggestions[] = $hook . '__views_row__' . $view_name . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__views_row__' . $view_name . '__' . $display . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__views_row__' . $view_name . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__views_row__' . $view_name . '__' . $display . '__' . $pattern . '__' . $field;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="core/tests/bootstrap.php" backupGlobals="false" colors="true" >
<phpunit bootstrap="build/core/tests/bootstrap.php" backupGlobals="false" colors="true" >
<php>
<ini name="error_reporting" value="32767"/>
<ini name="memory_limit" value="-1"/>
......@@ -7,10 +7,10 @@
</php>
<testsuites>
<testsuite name="unit">
<directory>./modules/ui_patterns/tests/</directory>
<directory>./tests/</directory>
</testsuite>
<testsuite name="kernel">
<directory>./modules/ui_patterns/tests/</directory>
<directory>./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
{
"name": "nuvoleweb/ui-patterns-test-site",
"description": "UI Patterns test site.",
"type": "project",
"require": {
"composer/installers": "^1.2",
"drupal-composer/drupal-scaffold": "^2.2",
"drupal/config_installer": "1.3.0",
"drupal/core": "~8",
"drupal/console": "0.11.3",
"drush/drush": "~8.0",
"drupal/ds": "~3",
"drupal/field_group": "~1",
"drupal/coffee": "~1",
"drupal/panels": "~4",
"drupal/features": "~3",
"drupal/page_manager": "*",
"drupal/paragraphs": "~1",
"drupal/token": "~1",
"drupal/bootstrap": "3.1",
"phpunit/phpunit": "5.5.*",
"bovigo/assert": "~1.7",
"nuvoleweb/drupal-behat": "1.0.2",
"mikey179/vfsStream": "*",
"bex/behat-screenshot": "^1.2",
"bex/behat-screenshot-image-driver-img42": "^1.0",
"bex/behat-extension-driver-locator": "^1.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
"repositories": [
{"type": "composer", "url": "https://packages.drupal.org/8"}
],
"conflict": {
"drupal/drupal": "*"
}
}
<?php
/**
* @file
*/
use Behat\Gherkin\Node\TableNode;
use NuvoleWeb\Drupal\DrupalExtension\Context\RawDrupalContext;
use function bovigo\assert\assert;
......
<?php
/**
* @file
* API file.
*/
use Drupal\ui_patterns\Element\PatternContext;
/**
......@@ -62,7 +67,7 @@ function hook_ui_patterns_destination_suggestions_alter(array &$suggestions, arr
$pattern = $context->getProperty('pattern');
$field = $context->getProperty('field');
$suggestions[] = $hook . '__views_row__' . $view_name . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__views_row__' . $view_name . '__' . $display . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__views_row__' . $view_name . '__' . $pattern . '__' . $field;
$suggestions[] = $hook . '__views_row__' . $view_name . '__' . $display . '__' . $pattern . '__' . $field;
}
}
......@@ -28,7 +28,7 @@ function ui_patterns_theme() {
}
/**
* Implements hook_library_info_build()
* Implements hook_library_info_build().
*/
function ui_patterns_library_info_build() {
/** @var \Drupal\ui_patterns\Plugin\PatternBase $pattern */
......@@ -41,7 +41,7 @@ function ui_patterns_library_info_build() {
}
/**
* Implements hook_theme_suggestions_HOOK_alter()
* Implements hook_theme_suggestions_HOOK_alter().
*/
function ui_patterns_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment