Actually, the first step to any project_issue tests would be a simple test case that makes sure you can create a project issue node at all. ;)

Comments

mikey_p’s picture

Status: Active » Needs review
StatusFileSize
new2.7 KB

Works well here, this depends on #774890: Move some setup from PIFT tests for createProject to return a node.

dww’s picture

Status: Needs review » Needs work

Oh, how much I'd love to commit this. Sadly, this is weird to my eyes:

A)

+  /**
+   * Create an Issue node.
+   *
+   * @param stdClass $project
+   *   A project node.
+   * @param $edit
+   *   An array of form values, passed to drupalPost. Optional
+   * @return
+   *   An issue node.
+   */
+  function createIssue($project, $edit = array()) {
+    if (empty($edit)) {
+      $project = $this->createProject();
+      $edit['title'] = $this->randomName(8);
+      $edit['body'] = $this->randomName(64);
+      $edit['component'] = 'Code';
+      $edit['category'] = 'bug';
+    }

It doesn't say that $project is optional. Just because $edit is optional doesn't mean that if you don't define it, you should clobber the $project the caller passed in and use your own. I think we should probably just remove that $project = $this->createProject(); line entirely and retain the behavior that $project is required for this function. Thoughts?

B) testProjectCreation() needs to be renamed to testProjectIssueCreation() it seems.

C) Code comment about "Test project node form fields" is wrong.

Thanks!
-Derek

dww’s picture

Status: Needs work » Needs review
StatusFileSize
new2.77 KB

Fixes A-C. mikey_p: do you agree with (A)? If so, set this RTBC and it'll go in. The tests all pass locally with this.

dmitrig01’s picture

Status: Needs review » Needs work

This doesn't work. Fixing...

dmitrig01’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new2.85 KB
new679 bytes

Ok, this works and fixes the issues. I know I shouldn't RTBC my own patch but...

dmitrig01’s picture

whoops... some duplicate code. This is even better (and passes).

dww’s picture

@dmitrig01: I don't think you cvs up'ed project.test from HEAD, since your project.test patch here isn't needed anymore and conflicts. I'm on BART now. When I get to the conf I'll clean this up and commit. ;)

cheers,
-Derek

dww’s picture

Title: Add tests for issue creation » Add tests for issue creation (including metadata fields)
Status: Reviewed & tested by the community » Active

Cleaned up and reconciled the patches in #6 with what's already in HEAD:

http://drupal.org/cvs?commit=357142
http://drupal.org/cvs?commit=357150

Back to active here, since we really need assertions on the issue metadata fields (Category, Priority, Component, etc).

Thanks y'all, this is so exciting that we're making such great progress!!

dmitrig01’s picture

Status: Active » Reviewed & tested by the community
StatusFileSize
new3.77 KB

with metadata assertion

dww’s picture

Status: Reviewed & tested by the community » Needs work

Yay, but... ;)

A) assertIssueMetadata() needs a PHPdoc comment

B) the assertions from function testProjectIssueMetadata() could just be merged into testProjectIssueCreation()

C) I can never remember WTF += vs. array_merge() does. Maybe a reminder comment somewhere? ;)

Thanks!

dmitrig01’s picture

Status: Needs work » Needs review
StatusFileSize
new0 bytes

fixed

dmitrig01’s picture

StatusFileSize
new4.27 KB
dww’s picture

Status: Needs review » Fixed

Committed a modified version of this based on some nice in-person debugging here at DCSF (DamZ's Field API talk)...

Status: Fixed » Closed (fixed)

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