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
9bc36524
Commit
9bc36524
authored
16 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
#244662
by solotandem and catch: Fix taxonomy_vocabulary_load() when called multiple times.
parent
06d0d8c2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/taxonomy/taxonomy.module
+1
-1
1 addition, 1 deletion
modules/taxonomy/taxonomy.module
modules/taxonomy/taxonomy.test
+58
-2
58 additions, 2 deletions
modules/taxonomy/taxonomy.test
with
59 additions
and
3 deletions
modules/taxonomy/taxonomy.module
+
1
−
1
View file @
9bc36524
...
...
@@ -994,7 +994,7 @@ function taxonomy_get_term_by_name($name) {
function
taxonomy_vocabulary_load
(
$vid
)
{
static
$vocabularies
=
array
();
if
(
!
isset
(
$vocabularies
[
$vid
]))
{
if
(
empty
(
$vocabularies
[
$vid
]))
{
// Initialize so if this vocabulary does not exist, we have
// that cached, and we will not try to load this later.
$vocabularies
[
$vid
]
=
FALSE
;
...
...
This diff is collapsed.
Click to expand it.
modules/taxonomy/taxonomy.test
+
58
−
2
View file @
9bc36524
<?php
// $Id$
class
TaxonomyVocabularyLoadTestCase
extends
DrupalWebTestCase
{
/**
* Implementation of getInfo().
*/
function
getInfo
()
{
return
array
(
'name'
=>
t
(
'Loading taxonomy vocabularies'
),
'description'
=>
t
(
'Test loading vocabularies under various conditions.'
),
'group'
=>
t
(
'Taxonomy'
),
);
}
/**
* Implementation of setUp() {
*/
function
setUp
()
{
parent
::
setUp
(
'taxonomy'
);
$admin_user
=
$this
->
drupalCreateUser
(
array
(
'administer taxonomy'
));
$this
->
drupalLogin
(
$admin_user
);
}
/**
* Ensure that when an invalid vocabulary vid is loaded, it is possible
* to load the same vid successfully if it subsequently becomes valid.
*/
function
testTaxonomyVocabularyLoadReturnFalse
()
{
// Load a vocabulary that doesn't exist.
$vocabularies
=
taxonomy_get_vocabularies
();
$vid
=
count
(
$vocabularies
)
+
1
;
$vocabulary
=
taxonomy_vocabulary_load
(
$vid
);
// This should not return an object because no such vocabulary exists.
$this
->
assertTrue
(
!
is_object
(
$vocabulary
),
t
(
'No object loaded.'
));
// Create a new vocabulary.
$edit
=
array
(
'name'
=>
$this
->
randomName
(),
'description'
=>
$this
->
randomName
(),
'help'
=>
''
,
'weight'
=>
0
,
);
$this
->
drupalPost
(
'admin/content/taxonomy/add/vocabulary'
,
$edit
,
t
(
'Save'
));
// Load the vocabulary with the same $vid from earlier.
// This should return a vocabulary object since it now matches a real vid.
$vocabulary
=
taxonomy_vocabulary_load
(
$vid
);
$this
->
assertTrue
(
is_object
(
$vocabulary
),
t
(
'Vocabulary is an object'
));
$this
->
assertTrue
(
$vocabulary
->
vid
==
$vid
,
t
(
'Valid vocabulary vid is the same as our previously invalid one.'
));
}
}
class
TaxonomyVocabularyFunctionsTestCase
extends
DrupalWebTestCase
{
/**
* Implementation of getInfo().
...
...
@@ -8,11 +58,18 @@ class TaxonomyVocabularyFunctionsTestCase extends DrupalWebTestCase {
function
getInfo
()
{
return
array
(
'name'
=>
t
(
'Vocabulary functions'
),
'description'
=>
t
(
'
Create/Edit/D
elet
e
vocabular
y and assert that all fields were properly saved
.'
),
'description'
=>
t
(
'
Test loading, saving, and d
elet
ing
vocabular
ies
.'
),
'group'
=>
t
(
'Taxonomy'
)
);
}
/**
* Implementation of setUp().
*/
function
setUp
()
{
parent
::
setUp
(
'taxonomy'
);
}
/**
* Create/Edit/Delete vocabulary and assert that all fields were properly saved.
*/
...
...
@@ -81,7 +138,6 @@ class TaxonomyVocabularyFunctionsTestCase extends DrupalWebTestCase {
}
}
class
TaxonomyTermFunctionsTestCase
extends
DrupalWebTestCase
{
/**
* Implementation of getInfo().
...
...
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