Hi..

I'm currently doing simpletest cases for the services modules. I realized that json_server need some love also, so I've started to write a testcase for it.

After a DrupalGet request, The following assert is not working:

  $this->assertEqual($response['#data'], 'JSON server accepts POST requests only.', 'JSON server accepts POST requests only.');

Doing a isset($_POST) does not work, and $_SERVER['REQUEST_METHOD'] should be used, after that change the test does not fail.

The patch includes the simpletest file.

Note: due to json_decode creating an stdClass with the content, I would suggest removing the '#' character in #error and #data responses. There's no way to get the $content->#error element after doing json_decode on return from server, and should be casted as array.

CommentFileSizeAuthor
#1 610364_json_server_post_only.patch2.63 KBilo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ilo’s picture

Status: Active » Needs review
FileSize
2.63 KB
jdwfly’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

+1