I'm kind of amazed there isn't already an issue for this but there seems not to be.

From the bottom of profile.test:

  /**
   * TODO:
   * - Test field visibility
   * - Test profile browsing
   * - Test required fields
   * - Test fields on registration form
   * - Test updating fields
   */
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch’s picture

Priority: Critical » Normal

Moving this out of the critical bugs queue - see #607038: Meta issue: fix gaps in code coverage.

sreynen’s picture

Status: Active » Needs work
FileSize
4.71 KB

I added tests for field visibility, required fields, and fields on registration form. Looks like someone else already did profile browsing. The only one left is "Test updating fields," which I didn't do because I'm not sure what should be tested on that beyond the existing updateProfileField(). Maybe that's already done and just wasn't removed from the list?

craigmc’s picture

Assigned: Unassigned » craigmc

Redacted

craigmc’s picture

Assigned: craigmc » Unassigned
bleen’s picture

+++ profile.test	18 Apr 2010 21:15:28 -0000
@@ -113,6 +113,103 @@ class ProfileTestCase extends DrupalWebT
+    $content = $this->drupalGet('user/' . $this->normal_user->uid);

You dont need "$content =" it can just be "$this->drupalGet..."

+++ profile.test	18 Apr 2010 21:15:28 -0000
@@ -113,6 +113,103 @@ class ProfileTestCase extends DrupalWebT
+    ¶

white space

+++ profile.test	18 Apr 2010 21:15:28 -0000
@@ -113,6 +113,103 @@ class ProfileTestCase extends DrupalWebT
+    if (in_array($visibility, array(2))) {

I think we need to check through the other possible visibility settings (aren't there 3 or 4?)

Here are a few quick notes ... still looking at the patch in #2

Powered by Dreditor.

bleen’s picture

+++ profile.test	18 Apr 2010 21:15:28 -0000
@@ -424,8 +527,5 @@ class ProfileTestBrowsing extends Profil
    * - Test updating fields

This still needs to be done ... I think the intent here is to test that I can create a profile field called "favorite color" and then later on change the filed to be "Most Awesomest Color Ever"

Current tests only test that if an end-user changes favorite color from "red" to "blue" that it works

Powered by Dreditor.

craigmc’s picture

Assigned: Unassigned » craigmc

Going through code comments, "updating field" test, and remaining visibility settings.

craigmc’s picture

Assigned: craigmc » Unassigned
FileSize
7.9 KB

Added tests for all visibility permutations. Incorporated comments from #5.

#6 still needs to be implemented.

craigmc’s picture

Assigned: Unassigned » craigmc

More time for sprint! adding Update field test case

craigmc’s picture

Status: Needs work » Needs review
FileSize
8.42 KB
  1. Added update field test case to standard field creation
  2. Coder review
bleen’s picture

craigmc: when creating a patch you need to use -up (ex: cvs diff -up >path/to/file.patch)

Status: Needs review » Needs work

The last submitted patch, add_profile_field_update_tests.patch, failed testing.

craigmc’s picture

FileSize
22.61 KB

@bleen18 Sadly my computer seems to be the one that can't hang with the Drupal 7 CVS distro. Will post the full file so you can do the diff yrself. Working on getting it sorted out.

bleen’s picture

FileSize
10.18 KB

this is the patch that includes craigmc's changes ... I haven't looked through it yet,

bleen’s picture

Status: Needs work » Needs review

status

Status: Needs review » Needs work

The last submitted patch, profiletest.patch, failed testing.

craigmc’s picture

FYI-- the reason this patch is not passing testing is related to the issue I posted here http://drupal.org/node/774866

If a Field is set to Hidden, it does not appear on the user/uid page when viewed by an administrator, only on the user/uid/edit page. Currently, my test code tests for what I understand the functionality to mean, where the field is/should be viewable by an admin. Requires a refinement of the requirement and/or description before we can complete this.

BTW managed to address build issue so will be able to create grown-up patches. thx for the assist bleen18

bleen’s picture

Assigned: craigmc » bleen

I'm playing with these errors (and white space formatting issues)

bleen’s picture

Priority: Normal » Critical
FileSize
10.08 KB

Ok ... this patch shows several errors and several warnings... I believe that the tests are correct, but that they are revealing a few problems. I need someone to confirm though:

Here is the warning that appears on /profile after a new field has been added:
"Strict warning: Creating default object from empty value in template_preprocess_profile_listing() (line 573 of /.../d7/modules/profile/profile.module)."

The error is a bit trickier... I'm not sure if its an error or if its expected behavior. When a new field is added to profiles, should that new field show up in the list when you go to /profile? If so then these errors are actual errors ... if not, then the tests need to change.

Anyone know?

For now I am making this critical since we are getting a PHP warning... once we figure this out, we can put it back to normal

sreynen’s picture

Priority: Critical » Normal

If the test demonstrates an actual error, that error should be in a separate issue to keep issues focused. I'm pretty sure tests are never considered critical issues, so changing that priority.

bleen’s picture

I have created an issue and submitted patch at #776936: PHP Warning when viewing /profile after adding field... once that lands, we can keep going on these tests

gowriabhaya’s picture

Issue tags: +TestingPartySF

Code sprint tag

bleen’s picture

Status: Needs work » Needs review
FileSize
10.08 KB

reuploading the patch from #19 to see what testbot has to say

Status: Needs review » Needs work
Issue tags: -Needs tests, -TestingPartySF

The last submitted patch, profiletest.patch, failed testing.