Download & Extend

Add tests for vocabulary hierarchy

Project:Drupal core
Version:7.x-dev
Component:taxonomy.module
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:needs backport to D7, Novice

Issue Summary

Vocabulary hierarchy was always changed to single after term edit. This been fixed in #762604: Taxonomy terms list broken, term add/edit forgets it's parent
But we still has no test for "flatness" and this issue fixes it with more clear/readable condition in code

To reproduce:

  • Create a new vocabulary, on the term list page, you see "flat vocabulary"
  • Add any term, on the term list page, the vocabulary type changed to "single hierarchy"

Expected behavior: the vocabulary type should stay in "flat vocabulary" as long as there is no parent/child relationship in the vocabulary.

Comments

#1

The issue comes from the identification of the root element. Here harmonized for consistency.

AttachmentSizeStatusTest resultOperations
277200-detect-hierachy-type.patch1.51 KBIdleFailed: 7241 passes, 4 fails, 0 exceptionsView details

#2

Status:active» needs review

This is a patch. Could use a test.

#3

Status:needs review» needs work

The last submitted patch failed testing.

#4

Is this still an issue?

#5

Status:needs work» needs review

Fix with test

EDIT: parent for [root] is not set #762604: Taxonomy terms list broken, term add/edit forgets it's parent

EDIT2: new issue about hierarchy #763380: Do not use taxonomy_get_tree() in taxonomy_overview_terms()

AttachmentSizeStatusTest resultOperations
277200-detect-hierachy-type-d7.patch1.45 KBIdlePASSED: [[SimpleTest]]: [MySQL] 19,037 pass(es).View details

#6

Re-roll last patch suppose no need to wait debatable #763380: Do not use taxonomy_get_tree() in taxonomy_overview_terms()

AttachmentSizeStatusTest resultOperations
277200-detect-hierachy-type-d7.patch823 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 21,944 pass(es).View details

#7

taxonomy.module hunk was lost

AttachmentSizeStatusTest resultOperations
277200-detect-hierachy-type-d7.patch1.45 KBIdlePASSED: [[SimpleTest]]: [MySQL] 21,951 pass(es).View details

#8

Re-roll against current HEAD

AttachmentSizeStatusTest resultOperations
277200-detect-hierachy-type-d7.patch1.45 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 277200-detect-hierachy-type-d7_2.patch. See the log in the details link for more information.View details

#9

Seems this was fixed in #846524: Terms cannot be manually reordered by weight.

So patch still useful
- Adds a test
- isset() a bit faster then array_shift() + compare

#10

Status:needs review» closed (fixed)

#11

Status:closed (fixed)» needs review

I think this should be commited

#12

#8: 277200-detect-hierachy-type-d7.patch queued for re-testing.

#13

Version:7.x-dev» 8.x-dev

Sorry, I thought you said in #9 that the issue was fixed. Can we update the title and issue summary to reflect what the current patch is for?

#14

Status:needs review» needs work

The last submitted patch, 277200-detect-hierachy-type-d7.patch, failed testing.

#15

Status:needs work» needs review

re-roll for 7 & 8

AttachmentSizeStatusTest resultOperations
277200-detect-hierachy-type.patch1.19 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 277200-detect-hierachy-type.patch. Unable to apply patch. See the log in the details link for more information.View details
277200-detect-hierachy-type-d7.patch1.15 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 277200-detect-hierachy-type-d7.patch. Unable to apply patch. See the log in the details link for more information.View details

#16

#15: 277200-detect-hierachy-type.patch queued for re-testing.

#17

Status:needs review» needs work

The last submitted patch, 277200-detect-hierachy-type-d7.patch, failed testing.

#18

Status:needs work» needs review

Re-rolled patch with test

EDIT: summary updated

AttachmentSizeStatusTest resultOperations
277200-detect-hierachy-type-18.patch1.25 KBIdlePASSED: [[SimpleTest]]: [MySQL] 36,281 pass(es).View details

#19

Attached merely removes t() from the assertion message, which is not actually translated. Reference: http://drupal.org/simpletest-tutorial-drupal7#t

AttachmentSizeStatusTest resultOperations
vocab-hierarchy-277200-19-test.patch1.24 KBIdlePASSED: [[SimpleTest]]: [MySQL] 36,263 pass(es).View details

#20

Status:needs review» reviewed & tested by the community

Ah, I understand now. So the current patch does not include any functional changes. Instead, it includes:

  1. A code cleanup.
  2. An automated test to codify the correct behavior.

Patch looks good to me. Thanks @andypost for pushing this forward. :)

#21

Title:Adding a term change the hierarchy type of the vocabulary to "single hierarchy"» Add tests for vocabulary hierarchy
Version:8.x-dev» 7.x-dev
Category:bug report» task
Status:reviewed & tested by the community» patch (to be ported)

Thanks, committed/pushed to 8.x, moving to 7.x for backport.

#22

Issue tags:+Novice

Should be a simple backport.

#23

Status:patch (to be ported)» needs review
AttachmentSizeStatusTest resultOperations
277200-vocab7.patch1.15 KBIdlePASSED: [[SimpleTest]]: [MySQL] 38,691 pass(es).View details

#24

Status:needs review» reviewed & tested by the community

Thanks @andypost!

#25

Status:reviewed & tested by the community» fixed

That's certainly much easier to read. and yay for tests.

Committed and pushed to 7.x. Thanks!

#26

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.