Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
language: php
sudo: false

php:
- 7.1
- 7
- 5.6
- 5.5

env:
global:
- DRUPAL_BUILD_DIR=$TRAVIS_BUILD_DIR/../drupal
- SIMPLETEST_DB=mysql://root:@127.0.0.1/graphql
- TRAVIS=true
matrix:
- DRUPAL_CORE=8.3.x
- DRUPAL_CORE=8.4.x
- DRUPAL_CORE=8.5.x

matrix:
# Don't wait for the allowed failures to build.
fast_finish: true
include:
- php: 7.1
env:
- DRUPAL_CORE=8.5.x
# Only run code coverage on the latest php and drupal versions.
- WITH_PHPDBG_COVERAGE=true
allow_failures:
# Allow the code coverage report to fail.
- php: 7.1
env:
- DRUPAL_CORE=8.5.x
# Only run code coverage on the latest php and drupal versions.
- WITH_PHPDBG_COVERAGE=true

mysql:
database: graphql
username: root
encoding: utf8

# Cache composer downloads.
cache:
directories:
- $HOME/.composer

before_install:
# Disable xdebug.
- phpenv config-rm xdebug.ini

# Determine the php settings file location.
- if [[ $TRAVIS_PHP_VERSION = hhvm* ]];
then export PHPINI=/etc/hhvm/php.ini;
else export PHPINI=$HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini;
fi

# PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated
# and will be removed in a future version. To avoid this warning set
# 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input
# stream instead.
- if [[ "$TRAVIS_PHP_VERSION" == "5.6" ]];
then echo always_populate_raw_post_data = -1 >> $PHPINI;
fi;

# Disable the default memory limit.
- echo memory_limit = -1 >> $PHPINI

# Update composer.
- composer self-update

install:
# Create the database.
- mysql -e 'create database graphql'

# Download Drupal 8 core from the Github mirror because it is faster.
- git clone --branch $DRUPAL_CORE --depth 1 https://github.com/drupal/drupal.git $DRUPAL_BUILD_DIR

# Download graphql module from the Github mirror because it is faster.
- git clone --depth 1 https://github.com/drupal-graphql/graphql.git $DRUPAL_BUILD_DIR/modules/contrib/graphql

# Reference the module in the build site.
- ln -s $TRAVIS_BUILD_DIR $DRUPAL_BUILD_DIR/modules/graphql-examples

# Copy the customized phpunit configuration file to the core directory so
# the relative paths are correct.
- cp $DRUPAL_BUILD_DIR/modules/contrib/graphql/phpunit.xml.dist $DRUPAL_BUILD_DIR/core/phpunit.xml

# When running with phpdbg we need to replace all code occurrences that check
# for 'cli' with 'phpdbg'. Some files might be write protected, hence the
# fallback.
- if [[ "$WITH_PHPDBG_COVERAGE" == "true" ]];
then grep -rl 'cli' $DRUPAL_BUILD_DIR/core $DRUPAL_BUILD_DIR/modules | xargs sed -i "s/'cli'/'phpdbg'/g" || true;
fi

# Bring in the module dependencies without requiring a merge plugin. The
# require also triggers a full 'composer install'.
- composer --working-dir=$DRUPAL_BUILD_DIR require webonyx/graphql-php:^0.11.5

script:
# Run the unit tests using phpdbg if the environment variable is 'true'.
- if [[ "$WITH_PHPDBG_COVERAGE" == "true" ]];
then phpdbg -qrr $DRUPAL_BUILD_DIR/vendor/bin/phpunit --configuration $DRUPAL_BUILD_DIR/core/phpunit.xml --coverage-clover $TRAVIS_BUILD_DIR/coverage.xml $TRAVIS_BUILD_DIR;
fi

# Run the unit tests with standard php otherwise.
- if [[ "$WITH_PHPDBG_COVERAGE" != "true" ]];
then $DRUPAL_BUILD_DIR/vendor/bin/phpunit --configuration $DRUPAL_BUILD_DIR/core/phpunit.xml $TRAVIS_BUILD_DIR;
fi

after_success:
- if [[ "$WITH_PHPDBG_COVERAGE" == "true" ]];
then bash <(curl -s https://codecov.io/bash);
fi
13 changes: 13 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "drupal/graphql_examples",
"type": "drupal-module",
"description": "A GraphQL Article and File Mutation Example",
"keywords": ["Drupal"],
"license": "GPL-2.0+",
"minimum-stability": "dev",
"support": {
"issues": "https://github.com/drupal-graphql/graphql-examples",
"source": "https://github.com/drupal-graphql/graphql-examples"
},
"require": { }
}
112 changes: 112 additions & 0 deletions config/optional/core.entity_form_display.node.article.default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
langcode: en
status: true
dependencies:
config:
- entity_browser.browser.media_entity_browser
- field.field.node.article.body
- field.field.node.article.field_image
- field.field.node.article.field_media_image
- field.field.node.article.field_tags
- image.style.thumbnail
- node.type.article
module:
- entity_browser
- image
- path
- text
id: node.article.default
targetEntityType: node
bundle: article
mode: default
content:
body:
type: text_textarea_with_summary
weight: 1
region: content
settings:
rows: 9
summary_rows: 3
placeholder: ''
third_party_settings: { }
created:
type: datetime_timestamp
weight: 6
region: content
settings: { }
third_party_settings: { }
field_image:
type: image_image
weight: 3
region: content
settings:
progress_indicator: throbber
preview_image_style: thumbnail
third_party_settings: { }
field_media_image:
weight: 4
settings:
entity_browser: media_entity_browser
field_widget_display: rendered_entity
field_widget_edit: true
field_widget_remove: true
open: true
selection_mode: selection_append
field_widget_display_settings:
view_mode: default
third_party_settings: { }
type: entity_browser_entity_reference
region: content
field_tags:
type: entity_reference_autocomplete_tags
weight: 2
region: content
settings:
match_operator: CONTAINS
size: 60
placeholder: ''
third_party_settings: { }
path:
type: path
weight: 9
region: content
settings: { }
third_party_settings: { }
promote:
type: boolean_checkbox
settings:
display_label: true
weight: 7
region: content
third_party_settings: { }
status:
type: boolean_checkbox
settings:
display_label: true
weight: 10
region: content
third_party_settings: { }
sticky:
type: boolean_checkbox
settings:
display_label: true
weight: 8
region: content
third_party_settings: { }
title:
type: string_textfield
weight: 0
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
uid:
type: entity_reference_autocomplete
weight: 5
region: content
settings:
match_operator: CONTAINS
size: 60
placeholder: ''
third_party_settings: { }
hidden: { }
43 changes: 43 additions & 0 deletions config/optional/entity_browser.browser.media_entity_browser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
langcode: en
status: true
dependencies:
config:
- views.view.media_entity_browser
module:
- views
_core:
default_config_hash: UoGZLPH_DEy28wDjCYqiBKYsKoHlf6l6deygJjqdgPc
name: media_entity_browser
label: 'Media Entity Browser'
display: modal
display_configuration:
width: ''
height: ''
link_text: Select
auto_open: false
selection_display: no_display
selection_display_configuration: { }
widget_selector: tabs
widget_selector_configuration: { }
widgets:
6586703a-6976-4124-8a49-cbb07ceaa3b1:
settings:
view: media_entity_browser
view_display: entity_browser_1
submit_text: Select
auto_select: false
uuid: 6586703a-6976-4124-8a49-cbb07ceaa3b1
weight: 1
label: view
id: view
18d9da69-b4e6-4be3-a8bc-bb3fa8574f15:
settings:
extensions: 'jpg jpeg png gif'
media_type: image
upload_location: 'public://'
multiple: '1'
submit_text: 'Select files'
uuid: 18d9da69-b4e6-4be3-a8bc-bb3fa8574f15
weight: 2
label: Upload
id: media_image_upload
21 changes: 21 additions & 0 deletions config/optional/field.field.node.article.body.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
langcode: en
status: true
dependencies:
config:
- field.storage.node.body
- node.type.article
module:
- text
id: node.article.body
field_name: body
entity_type: node
bundle: article
label: Body
description: ''
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings:
display_summary: true
field_type: text_with_summary
37 changes: 37 additions & 0 deletions config/optional/field.field.node.article.field_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_image
- node.type.article
module:
- image
id: node.article.field_image
field_name: field_image
entity_type: node
bundle: article
label: Image
description: ''
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings:
file_directory: '[date:custom:Y]-[date:custom:m]'
file_extensions: 'png gif jpg jpeg'
max_filesize: ''
max_resolution: ''
min_resolution: ''
alt_field: true
title_field: false
alt_field_required: true
title_field_required: false
default_image:
uuid: null
alt: ''
title: ''
width: null
height: null
handler: 'default:file'
handler_settings: { }
field_type: image
27 changes: 27 additions & 0 deletions config/optional/field.field.node.article.field_media_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_media_image
- media.type.image
- node.type.article
id: node.article.field_media_image
field_name: field_media_image
entity_type: node
bundle: article
label: 'Media Image'
description: ''
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:media'
handler_settings:
target_bundles:
image: image
sort:
field: _none
auto_create: false
auto_create_bundle: ''
field_type: entity_reference
Loading