Skip to content

test: Add skipif() helper for SKIPIF sections - #25032

Open
jorgsowa wants to merge 2 commits into
php:masterfrom
jorgsowa:run-tests-skipif
Open

jorgsowa wants to merge 2 commits into
php:masterfrom
jorgsowa:run-tests-skipif

Conversation

@jorgsowa

Copy link
Copy Markdown
Contributor

Provide skipif($condition, $reason) via auto_prepend_file as a clearer alternative to die('skip ...'). Convert a few tests and replace the conflicting local skipif() helpers in ext/xml and windows_acls tests.

I was also thinking about function name skip_if().

This may resolve some of the confusion I had in the past and other contributors across the years:

Provide skipif($condition, $reason) via auto_prepend_file as a clearer
alternative to die('skip ...'). Convert a few tests and replace the
conflicting local skipif() helpers in ext/xml and windows_acls tests.
Comment thread run-tests.php Resolved
Comment thread run-tests.php Resolved
A predictable name in the shared temp dir let other users plant a file
whose code would run in every SKIPIF.
@jorgsowa

Copy link
Copy Markdown
Contributor Author

@TimWolla I applied the comments from review. Thanks for review. What do you think about helper approach? Does it make sense to backport it to 8.4 if it's good idea?

@TimWolla

Copy link
Copy Markdown
Member

Does it make sense to backport it to 8.4 if it's good idea?

This is a feature (even if only used internally) and thus acceptable for master only.

@LamentXU123 LamentXU123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@LamentXU123 LamentXU123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more question

Comment thread run-tests.php
return $tb - $ta;
}

// Functions available to every SKIPIF section via auto_prepend_file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think phpdbg SAPI doesn't excute auto_prepend_file?

--TEST--
SKIPIF helper in phpdbg
--SKIPIF--
<?php skipif(true, 'helper works'); ?>
--PHPDBG--
r
q
--FILE--
<?php echo "ok\n"; ?>
--EXPECT--
ok

This doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants