Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443488
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-3443488
Commits
72bbd21e
Commit
72bbd21e
authored
16 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
#312792
by catch: Clean-up for editForumTaxonomy().
parent
430d8395
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/forum/forum.test
+9
-31
9 additions, 31 deletions
modules/forum/forum.test
with
9 additions
and
31 deletions
modules/forum/forum.test
+
9
−
31
View file @
72bbd21e
...
@@ -113,14 +113,11 @@ class ForumTestCase extends DrupalWebTestCase {
...
@@ -113,14 +113,11 @@ class ForumTestCase extends DrupalWebTestCase {
/**
/**
* Edit the forum taxonomy.
* Edit the forum taxonomy.
*
*/
*/
function
editForumTaxonomy
()
{
function
editForumTaxonomy
()
{
// Backup forum taxonomy.
// Backup forum taxonomy.
$vid
=
variable_get
(
'forum_nav_vocabulary'
,
''
);
$vid
=
variable_get
(
'forum_nav_vocabulary'
,
''
);
// This function returns NULL (the cache value is false).
$original_settings
=
taxonomy_vocabulary_load
(
$vid
);
// $original_settings = taxonomy_vocabulary_load($vid);
$original_settings
=
db_fetch_array
(
db_query
(
'SELECT v.* FROM {vocabulary} v WHERE v.vid = %d'
,
$vid
));
// Generate a random name/description.
// Generate a random name/description.
$title
=
$this
->
randomName
(
10
);
$title
=
$this
->
randomName
(
10
);
...
@@ -134,41 +131,22 @@ class ForumTestCase extends DrupalWebTestCase {
...
@@ -134,41 +131,22 @@ class ForumTestCase extends DrupalWebTestCase {
);
);
// Edit the vocabulary.
// Edit the vocabulary.
$this
->
drupalPost
(
'admin/content/taxonomy/'
.
$vid
.
'/edit'
,
$edit
,
t
(
'Save'
));
$this
->
drupalPost
(
'admin/content/taxonomy/'
.
$vid
,
$edit
,
t
(
'Save'
));
$this
->
assertResponse
(
200
);
$this
->
assertResponse
(
200
);
$this
->
assertRaw
(
t
(
'Updated vocabulary %name.'
,
array
(
'%name'
=>
$title
)),
t
(
'Vocabulary was edited'
));
$this
->
assertRaw
(
t
(
'Updated vocabulary %name.'
,
array
(
'%name'
=>
$title
)),
t
(
'Vocabulary was edited'
));
// Grab the newly edited vocabulary.
// Grab the newly edited vocabulary.
$cur_settings
=
db_fetch_array
(
db_query
(
'SELECT v.* FROM {vocabulary} v WHERE v.vid = %d'
,
$vid
)
);
$cur
rent
_settings
=
taxonomy_vocabulary_load
(
$vid
,
TRUE
);
// Make sure we actually edited the vocabulary properly.
// Make sure we actually edited the vocabulary properly.
$this
->
assertTrue
(
$cur_settings
[
'name'
]
==
$title
,
'The name was updated'
);
$this
->
assertEqual
(
$current_settings
->
name
,
$title
,
t
(
'The name was updated'
));
$this
->
assertTrue
(
$cur_settings
[
'description'
]
==
$description
,
'The description was updated'
);
$this
->
assertEqual
(
$current_settings
->
description
,
$description
,
t
(
'The description was updated'
));
// Restore the name/description.
$title
=
$original_settings
[
'name'
];
$description
=
$original_settings
[
'description'
];
$description
=
(
$description
==
NULL
)
?
''
:
$description
;
$edit
=
array
(
'name'
=>
$title
,
'description'
=>
$description
,
'help'
=>
''
,
'weight'
=>
-
10
);
// Edit the vocabulary.
// Restore the original vocabulary.
$this
->
drupalPost
(
'admin/content/taxonomy/'
.
$vid
.
'edit'
,
$edit
,
t
(
'Save'
));
$this
->
assertResponse
(
200
);
$this
->
assertRaw
(
t
(
'Updated vocabulary %name.'
,
array
(
'%name'
=>
$title
)),
t
(
'Vocabulary was edited'
));
/*
// Verify original forum taxonomy.
$original_settings
=
(
array
)
$original_settings
;
$original_settings
=
(
array
)
$original_settings
;
taxonomy_save_vocabulary($original_settings); // This fails because taxonomy_vocabulary_load returns NULL.
taxonomy_save_vocabulary
(
$original_settings
);
$cur_settings = db_fetch_array(db_query('SELECT v.* FROM {vocabulary} v WHERE v.vid = %d', $vid));
$current_settings
=
taxonomy_vocabulary_load
(
$vid
,
TRUE
);
$this->assertTrue($cur_settings['name'] == $original_settings['name'], 'The name was restored');
$this
->
assertEqual
(
$current_settings
->
name
,
$original_settings
[
'name'
],
'The original vocabulary settings were restored'
);
$this->assertTrue(!isset($cur_settings['description']), 'The description was restored');
*/
}
}
/**
/**
...
...
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