Re: writing tests

From: Date: Tue, 21 Oct 2008 09:44:30 +0000
Subject: Re: writing tests
References: 1 2 3  Groups: php.qa 
Request: Send a blank email to php-qa+get-64468@lists.php.net to get a copy of this message
Hi till After some more discussion with Derick I've committed this test: http://www.pastebin.ca/1232594. This has gone into PHP53 and PHP6 as it is. I've added the same test to PHP52 but with an --XFAIL-- section referencing bug 43452. It was good that you raised this, the behaviour is hard to understand and not consistent with the current PHP documentation - although I believe that this will be soon be updated. Thanks Zoe till wrote:
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 (#64468) next »