drupal_http_request triggers error in addition to returning it & test cleanup

boombatower - August 14, 2008 - 23:44
Project:Drupal
Version:7.x-dev
Component:tests
Category:task
Priority:critical
Assigned:boombatower
Status:closed
Description

When running the Drupal HTTP request test an exception in generated. That can be removed by adding @ to parse_url().

Since the code checks to make sure that it parsed the URL successfully and returns error messages anyway it would seem to make sense that the function would mask the errors triggered.

Updated test to include actual page fetch test.

AttachmentSizeStatusTest resultOperations
drupal_http_request.test.patch1.63 KBIgnoredNoneNone

#1

obsidiandesign - August 15, 2008 - 03:13

Is this a different approach/related to #283806: Notice appears when drupal_http_request called with an invalid URL? I found both when searching for information about the Drupal HTTP request test.

#2

boombatower - August 15, 2008 - 05:35

I've commented on the other issue.

#3

catch - August 15, 2008 - 08:12
Priority:normal» critical

Crtical since this is now our only remaining test with any kind of breakage, review forthcoming.

#4

catch - August 15, 2008 - 08:46
Status:needs review» reviewed & tested by the community

Makes sense to me to rely on our internal error handling and suppress the php warnings in the function call rather than just the test. This removes the exception, adds an extra test, lovely.

#5

Damien Tournoud - August 15, 2008 - 14:23
Status:reviewed & tested by the community» needs work

Please we can do better than that:

<?php
+    $this->assertTrue(strpos($result->data, '<title>' . variable_get('site_name', 'Drupal') . '</title>') !== FALSE, t('Site title matches.'));
?>

#6

boombatower - August 15, 2008 - 16:28

Meaning get rid of !== FALSE? The reason that is there is I'm not sure if assertTrue is type strict. If not that strpos returning 0 would fail even thought that is success.

Since the page should never have the as the first character we could consider that a fail anyway. I'll remove the !== FALSE.

#7

boombatower - August 15, 2008 - 16:30
Status:needs work» needs review

Updated, per #5-6.

AttachmentSizeStatusTest resultOperations
drupal_http_request.test.patch1.62 KBIgnoredNoneNone

#8

boombatower - August 15, 2008 - 17:03
Status:needs review» reviewed & tested by the community

Still passes and already reviewed per #4.

#9

Damien Tournoud - August 15, 2008 - 17:06
Status:reviewed & tested by the community» needs review

I should have been clearer. I meant that we have a whole facility for asserting things on pages with DrupalWebTestCase, we should use it.

AttachmentSizeStatusTest resultOperations
295564-drupal-http-request.test.patch3.3 KBIgnoredNoneNone

#10

Damien Tournoud - August 15, 2008 - 17:17

Oups, here is a new version that fixes an exception in DrupalWebTestCase::getUrl().

AttachmentSizeStatusTest resultOperations
295564-drupal-http-request.test.patch3.75 KBIgnoredNoneNone

#11

boombatower - August 15, 2008 - 19:12

I realized that, but didn't use it since you can't without setting the content. Wasn't sure that was something we wanted to do.

I like what you've done, I'll take a look at it shortly.

#12

boombatower - August 15, 2008 - 19:20
Status:needs review» reviewed & tested by the community

I like that you can set the content now, it has grown on me after thinking about it. I have added a more detailed description of the uses for drupalSetContent() and fixed a formatting issue related to the function indentation.

The test still passes and we both have reviewed this format.

AttachmentSizeStatusTest resultOperations
drupal_http_request.test.patch3.94 KBIgnoredNoneNone

#13

Dries - August 16, 2008 - 07:31
Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Thanks.

#14

boombatower - August 16, 2008 - 20:16

That means we are at 100% pass!

#15

webchick - August 16, 2008 - 20:23

YYYYAAAAAAAAAYYYYYYYYYY!!!!!!!!!

Best. Day. EVER! :)

#16

mustafau - August 22, 2008 - 17:07

The tests committed with this patch were reverted by the DB:TNG patch. See: http://cvs.drupal.org/viewvc.py/drupal/drupal/modules/simpletest/tests/c...

#17

Damien Tournoud - August 22, 2008 - 17:22
Status:fixed» needs work

#18

boombatower - August 23, 2008 - 03:57
Status:needs work» reviewed & tested by the community

Doesn't it just need to be reapplied...not worked on?

#19

Dries - August 23, 2008 - 08:00
Status:reviewed & tested by the community» needs work

Doesn't apply.

#20

mustafau - August 23, 2008 - 08:18
Status:needs work» reviewed & tested by the community

Re-roll.

AttachmentSizeStatusTest resultOperations
drupal_http_request.test_2.patch1.11 KBIgnoredNoneNone

#21

boombatower - August 23, 2008 - 20:18

Test still passes after applicate, as before...looks good.

#22

boombatower - August 26, 2008 - 17:58
Status:reviewed & tested by the community» duplicate

edit: wrong issue.

#23

boombatower - August 26, 2008 - 17:57
Status:duplicate» reviewed & tested by the community

#24

Dries - August 29, 2008 - 08:30
Status:reviewed & tested by the community» needs work

Code no longer applies.

#25

mustafau - August 29, 2008 - 14:14
Status:needs work» reviewed & tested by the community

Patch at #20 still applies.

#26

Dries - August 29, 2008 - 14:45
Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Thanks.

temp

Anonymous (not verified) - September 12, 2008 - 14:53

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

temp

Anonymous (not verified) - September 12, 2008 - 15:03

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

temp

Anonymous (not verified) - September 12, 2008 - 15:13

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

#27

Anonymous (not verified) - September 12, 2008 - 15:42
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.