Skip to content
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

Add e2e tests for dry run #3616

Merged
merged 1 commit into from
Apr 15, 2023
Merged

Conversation

yguedidi
Copy link
Contributor

@yguedidi
Copy link
Contributor Author

@samsonasik this is the easiest way I found to test that dry run works properly, what do you think?

@yguedidi yguedidi marked this pull request as draft April 14, 2023 22:10
@yguedidi
Copy link
Contributor Author

@samsonasik not ready yet, missed that the 2nd run must use the cache..

@yguedidi
Copy link
Contributor Author

@samsonasik now it works! 🎉

See it makes a broken version of #3614 (same code as #3604) fail that test: https://github.com/rectorphp/rector-src/actions/runs/4704720583/jobs/8344596305?pr=3614

use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->cacheClass(FileCacheStorage::class);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the added line to the config from the original e2e/applied-rule-removed-node folder.
It makes the cache persistent between job steps

// so we can use helper classes here
require_once __DIR__ . '/../vendor/autoload.php';

$e2eCommand = 'php '. $rectorBin .' process --dry-run --no-ansi -a '. $autoloadFile;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This runner is a lighter version of the original one, removing the --clear-cache here, and support for custom parameters because they are not needed for now

@yguedidi yguedidi marked this pull request as ready for review April 14, 2023 23:55
Copy link
Member

@samsonasik samsonasik left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@samsonasik samsonasik merged commit 4c06d4c into rectorphp:main Apr 15, 2023
@samsonasik
Copy link
Member

Thank you @yguedidi

@yguedidi yguedidi deleted the dry-run-e2e-tests branch April 15, 2023 11:14
samsonasik pushed a commit that referenced this pull request May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants