Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Command/RectorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ protected function runRector(ConsoleIo $io, Arguments $args, string $autoload):

$cmdPath = ROOT . '/vendor/bin/rector process';
$command = sprintf(
'%s %s %s --autoload-file=%s --config=%s %s --clear-cache',
'%s %s %s %s --autoload-file=%s --config=%s %s --clear-cache',
$cmdPath,
$args->getOption('dry-run') ? '--dry-run' : '',
$args->getOption('verbose') ? '--debug' : '',
$args->getOption('no-diff') ? '--no-diff' : '',
escapeshellarg($autoload),
escapeshellarg($config),
escapeshellarg($path),
Expand Down Expand Up @@ -199,6 +200,10 @@ protected function buildOptionParser(ConsoleOptionParser $parser): ConsoleOption
->addOption('dry-run', [
'help' => 'Enable to get a preview of what modifications will be applied.',
'boolean' => true,
])
->addOption('no-diff', [
'help' => 'Disable rector diff output which can cause issues with large files.',
'boolean' => true,
]);

return $parser;
Expand Down
10 changes: 10 additions & 0 deletions tests/TestCase/Command/RectorCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ public function testApplyAppDir()
$this->assertOutputContains('Rector applied successfully');
}

public function testApplyNoDiff()
{
$this->setupTestApp(__FUNCTION__);
$this->exec('upgrade rector --rules cakephp40 --dry-run --no-diff ' . TEST_APP);

$this->assertExitSuccess();
$this->assertOutputNotContains('begin diff');
$this->assertOutputContains('Rector applied successfully');
}

/**
* @return void
*/
Expand Down
Loading