TestingParty08: external URL options need a test

chx - August 17, 2008 - 08:10
Project:Drupal
Version:7.x-dev
Component:base system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Assert that calling url() with an external URL

  1. containing a fragment works with and without a fragment in $options.
  2. containing or not containing a query works with a query in $options.

#1

domas - August 31, 2008 - 08:37
Priority:critical» minor

Working on it..

#2

domas - August 31, 2008 - 09:18
Priority:minor» normal
Status:active» needs review

Here's a patch to modules/simpletest/tests/common.test, providing the test. I'm not completely sure if this is the way it's supposed to be. If I've missed anything, please let me know.

AttachmentSizeStatusTest resultOperations
url_test.patch2.16 KBIdleFailed: 7077 passes, 108 fails, 6667 exceptionsView details | Re-test

#3

redndahead - October 12, 2008 - 02:16
Status:needs review» needs work

Patch apply's and works but there were coding standard violations. Spaces around concatenation, spaces in front of comments and caps at beginning of comments.

AttachmentSizeStatusTest resultOperations
url_test_1.patch2.1 KBIdleFailed: Failed to install HEAD.View details | Re-test

#4

redndahead - October 12, 2008 - 02:18
Status:needs work» needs review

Whoops forgot to change back

#5

dmitrig01 - October 12, 2008 - 02:19
Status:needs review» reviewed & tested by the community

I've reviewed this, it's good.

#6

webchick - October 12, 2008 - 04:00
Status:reviewed & tested by the community» needs work

Since this is a testing party patch, I'm going to be very nit-picky in this review. It's only because I care. :)

<?php
+class UrlTestCase extends DrupalWebtestCase {
?>

Let's add a PHPdoc block with a quick sentence that summarizes what this test case does.

<?php
+      'description' => t("Performs tests on the url() function"),
?>

a) Should be single quotes, not double, since there's no interpolation going on.
b) Should end in a period.

<?php
+      'group' => t('System')
?>

Should be a comma at the end of this line. I know it looks like a mistake, but it's the standards. :)

<?php
/*
+   * Test case
+   * Assert that calling url() with an external URL
+   *   1. containing a fragment works with and without a fragment in $options.
+   *   2. containing or not containing a query works with a query in $options.
+   */
?>

a) /* needs to be /**
b) Test case isn't very descriptive. I would replace that with a one-sentence summary, like "Test the url() function's $options array." Make sure there's a newline between this sentence and the lines below it with more detail.

<?php
+    $this->assertEqual($test_url . '&' . $query2, $result_url, t('External URL with a query'));
...
+   
$this->assertEqual($test_url . '?' . $query2, $result_url, t('External URL without a query.'));
?>

The last messages were nice and descriptive as to what was being tested. These two, a little less so...

<?php
+    $test_url = 'http://www.drupal.org';
?>

That's weird that the code below passes. Looks like this needs a trailing /.

That's it. :) Thanks a lot!!

#7

redndahead - October 12, 2008 - 17:36
Status:needs work» needs review

Hopefully this one is better.

url('http://drupal.org', array('query' => 'param1');

returns http://drupal.org?param1

So the ending slash is not needed.

AttachmentSizeStatusTest resultOperations
url_test_2.patch2.35 KBIdleFailed: Failed to install HEAD.View details | Re-test

#8

redndahead - October 12, 2008 - 17:47

Added the test function to the other descriptions.

AttachmentSizeStatusTest resultOperations
url_test_3.patch2.45 KBIdleFailed: Failed to apply patch.View details | Re-test

#9

System Message - November 16, 2008 - 21:50
Status:needs review» needs work

The last submitted patch failed testing.

#10

redndahead - November 17, 2008 - 08:04
Status:needs work» needs review

#11

catch - November 20, 2008 - 09:48
Status:needs review» needs work

getInfo() should no longer have PHPdoc, see http://drupal.org/node/325974

Also it looks like the calls to t() could use double quotes to save escaping the single quotes.

#12

lilou - June 14, 2009 - 18:39
Component:tests» base system
Status:needs work» needs review

Reroll according to #11.

AttachmentSizeStatusTest resultOperations
issue-296319.patch2.64 KBIgnoredNoneNone

#13

lilou - June 14, 2009 - 18:41
Component:base system» simpletest.module

#14

mr.baileys - June 15, 2009 - 10:09

@lilou: link to patch in #12 doesn't seem to be working (directs me to the d.o. home page), and the testbot isn't picking this one up for testing. Could you re-upload?

#15

lilou - June 15, 2009 - 19:36
AttachmentSizeStatusTest resultOperations
issue-296319.patch2.64 KBIdleFailed: 11120 passes, 0 fails, 2 exceptionsView details | Re-test

#16

System Message - June 15, 2009 - 19:50
Status:needs review» needs work

The last submitted patch failed testing.

#17

lilou - June 15, 2009 - 22:08
Status:needs work» needs review

Now tests may passes.

AttachmentSizeStatusTest resultOperations
issue-296319.patch2.64 KBIdleFailed: 11627 passes, 0 fails, 1 exceptionView details | Re-test

#18

System Message - June 28, 2009 - 02:35
Status:needs review» needs work

The last submitted patch failed testing.

#19

Dave Reid - July 9, 2009 - 02:53
Component:simpletest.module» base system

Moving to the appropriate component since url() is base of the base system.

#20

kscheirer - July 19, 2009 - 03:48
Status:needs work» needs review

tests look good, all pass. rerolled against HEAD.

AttachmentSizeStatusTest resultOperations
issue-296319_2.patch2.46 KBIdlePassed: 12092 passes, 0 fails, 0 exceptionsView details | Re-test

#21

lilou - July 19, 2009 - 12:16

Attached patch remove t() in getinfo() (#500866: Simpletest: remove t() from assert message, test getInfo(), etc).

AttachmentSizeStatusTest resultOperations
issue-296319-21.patch2.71 KBIdlePassed: 12122 passes, 0 fails, 0 exceptionsView details | Re-test

#22

System Message - August 5, 2009 - 22:35
Status:needs review» needs work

The last submitted patch failed testing.

#23

kscheirer - August 14, 2009 - 01:42
Status:needs work» reviewed & tested by the community

Patch applied without fuzz and tests pass. Not sure why testbot is complaining of a warning in the Javascript test.

As a side note though, we now have 3 tests in the System group that all deal with the url() function:

  • Tests for the url() function - Performs tests on the url() function. (this patch)
  • URL generation tests - Confirm that url(), drupal_query_string_encode(), and l() work correctly with various input.
  • Valid Url - Performs tests on Drupal's valid url function.

#24

webchick - August 15, 2009 - 06:30
Status:reviewed & tested by the community» fixed

Whoops. Sorry this took so long to get back on my radar. :\

Committed to HEAD, thanks!

#25

System Message - August 29, 2009 - 06:40
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.