diff --git a/app/Commands/FeedCommand.php b/app/Commands/FeedCommand.php index e950bd6a238..4eef1a10fc8 100644 --- a/app/Commands/FeedCommand.php +++ b/app/Commands/FeedCommand.php @@ -17,6 +17,7 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Date; use Illuminate\Support\Facades\File; +use Illuminate\Support\Facades\Process; use Laminas\Feed\Writer\Feed; /** @@ -84,9 +85,7 @@ static function (Collection $carry, string $line) use (&$date): Collection { $feed->addEntry($entry); }); - $feed->count() - ? $feed->setDateModified($feed->getEntry()->getDateModified()) - : $feed->setDateModified(new \DateTimeImmutable); + $feed->setDateModified($feed->getEntry()->getDateModified()); foreach (['atom', 'rss'] as $type) { $name = "README.$type"; @@ -94,6 +93,12 @@ static function (Collection $carry, string $line) use (&$date): Collection { File::put(base_path($name), $feed->export($type)); } }) + ->tap(fn () => Process::run( + 'git diff --color README.*', + function (string $type, string $line): void { + $this->output->write($line); + } + )) ->tap(fn () => $this->output->success('Feed is done!')); } diff --git a/tests/Feature/FeedCommandTest.php b/tests/Feature/FeedCommandTest.php index 0af7d5fadbe..a891ddb67e7 100755 --- a/tests/Feature/FeedCommandTest.php +++ b/tests/Feature/FeedCommandTest.php @@ -16,14 +16,14 @@ use App\Commands\FeedCommand; -it('will throw an InvalidArgumentException', function (): void { +it('will throw an InvalidArgumentException of Symfony', function (): void { $this->artisan(FeedCommand::class, ['--from' => $this->faker()->filePath()]); })->group(__DIR__, __FILE__)->throws(\Symfony\Component\Console\Exception\InvalidArgumentException::class); -it('can generate empty feed', function (): void { +it('will throw an InvalidArgumentException of Laminas', function (): void { $this->artisan(FeedCommand::class, ['--from' => fixtures_path('README.md')])->assertOk(); -})->group(__DIR__, __FILE__); +})->group(__DIR__, __FILE__)->throws(\Laminas\Feed\Writer\Exception\InvalidArgumentException::class); it('can generate feed', function (): void { $this->artisan(FeedCommand::class)->assertOk(); -})->group(__DIR__, __FILE__)->depends('it can generate empty feed'); +})->group(__DIR__, __FILE__);