TestingParty08: url() for internal urls need a thorough test

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

Compile urls with/without query, with/without fragment, absolute on/off and assert all that works when clean URLs are on and off. That wll be 16 url calls and asserts.

#1

kkaefer - August 17, 2008 - 14:12
Title:TestingParty08: url() for internal urls need a through test» TestingParty08: url() for internal urls need a thorough test

#2

swentel - August 17, 2008 - 16:23

Is url('cron.php') also considered as a internal url, or external (see issue http://drupal.org/node/296321) ?

#4

chx - October 12, 2008 - 02:39

Internal means a Drupal path handled by the menu system.

#5

R.Muilwijk - October 16, 2008 - 09:03
Assigned to:Anonymous» R.Muilwijk

#6

R.Muilwijk - October 16, 2008 - 13:06

I'm having problems doing this test... the problem is in the code of url:

  static $script;
  static $clean_url;

  if (!isset($script)) {
    // On some web servers, such as IIS, we can't omit "index.php". So, we
    // generate "index.php?q=foo" instead of "?q=foo" on anything that is not
    // Apache.
    $script = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === FALSE) ? 'index.php' : '';
  }

  // Cache the clean_url variable to improve performance.
  if (!isset($clean_url)) {
    $clean_url = (bool)variable_get('clean_url', '0');
  }

as you can see $script and $clean_url are saved in a static which means this function can only be tested in different page loads with fake modules or something.. is that the way to go?

AttachmentSize
url_test.patch 3.41 KB
Testbed results
url_test.patchfailedFailed: 7318 passes, 3 fails, 0 exceptions Detailed results

#7

lilou - October 16, 2008 - 23:53
Status:active» needs review

#8

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

The last submitted patch failed testing.

#9

lilou - November 17, 2008 - 14:17

#10

System Message - November 18, 2008 - 15:25
Status:needs review» needs work

The last submitted patch failed testing.

#11

kscheirer - June 18, 2009 - 18:22
Component:tests» base system

@lilou: that pastebin is expired, was there anything useful for this patch in there? I'd still like to see some tests for url() go in.

#12

lilou - June 19, 2009 - 21:27

@kscheirer : no, it was the list of issues.

#13

kscheirer - July 18, 2009 - 05:15
Assigned to:R.Muilwijk» kscheirer
Status:needs work» needs review

Here's an initial set of 16 tests, hopefully what chx was looking for. R.Muilwijk, I think you were trying to check for too many possible configurations, so I tried to keep it simple. Maybe I have missed some possibilities though? Also moved the test into the same area as the rest of the l() and url() function tests.

AttachmentSize
url_test_1.patch 3.58 KB
Testbed results
url_test_1.patchre-testing

#14

pamelad - August 15, 2009 - 19:29
Assigned to:kscheirer» pamelad

Assigned to myself for review.

#15

pamelad - August 15, 2009 - 22:16

Patched looked good. I added two lines to test passing '< front >' as the first parameter (one line each for clean_url on/off).

AttachmentSize
url_test_1_1.patch 4.04 KB
Testbed results
url_test_1_1.patchpassedPassed: 12086 passes, 0 fails, 0 exceptions Detailed results

#16

cwgordon7 - August 16, 2009 - 03:02
Status:needs review» reviewed & tested by the community

Looks great, tests pass, RTBC.

#17

webchick - August 16, 2009 - 03:17
Status:reviewed & tested by the community» fixed

Heh. That's a clever way to write this test!

I couldn't find anything to complain about other than the lines are VERY long (but they're also t() strings which are long by nature) and PHPDoc didn't wrap at 80 chars, and... CRAP I meant to fix that before I committed but I forgot. I'll go start a novice issue. :P

Committed to HEAD. ;)

#18

webchick - August 16, 2009 - 03:25
Status:fixed» needs work

Eh. I'll just re-open this one. :)

Hello, Novice! Your task is to wrap the comment at the top of function testUrl() in modules/simpletest/tests/common.test at 80 characters. Thanks! :)

#19

dmitrig01 - August 16, 2009 - 15:48
Priority:critical» minor
Assigned to:pamelad» Anonymous

#20

JuliaKM - August 16, 2009 - 17:31
Status:needs work» needs review

Here's a patch to wrap the comments attached to testUrl() at 80 characters.

AttachmentSize
url_test_linebreak_296324.patch 784 bytes

#21

webchick - August 16, 2009 - 17:37
Status:needs review» fixed

Thank you Julia, for satisfying my inner neat freak. :)

Committed to HEAD.

#22

System Message - August 30, 2009 - 17:40
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.