Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176

This commit is contained in:
Pantheon Automation 2015-08-17 17:00:26 -07:00 committed by Greg Anderson
commit 9921556621
13277 changed files with 1459781 additions and 0 deletions

View file

@ -0,0 +1,8 @@
name: "Custom Block module tests"
type: module
description: "Support module for custom block related testing."
package: Testing
version: VERSION
core: 8.x
dependencies:
- block_content

View file

@ -0,0 +1,68 @@
<?php
/**
* @file
* A dummy module for testing custom block related hooks.
*
* This is a dummy module that implements custom block related hooks to test API
* interaction with the block_content module.
*/
use Drupal\block_content\Entity\BlockContent;
/**
* Implements hook_block_content_view().
*/
function block_content_test_block_content_view(array &$build, BlockContent $block_content, $view_mode) {
// Add extra content.
$build['extra_content'] = array(
'#markup' => '<blink>Yowser</blink>',
);
}
/**
* Implements hook_block_content_presave().
*/
function block_content_test_block_content_presave(BlockContent $block_content) {
if ($block_content->label() == 'testing_block_content_presave') {
$block_content->setInfo($block_content->label() .'_presave');
}
// Determine changes.
if (!empty($block_content->original) && $block_content->original->label() == 'test_changes') {
if ($block_content->original->label() != $block_content->label()) {
$block_content->setInfo($block_content->label() .'_presave');
// Drupal 1.0 release.
$block_content->changed = 979534800;
}
}
}
/**
* Implements hook_block_content_update().
*/
function block_content_test_block_content_update(BlockContent $block_content) {
// Determine changes on update.
if (!empty($block_content->original) && $block_content->original->label() == 'test_changes') {
if ($block_content->original->label() != $block_content->label()) {
$block_content->setInfo($block_content->label() .'_update');
}
}
}
/**
* Implements hook_block_content_insert().
*
* This tests saving a block_content on block_content insert.
*
* @see \Drupal\block_content\Tests\BlockContentSaveTest::testBlockContentSaveOnInsert()
*/
function block_content_test_block_content_insert(BlockContent $block_content) {
// Set the block_content title to the block_content ID and save.
if ($block_content->label() == 'new') {
$block_content->setInfo('BlockContent ' . $block_content->id());
$block_content->save();
}
if ($block_content->label() == 'fail_creation') {
throw new Exception('Test exception for rollback.');
}
}

View file

@ -0,0 +1,6 @@
block_content_test.block_content_view:
path: '/block-content/{block_content}'
defaults:
_entity_view: 'block_content'
requirements:
_entity_access: 'block_content.view'

View file

@ -0,0 +1,26 @@
langcode: en
status: true
dependencies:
module:
- block_content
theme:
- classy
id: foobargorilla
theme: classy
region: content
weight: null
provider: null
plugin: 'block_content:fb5e8434-3617-4a1d-a252-8273e95ec30e'
settings:
id: 'block_content:fb5e8434-3617-4a1d-a252-8273e95ec30e'
label: 'Foobar Gorilla'
provider: block_content
label_display: visible
status: true
info: ''
view_mode: default
visibility:
request_path:
id: request_path
pages: ''
negate: false

View file

@ -0,0 +1,9 @@
name: 'Block Content test views'
type: module
description: 'Provides default views for views block_content tests.'
package: Testing
version: VERSION
core: 8.x
dependencies:
- block_content
- views

View file

@ -0,0 +1,58 @@
langcode: en
status: true
dependencies:
module:
- block_content
id: test_block_content_revision_id
label: null
module: views
description: ''
tag: ''
base_table: block_content_revision
base_field: revision_id
core: '8'
display:
default:
display_options:
relationships:
id:
id: id
table: block_content_revision
field: id
required: true
plugin_id: standard
fields:
revision_id:
id: revision_id
table: block_content_revision
field: revision_id
plugin_id: field
entity_type: block_content
entity_field: revision_id
id_1:
id: id_1
table: block_content_revision
field: id
plugin_id: field
entity_type: block_content
entity_field: id
id:
id: id
table: block_content
field: id
relationship: id
plugin_id: field
entity_type: block_content
entity_field: id
arguments:
id:
id: id
table: block_content_revision
field: id
plugin_id: numeric
entity_type: block_content
entity_field: id
display_plugin: default
display_title: Master
id: default
position: 0

View file

@ -0,0 +1,61 @@
langcode: en
status: true
dependencies:
module:
- block_content
id: test_block_content_revision_revision_id
label: null
module: views
description: ''
tag: ''
base_table: block_content_revision
base_field: revision_id
core: '8'
display:
default:
display_options:
relationships:
revision_id:
id: revision_id
table: block_content_revision
field: revision_id
required: true
entity_type: block_content
entity_field: revision_id
plugin_id: standard
fields:
revision_id:
id: revision_id
table: block_content_revision
field: revision_id
plugin_id: field
entity_type: block_content
entity_field: revision_id
id_1:
id: id_1
table: block_content_revision
field: id
plugin_id: field
entity_type: block_content
entity_field: id
id:
id: id
table: block_content
field: id
relationship: revision_id
plugin_id: field
entity_type: block_content
entity_field: id
arguments:
id:
id: id
table: block_content_revision
field: id
plugin_id: block_content_id
entity_type: block_content
entity_field: id
display_extenders: { }
display_plugin: default
display_title: Master
id: default
position: 0

View file

@ -0,0 +1,192 @@
langcode: en
status: true
dependencies:
module:
- block_content
id: test_block_content_view
label: test_block_content_view
module: views
description: ''
tag: ''
base_table: block_content_field_data
base_field: id
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: null
display_options:
access:
type: none
options: { }
cache:
type: tag
options: { }
query:
type: views_query
options:
disable_sql_rewrite: false
distinct: false
replica: false
query_comment: ''
query_tags: { }
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
pager:
type: full
options:
items_per_page: 10
offset: 0
id: 0
total_pages: null
expose:
items_per_page: false
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
tags:
previous: ' previous'
next: 'next '
first: '« first'
last: 'last »'
quantity: 9
style:
type: default
row:
type: fields
fields:
id:
id: id
table: block_content_field_data
field: id
relationship: none
group_type: group
admin_label: ''
label: Id
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
plugin_id: field
entity_type: block_content
entity_field: id
sorts:
id:
id: id
table: block_content_field_data
field: id
relationship: none
group_type: group
admin_label: ''
order: ASC
exposed: false
expose:
label: ''
entity_type: block_content
entity_field: id
plugin_id: standard
title: test_block_content_view
header: { }
footer: { }
empty: { }
relationships: { }
display_extenders: { }
arguments:
type:
id: type
table: block_content_field_data
field: type
relationship: none
group_type: group
admin_label: ''
default_action: 'not found'
exception:
value: all
title_enable: false
title: All
title_enable: false
title: ''
default_argument_type: fixed
default_argument_options:
argument: ''
default_argument_skip_url: false
summary_options:
base_path: ''
count: true
items_per_page: 25
override: false
summary:
sort_order: asc
number_of_records: 0
format: default_summary
specify_validation: false
validate:
type: none
fail: 'not found'
validate_options: { }
glossary: false
limit: 0
case: none
path_case: none
transform_dash: false
break_phrase: false
entity_type: block_content
entity_field: type
plugin_id: string
page_1:
display_plugin: page
id: page_1
display_title: Page
position: null
display_options:
path: test-block_content-view
display_extenders: { }

View file

@ -0,0 +1,339 @@
langcode: en
status: true
dependencies:
module:
- block_content
id: test_field_filters
label: 'Test field filters'
module: views
description: ''
tag: ''
base_table: block_content_field_data
base_field: id
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: none
options: { }
cache:
type: tag
options: { }
query:
type: views_query
options:
disable_sql_rewrite: false
distinct: false
replica: false
query_comment: ''
query_tags: { }
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
pager:
type: none
options:
items_per_page: 0
offset: 0
style:
type: default
row:
type: 'entity:block_content'
options:
relationship: none
view_mode: default
fields:
info:
id: info
table: block_content_field_data
field: info
label: ''
alter:
alter_text: false
make_link: false
absolute: false
trim: false
word_boundary: false
ellipsis: false
strip_tags: false
html: false
hide_empty: false
empty_zero: false
relationship: none
group_type: group
admin_label: ''
exclude: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_alter_empty: true
entity_type: block_content
type: string
settings:
link_to_entity: true
entity_field: title
plugin_id: field
filters:
info:
id: info
table: block_content_field_data
field: info
relationship: none
group_type: group
admin_label: ''
operator: contains
value: Paris
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
plugin_id: string
entity_type: block_content
entity_field: info
sorts:
changed:
id: changed
table: block_content_field_data
field: changed
order: DESC
relationship: none
group_type: group
admin_label: ''
exposed: false
expose:
label: ''
granularity: second
plugin_id: date
entity_type: block_content
entity_field: changed
title: 'Test field filters'
header: { }
footer: { }
empty: { }
relationships: { }
arguments: { }
rendering_language: '***LANGUAGE_entity_translation***'
display_extenders: { }
page_bf:
display_plugin: page
id: page_bf
display_title: 'Body filter page'
position: 1
display_options:
path: test-body-filter
display_description: ''
title: 'Test body filters'
defaults:
title: false
filters: false
filter_groups: false
filters:
body_value:
id: body_value
table: block_content__body
field: body_value
relationship: none
group_type: group
admin_label: ''
operator: contains
value: Comida
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
plugin_id: string
entity_type: block_content
entity_field: body
filter_groups:
operator: AND
groups:
1: AND
display_extenders: { }
page_bfp:
display_plugin: page
id: page_bfp
display_title: 'Body filter page Paris'
position: 1
display_options:
path: test-body-paris
display_description: ''
title: 'Test body filters'
defaults:
title: false
filters: false
filter_groups: false
filters:
body_value:
id: body_value
table: block_content__body
field: body_value
relationship: none
group_type: group
admin_label: ''
operator: contains
value: Paris
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
plugin_id: string
entity_type: block_content
entity_field: body
filter_groups:
operator: AND
groups:
1: AND
display_extenders: { }
page_if:
display_plugin: page
id: page_if
display_title: 'Info filter page'
position: 1
display_options:
path: test-info-filter
display_description: ''
title: 'Test info filter'
defaults:
title: false
filters: false
filter_groups: false
filters:
info:
id: info
table: block_content_field_data
field: info
relationship: none
group_type: group
admin_label: ''
operator: contains
value: Comida
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
plugin_id: string
entity_type: block_content
entity_field: info
filter_groups:
operator: AND
groups:
1: AND
display_extenders: { }
page_ifp:
display_plugin: page
id: page_ifp
display_title: 'Info filter page Paris'
position: 1
display_options:
path: test-info-paris
display_description: ''
title: 'Test info filter'
defaults:
title: false
display_extenders: { }

View file

@ -0,0 +1,28 @@
langcode: en
status: true
dependencies:
module:
- block_content
id: test_field_type
label: ''
module: views
description: ''
tag: ''
base_table: block_content_field_data
base_field: id
core: '8'
display:
default:
display_options:
fields:
type:
field: type
id: type
table: block_content_field_data
plugin_id: field
entity_type: block_content
entity_field: type
display_plugin: default
display_title: Master
id: default
position: 0

View file

@ -0,0 +1,85 @@
<?php
/**
* @file
* Contains \Drupal\Tests\block_content\Unit\Menu\BlockContentLocalTasksTest.
*/
namespace Drupal\Tests\block_content\Unit\Menu;
use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Tests existence of block_content local tasks.
*
* @group block_content
*/
class BlockContentLocalTasksTest extends LocalTaskIntegrationTestBase {
protected function setUp() {
$this->directoryList = array(
'block' => 'core/modules/block',
'block_content' => 'core/modules/block_content',
);
parent::setUp();
$config_factory = $this->getConfigFactoryStub(array('system.theme' => array(
'default' => 'test_c',
)));
$themes = array();
$themes['test_a'] = (object) array(
'status' => 0,
);
$themes['test_b'] = (object) array(
'status' => 1,
'info' => array(
'name' => 'test_b',
),
);
$themes['test_c'] = (object) array(
'status' => 1,
'info' => array(
'name' => 'test_c',
),
);
$theme_handler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
$theme_handler->expects($this->any())
->method('listInfo')
->will($this->returnValue($themes));
$container = new ContainerBuilder();
$container->set('config.factory', $config_factory);
$container->set('theme_handler', $theme_handler);
\Drupal::setContainer($container);
}
/**
* Checks block_content listing local tasks.
*
* @dataProvider getBlockContentListingRoutes
*/
public function testBlockContentListLocalTasks($route) {
$this->assertLocalTasks($route, array(
0 => array(
'block.admin_display',
'entity.block_content.collection',
),
1 => array(
'block_content.list_sub',
'entity.block_content_type.collection',
),
));
}
/**
* Provides a list of routes to test.
*/
public function getBlockContentListingRoutes() {
return array(
array('entity.block_content.collection', 'entity.block_content_type.collection'),
);
}
}