Closed (fixed)
Project:
SimpleTest
Version:
6.x-2.8
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Jun 2009 at 00:23 UTC
Updated:
10 Jun 2009 at 07:56 UTC
I used a line similar to this one to edit a node:
$this->drupalPost("node/{$nid}/edit", array('body' => 'Hi!', 'status' => 0, 'promote' => 0), 'Save');
I discovered that the body had been changed (and the $node->changed timestamp changed as well), but the 'status' and 'promote' values were still both 1 as they were before. There were no other errors other than those unexpected values (e.g.: SimpleTest didn't tell me it couldn't find the status and promote fields when I attempted to submit the form via drupalPost).
Comments
Comment #1
boombatower commentedPer documentation, checkboxes should be set with TRUE or FALSE. Although since PHP is not type strick I am not sure this is the issue.
Comment #2
Mike Wacker commentedJust replaced 0 with FALSE and I got the same results. Also, when I replicate this on Drupal 7, I get three extra errors that I don't see in Drupal 6:
"Failed to set field status to" (must have trouble writing out FALSE)
"Failed to set field promote to"
"Found the requested form fields at node/1/edit"
Should I also file this against core as well?
Comment #3
dave reidI bet I know the problem. Make sure your testing user has the 'administer nodes' permission. Otherwise, those fields are not editable/visible to your testing user.
Comment #4
boombatower commentedA good debug tool that can be placed after the drupalPost() to see what SimpleTest was looking at it:
Comment #5
Mike Wacker commentedI'll look into it more, but the user definitely has 'administer nodes' permission. Plus, if that were the issue, then the node's body would not have been updated.
Comment #6
Mike Wacker commentedSo playing around some more, I discovered that changing 0 to FALSE does actually work. I wonder if the issue of 0 and FALSE being different is easy to fix, though; maybe a simple boolean cast will do the trick.
I had some issues syncing files, which is what made things go wrong earlier when I changed 0 to FALSE. However, I haven't figured it out yet for Drupal 7, where I don't have any file syncing issues. I'll investigate that some more and file a core bug if I discover something.