Create tests for PSR-4 classes, refactor oldtests#730
Merged
mblaney merged 84 commits intosimplepie:masterfrom May 19, 2022
Merged
Create tests for PSR-4 classes, refactor oldtests#730mblaney merged 84 commits intosimplepie:masterfrom
mblaney merged 84 commits intosimplepie:masterfrom
Conversation
Add changes from simplepie#716
Contributor
Author
|
For the migration of the tests from the <?php
// change the foldername you want to migrate
$foldername = 'first_item_title';
$combined = '';
$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'oldtests' . DIRECTORY_SEPARATOR . $foldername;
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS));
foreach($files as $file_path => $info)
{
$contents = file_get_contents($file_path);
$contents = trim($contents);
$contents = str_replace('Atom_03', 'Atom_0.3', $contents);
$contents = str_replace('Atom_10', 'Atom_1.0', $contents);
$contents = str_replace('DC_10', 'DC_1.0', $contents);
$contents = str_replace('DC_11', 'DC_1.1', $contents);
$contents = str_replace('RSS_09', 'RSS_0.9', $contents);
$contents = str_replace('RSS_10', 'RSS_1.0', $contents);
$contents = str_replace('RSS_20', 'RSS_2.0', $contents);
$contents = str_replace('_Netscape', '-Netscape', $contents);
$contents = str_replace('_Userland', '-Userland', $contents);
$contents = str_replace(' extends ', '\' => [ extends ', $contents);
$contents = str_replace('class ', " '", $contents);
$contents = str_replace(' $this->data =', "<<<EOT\n", $contents);
$contents = str_replace("<?php\n", '', $contents);
$contents = str_replace("\n?>", '', $contents);
$combined .= $contents . "\n\n";
}
$combined = "<?php\n\t\treturn [\n" . $combined . "\n\n\t\t];\n";
file_put_contents($path . DIRECTORY_SEPARATOR . 'combined.php', $combined); |
Contributor
Author
|
This PR is ready for review, but still relies on merging of #722. |
Add tests to ensure BC
Credits to @thomasrenes See FreshRSS/FreshRSS@916df41
Contributor
Author
|
I resolved all merge conflicts after merge of #722. |
Member
|
In general I would say the copyright year shouldn't change when it's the only modification to a file, but all good for now. |
Contributor
Author
|
Thank you. I agree with you in principle about the year but it was a follow up change from #727 to keep all headers consistent. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The goal of this PR is to copy and revise as many tests as possible to test against the PSR-4 (namespaced) classes. The old tests for PSR-0 (without namespaces) will remain untouched if possible to ensure BC.
Update: After working my way through the
oldtestsfolder, I decided to migrate these very old tests directly after all, to minimize future workload.This PR relies on merging #722 and still needs some work.
This PR is a subtask of #731.