Contact admin page is not working! (admin/build/contact)
We collect the data in the $row array but we give the temlplate the name: $rows.
Here is a patch, please apply.

Sorry, I don't know what shall I do. I create a new issue and modify existing #302219: DBTNG: contact

CommentFileSizeAuthor
#9 413060-2.patch1.08 KBpp
#6 413060.patch1.01 KBpp
302219-4.patch665 bytespp
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mr.baileys’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Quick fix, +Novice

You are correct, looks like the 's' was accidentally dropped in #302219: DBTNG: contact.

Reviewed the patch and it looks good, applied the patch and it works as advertised.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Oops. :) Committed, thanks.

I thought about modifying the contact tests to catch this, but I'm not exactly sure how to do that given that the name shows up as part of the drupal_set_message().

mr.baileys’s picture

@webchick: probably wise to add/change a test for this. The issue isn't the "category added message", which is taken care of already:

$this->assertRaw(t('Category %category has been added.', array('%category' => $category)), t('Category successfully added.'));

The problem is the categories table in the body of admin/build/contact. Tests should probably be changed to include assertions that the new category is appearing in the table. I think it's just a matter of adding one extra assertion to the existing tests.

Should this issue be re-opened for the test or should a new issue be created?

webchick’s picture

Status: Fixed » Active

We can re-open this. I thought of changing that to just $this->assertText($category, t('Found the category')); but I'm not sure that would have failed, since it also appears in the drupal_set_message(). If we had to break into doing $this->assertXPath() or similar to make sure it was enclosed in table tags, that seems like it'd be pretty crazy and inconsistent with what we do elsewhere.

mr.baileys’s picture

Well, we could either:

  1. add a couple of categories, then reload the page (to get rid of the messages), then verify that the categories are still listed on the page;
  2. or use the brand new assertNoUniqueText added in #402804: New Assertion: Check for test being found only once to make sure the category name appears more than once.

Both would be simpler than the XPath route.

@pp: since you wrote the initial patch, would you be willing to submit a new patch containing changes to the tests for this scenario?

pp’s picture

FileSize
1.01 KB

Here it is. (my english is not to good, please correct it.)
Test it. It catch this bug.

JamesAn’s picture

Status: Active » Needs review

Just moving the status to review for the patch submitted by pp.

mr.baileys’s picture

Status: Needs review » Needs work

Hi pp, thanks for rolling this patch!

Some comments after reviewing the added test:

  1. The original test adds more than one category (and verifies that the "Category was created" message is displayed for each one). It probably makes sense to do the same for the category table check.
  2. Coding Standards dictate that comments should end with a period:
    +    // Test categories table
    

    I also think it should be a bit more verbose (something like "Make sure the newly created category is included in the list of categories."?)

  3. The assertion message should tell the user what the expected outcome is (or what you are verifying). So instead of "Category list not shown" it should read something like "New category included in categories list.".
    +    $this->assertNoUniqueText($category, t('Category list not shown'));
    

I haven't applied the patch yet, but other than the comments above it looks good. Can you re-roll this patch with these changes?

pp’s picture

Status: Needs work » Needs review
FileSize
1.08 KB

Thanks, mr.baileys!

I modified the patch.

But I think it isn't good. We inspect $category string presents twice(or more). The bug is "The table don't contains the $category name".
I probe following:

    $this->assertNoPattern('!<table.*?>.*?'. $category .'.*?</table>!', t('Categories list is shown.'));

It isn't work(Don't assert when table isn't presented), but when I probe following:

    $this->assertPattern('!<table.*?>.*?'. $category .'.*?</table>!', t('Categories list is shown.'));

it's work. (assert when table is presented)
I don't understand. (I'm studying the Drupal functional testing yet)

pp

Status: Needs review » Needs work

The last submitted patch failed testing.

JamesAn’s picture

Status: Needs work » Needs review

Hmm.. this passed before. Wonder why it failed this time. =\

Dave Reid’s picture

Status: Needs review » Reviewed & tested by the community

@JamesAn: Testing bot weirdness. :)

Looks good and I approve.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks!

Status: Fixed » Closed (fixed)
Issue tags: -Quick fix, -Novice

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