Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443915
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3443915
Commits
6f8b5f9a
Commit
6f8b5f9a
authored
16 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#296297
by beeradb, boombatwoer: tests for drupal_get_content and drupal_set_content. Yay.
parent
21aab5e6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/simpletest/tests/common.test
+49
-0
49 additions, 0 deletions
modules/simpletest/tests/common.test
with
49 additions
and
0 deletions
modules/simpletest/tests/common.test
+
49
−
0
View file @
6f8b5f9a
...
...
@@ -202,3 +202,52 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
$this
->
assertText
(
$query
,
t
(
'The query passed to the page is correctly represented by drupal_get_detination().'
));
}
}
/**
* Testing drupal_set_content and drupal_get_content.
*/
class
DrupalSetContentTestCase
extends
DrupalWebTestCase
{
/**
* Implementation of getInfo().
*/
function
getInfo
()
{
return
array
(
'name'
=>
t
(
'Drupal set/get content'
),
'description'
=>
t
(
"Performs tests on setting and retrieiving content from theme regions."
),
'group'
=>
t
(
'System'
)
);
}
/**
* Test setting and retrieving content for theme regions.
*/
function
testRegions
()
{
global
$theme_key
;
$block_regions
=
array_keys
(
system_region_list
(
$theme_key
));
$delimiter
=
$this
->
randomName
(
32
);
$values
=
array
();
// Set some random content for each region available.
foreach
(
$block_regions
as
$region
)
{
$first_chunk
=
$this
->
randomName
(
32
);
drupal_set_content
(
$region
,
$first_chunk
);
$second_chunk
=
$this
->
randomName
(
32
);
drupal_set_content
(
$region
,
$second_chunk
);
// Store the expected result for a drupal_get_content call for this region.
$values
[
$region
]
=
$first_chunk
.
$delimiter
.
$second_chunk
;
}
// Ensure drupal_get_content returns expected results when fetching all regions.
$content
=
drupal_get_content
(
NULL
,
$delimiter
);
foreach
(
$content
as
$region
=>
$region_content
)
{
$this
->
assertEqual
(
$region_content
,
$values
[
$region
],
t
(
'@region region text verified when fetching all regions'
,
array
(
'@region'
=>
$region
)));
}
// Ensure drupal_get_content returns expected results when fetching a single region.
foreach
(
$block_regions
as
$region
)
{
$region_content
=
drupal_get_content
(
$region
,
$delimiter
);
$this
->
assertEqual
(
$region_content
,
$values
[
$region
],
t
(
'@region region text verified when fetching single region.'
,
array
(
'@region'
=>
$region
)));
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment