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

[3.x] Improves console output #382

Merged
merged 3 commits into from Jul 25, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions composer.json
Expand Up @@ -16,10 +16,10 @@
"require": {
"php": "^8.0.2",
"ext-json": "*",
"illuminate/console": "^9.0",
"illuminate/contracts": "^9.0",
"illuminate/database": "^9.0",
"illuminate/support": "^9.0"
"illuminate/console": "^9.21",
"illuminate/contracts": "^9.21",
"illuminate/database": "^9.21",
"illuminate/support": "^9.21"
},
"require-dev": {
"mockery/mockery": "^1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/Console/Commands/PruneExpired.php
Expand Up @@ -35,12 +35,12 @@ public function handle()

$model::where('created_at', '<', now()->subMinutes($expiration + ($hours * 60)))->delete();

$this->info("Tokens expired for more than {$hours} hours pruned successfully.");
$this->components->info("Tokens expired for more than [$hours hours] pruned successfully.");

return 0;
}

$this->warn('Expiration value not specified in configuration file.');
$this->components->warn('Expiration value not specified in configuration file.');

return 1;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/PruneExpiredTest.php
Expand Up @@ -60,7 +60,7 @@ public function test_can_delete_expired_tokens_with_integer_expiration()
]);

$this->artisan('sanctum:prune-expired --hours=2')
->expectsOutput('Tokens expired for more than 2 hours pruned successfully.');
->expectsOutputToContain('Tokens expired for more than [2 hours] pruned successfully.');

$this->assertDatabaseMissing('personal_access_tokens', ['name' => 'Test_1']);
$this->assertDatabaseHas('personal_access_tokens', ['name' => 'Test_2']);
Expand Down Expand Up @@ -89,7 +89,7 @@ public function test_cant_delete_expired_tokens_with_null_expiration()
]);

$this->artisan('sanctum:prune-expired --hours=2')
->expectsOutput('Expiration value not specified in configuration file.');
->expectsOutputToContain('Expiration value not specified in configuration file.');

$this->assertDatabaseHas('personal_access_tokens', ['name' => 'Test']);
}
Expand Down