-
Notifications
You must be signed in to change notification settings - Fork 7.9k
run-tests.php: class for test file loading #6678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
$tested = $test->getName(); | ||
|
||
if ($num_repeats > 1 && $test->hasSection('FILE_EXTERNAL')) { | ||
return skip_test($tested, $tested_file, $shortname, 'Test with FILE_EXTERNAL might not be repeatable'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you verify that this still works (--repeat 2
on ext/phar
should do it I think)? IIRC the FILE_EXTERNAL section gets dropped during processing and can't be checked here anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by removing the unset()
, it's not needed for anything.
if ($this->hasSection('REDIRECTTEST')) { | ||
if ($inRedirect) { | ||
throw new BorkageException("Can't redirect a test from within a redirected test"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Early return here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
run-tests.php
Outdated
|
||
public function getSection(string $name): string | ||
{ | ||
return $this->sections[$name] ?? throw new Exception("Section $name not found"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only valid in PHP 8.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This moves a bunch of code outside of run_tests(), making it a bit more manageable. Additionally, accessors provide better readability than isset() and friends. This is a minimal patch that moves the code but does not refactor much. For the sake of reviewing experience, it does not involve further refactoring which could include: * Removing setSection() * Fixing up the mess with hasSection() vs. sectionNotEmpty(), only one of which is really needed. * Moving more repetitive code into the new class. All of this will be done with later commits.
This moves a bunch of code outside of run_tests(), making it a bit
more manageable. Additionally, accessors provide better readability
than isset() and friends.
This is a minimal patch that moves the code but does not refactor
much. For the sake of reviewing experience, it does not involve
further refactoring which could include:
one of which is really needed.
All of this will be done with later commits.
Verification:
./run-tests.php ext/phar --repeat 2
produces no failures.