Re: writing tests

From: Date: Fri, 17 Oct 2008 17:29:11 +0000
Subject: Re: writing tests
References: 1 2  Groups: php.qa 
Request: Send a blank email to php-qa+get-64464@lists.php.net to get a copy of this message
On Fri, Oct 17, 2008 at 7:16 PM, zoe <zoe.slattery@googlemail.com> wrote: > till wrote: >> >> Aloha, >> >> wanted to ask who would be up to give me some feedback on tests and >> where would I submit them in the end? >> >> Since I am not the uber-leet hacker (someone mentioned on >> http://qa.php.net), I thought I could help out in another >> way. >> >> Here would be my first: >> http://www.friendpaste.com/wqds2cg3 >> > > Hi - I had a quick look. This behaviour is currently wrong in PHP52 and > right in PHP53 and PHP6. It would be a good test if it showed the intended > behaviour, because it seems to me to be non-obvious. In the test you are > also relying on someone having set a TZ environmental variable, which I > hadn't, so you should use an --INI-- section. > > So, here is the test after my modifications: > > --TEST-- > strtotime() function - a test to show the difference in behaviour between > 'first' and '1' > --INI-- > date.timezone="Europe/London" > --SKIPIF-- > <?php if (!function_exists('strtotime')) echo "SKIP"; ?> > --FILE-- > <?php > var_dump(date('Y-m-d', strtotime('first Monday December 2008'))); > var_dump(date('Y-m-d', strtotime('1 Monday December 2008'))); > ?> > --EXPECT-- > string(10) "2008-12-08" > string(10) "2008-12-01" > > > Would you run it and let me know if you agree with the changes? I am not sure... :-) "first" and "1" should both output 2008-12-01. But neither does - at least on 5.2.6. I remember that Scott helped me last night on IRC and I think the only he found working was 5.3-alpha3-dev (or similar :-)). I probably didn't write enough in my first email, but the problem is that "first" and "1" both fail. I was more concerned about "first" though - but testing both in one is perfectly fine. > In general sending tests to this list is the best place to start. OK, great. Till

« previous php.qa (#64464) next »