On 12 Mar 2010, at 12:37, Jani Taskinen wrote:

On 03/12/2010 12:29 PM, Hannes Magnusson wrote:
On Fri, Mar 12, 2010 at 11:18, Jani Taskinen<jani.taski...@iki.fi> wrote:
Having tests in multiple branches is PITA. Hasn't anyone considered that the
best way would be to move all tests into their own repository
(directory..whatever :) in SVN..? Considering they are supposed to be used
for testing against regressions and BC breaks, they should always be
runnable using any PHP version?

Thats actually a fairly good idea.

Some tests however are not supposed to work in earlier releases, so we
need to either add a new
==SKIP-VERSION==
5.2, 5.1, 5.0

Perhaps something like required min version is better.

Any ideas who has been working on the improved test stuff? Or was that just a dream?

I'd rather just check for whether a feature exists or not, rather than hard-coding version numbers in tests. For example, hat happens if the PHP 5.3/6 case repeats itself, with more and more being backported? Do we need to go through and change skip-version metadata on hundreds of tests? Could we not just check that, e.g., "get_called_class" exists?

With such feature testing (in skipif?) we could just do something along the lines of:

---FILE---
<?php
if (version_compare(PHP_VERSION, '5.3', '>=') && function_exists('get_called_class'))
        echo 'PASS';
elseif (version_compare(PHP_VERSION, '5.3', '<') && ! function_exists('get_called_class'))
        echo 'PASS';
else
        echo 'FAIL';
?>
--EXPECTF--
PASS

Then, through the magic of logic, we would be guaranteed to have the right results for each version if all tests pass, and only one place to change when backporting/removing a feature.

-g

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to