Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
220
Merge Requests
220
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
ec3acb2a
Commit
ec3acb2a
authored
Sep 24, 2012
by
tim.plunkett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The standard profile cannot be used by a module that provides a bundle.
parent
547fada2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
9 deletions
+72
-9
lib/Drupal/views/Tests/Taxonomy/RelationshipNodeTermDataTest.php
...pal/views/Tests/Taxonomy/RelationshipNodeTermDataTest.php
+72
-9
No files found.
lib/Drupal/views/Tests/Taxonomy/RelationshipNodeTermDataTest.php
View file @
ec3acb2a
...
@@ -14,8 +14,6 @@
...
@@ -14,8 +14,6 @@
*/
*/
class
RelationshipNodeTermDataTest
extends
ViewTestBase
{
class
RelationshipNodeTermDataTest
extends
ViewTestBase
{
protected
$profile
=
'standard'
;
/**
/**
* Modules to enable.
* Modules to enable.
*
*
...
@@ -23,6 +21,13 @@ class RelationshipNodeTermDataTest extends ViewTestBase {
...
@@ -23,6 +21,13 @@ class RelationshipNodeTermDataTest extends ViewTestBase {
*/
*/
public
static
$modules
=
array
(
'taxonomy'
);
public
static
$modules
=
array
(
'taxonomy'
);
/**
* The vocabulary for the test.
*
* @var Drupal\taxonomy\Vocabulary
*/
protected
$vocabulary
;
public
static
function
getInfo
()
{
public
static
function
getInfo
()
{
return
array
(
return
array
(
'name'
=>
'Taxonomy: Node term data Relationship'
,
'name'
=>
'Taxonomy: Node term data Relationship'
,
...
@@ -34,13 +39,13 @@ public static function getInfo() {
...
@@ -34,13 +39,13 @@ public static function getInfo() {
/**
/**
* Returns a new term with random properties in vocabulary $vid.
* Returns a new term with random properties in vocabulary $vid.
*/
*/
function
createTerm
(
$vocabulary
)
{
function
createTerm
()
{
$term
=
entity_create
(
'taxonomy_term'
,
array
(
$term
=
entity_create
(
'taxonomy_term'
,
array
(
'name'
=>
$this
->
randomName
(),
'name'
=>
$this
->
randomName
(),
'description'
=>
$this
->
randomName
(),
'description'
=>
$this
->
randomName
(),
// Use the first available text format.
// Use the first available text format.
'format'
=>
db_query_range
(
'SELECT format FROM {filter_format}'
,
0
,
1
)
->
fetchField
(),
'format'
=>
db_query_range
(
'SELECT format FROM {filter_format}'
,
0
,
1
)
->
fetchField
(),
'vid'
=>
$vocabulary
->
vid
,
'vid'
=>
$
this
->
vocabulary
->
vid
,
'langcode'
=>
LANGUAGE_NOT_SPECIFIED
,
'langcode'
=>
LANGUAGE_NOT_SPECIFIED
,
));
));
taxonomy_term_save
(
$term
);
taxonomy_term_save
(
$term
);
...
@@ -49,18 +54,76 @@ function createTerm($vocabulary) {
...
@@ -49,18 +54,76 @@ function createTerm($vocabulary) {
function
setUp
()
{
function
setUp
()
{
parent
::
setUp
();
parent
::
setUp
();
$this
->
mockStandardInstall
();
$vocabulary
=
taxonomy_vocabulary_machine_name_load
(
'tags'
);
$this
->
term_1
=
$this
->
createTerm
();
$this
->
term_1
=
$this
->
createTerm
(
$vocabulary
);
$this
->
term_2
=
$this
->
createTerm
();
$this
->
term_2
=
$this
->
createTerm
(
$vocabulary
);
$node
=
array
();
$node
=
array
();
$node
[
'type'
]
=
'article'
;
$node
[
'type'
]
=
'article'
;
$node
[
'field_tags'
][
LANGUAGE_NOT_SPECIFIED
][][
'tid'
]
=
$this
->
term_1
->
tid
;
$node
[
'field_
views_testing_
tags'
][
LANGUAGE_NOT_SPECIFIED
][][
'tid'
]
=
$this
->
term_1
->
tid
;
$node
[
'field_tags'
][
LANGUAGE_NOT_SPECIFIED
][][
'tid'
]
=
$this
->
term_2
->
tid
;
$node
[
'field_
views_testing_
tags'
][
LANGUAGE_NOT_SPECIFIED
][][
'tid'
]
=
$this
->
term_2
->
tid
;
$this
->
node
=
$this
->
drupalCreateNode
(
$node
);
$this
->
node
=
$this
->
drupalCreateNode
(
$node
);
}
}
/**
* Provides a workaround for the inability to use the standard profile.
*
* @see http://drupal.org/node/1708692
*/
protected
function
mockStandardInstall
()
{
$type
=
array
(
'type'
=>
'article'
,
);
$type
=
node_type_set_defaults
(
$type
);
node_type_save
(
$type
);
node_add_body_field
(
$type
);
// Create the vocabulary for the tag field.
$this
->
vocabulary
=
entity_create
(
'taxonomy_vocabulary'
,
array
(
'name'
=>
'Views testing tags'
,
'machine_name'
=>
'views_testing_tags'
,
));
$this
->
vocabulary
->
save
();
$field
=
array
(
'field_name'
=>
'field_'
.
$this
->
vocabulary
->
machine_name
,
'type'
=>
'taxonomy_term_reference'
,
// Set cardinality to unlimited for tagging.
'cardinality'
=>
FIELD_CARDINALITY_UNLIMITED
,
'settings'
=>
array
(
'allowed_values'
=>
array
(
array
(
'vocabulary'
=>
$this
->
vocabulary
->
machine_name
,
'parent'
=>
0
,
),
),
),
);
field_create_field
(
$field
);
$instance
=
array
(
'field_name'
=>
'field_'
.
$this
->
vocabulary
->
machine_name
,
'entity_type'
=>
'node'
,
'label'
=>
'Tags'
,
'bundle'
=>
'article'
,
'widget'
=>
array
(
'type'
=>
'taxonomy_autocomplete'
,
'weight'
=>
-
4
,
),
'display'
=>
array
(
'default'
=>
array
(
'type'
=>
'taxonomy_term_reference_link'
,
'weight'
=>
10
,
),
'teaser'
=>
array
(
'type'
=>
'taxonomy_term_reference_link'
,
'weight'
=>
10
,
),
),
);
field_create_instance
(
$instance
);
}
function
testViewsHandlerRelationshipNodeTermData
()
{
function
testViewsHandlerRelationshipNodeTermData
()
{
$this
->
executeView
(
$this
->
view
,
array
(
$this
->
term_1
->
tid
,
$this
->
term_2
->
tid
));
$this
->
executeView
(
$this
->
view
,
array
(
$this
->
term_1
->
tid
,
$this
->
term_2
->
tid
));
$resultset
=
array
(
$resultset
=
array
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment