Skip to content

Commit 07d87ba

Browse files
author
m-tanabe
committed
Add tests for exclusion of specified origin
1 parent f7515f0 commit 07d87ba

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
namespace Tests\Feature;
4+
5+
use Illuminate\Support\Facades\Artisan;
6+
use Illuminate\Support\Facades\DB;
7+
use Tests\TestCase;
8+
9+
final class ExcludedOriginsTest extends TestCase
10+
{
11+
public function setUp(): void
12+
{
13+
parent::setUp();
14+
$this->app = $this->createApplication();
15+
}
16+
17+
public function testExcludedOriginsWithParams()
18+
{
19+
putenv('EXCLUDED_ORIGINS=origin1,origin2');
20+
Artisan::call('generate');
21+
$this->assertDatabaseHas(
22+
'execution_logs',
23+
[
24+
'id' => 1,
25+
'translated' => 13,
26+
'failed' => 1,
27+
'last_id' => 17,
28+
],
29+
'log'
30+
);
31+
}
32+
33+
public function testExcludedOriginsWithoutParams()
34+
{
35+
putenv('EXCLUDED_ORIGINS=');
36+
Artisan::call('generate');
37+
$this->assertDatabaseHas(
38+
'execution_logs',
39+
[
40+
'id' => 1,
41+
'translated' => 15,
42+
'failed' => 1,
43+
'last_id' => 17,
44+
],
45+
'log'
46+
);
47+
}
48+
49+
public function tearDown(): void
50+
{
51+
parent::tearDown();
52+
$this->createApplication();
53+
DB::connection('log')->table('failed_logs')->truncate();
54+
DB::connection('log')->table('execution_logs')->truncate();
55+
}
56+
}

0 commit comments

Comments
 (0)