Skip to content

Commit cd1b699

Browse files
authored
feat: add monica:getversion command (#6965)
1 parent a46e92b commit cd1b699

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

app/Console/Commands/GetVersion.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use Illuminate\Console\Command;
6+
7+
class GetVersion extends Command
8+
{
9+
/**
10+
* The name and signature of the console command.
11+
*
12+
* @var string
13+
*/
14+
protected $signature = 'monica:getversion';
15+
16+
/**
17+
* The console command description.
18+
*
19+
* @var string
20+
*/
21+
protected $description = 'Get current version of monica';
22+
23+
/**
24+
* Execute the console command.
25+
*/
26+
public function handle(): void
27+
{
28+
$this->line(config('monica.app_version'));
29+
}
30+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Tests\Unit\Commands;
4+
5+
use Tests\TestCase;
6+
7+
class GetVersionTest extends TestCase
8+
{
9+
/** @test */
10+
public function it_run_setup_command(): void
11+
{
12+
config(['monica.app_version' => '1.0.0']);
13+
14+
$this->artisan('monica:getversion')
15+
->expectsOutput('1.0.0')
16+
->assertExitCode(0);
17+
}
18+
}

0 commit comments

Comments
 (0)