This repository was archived by the owner on Feb 20, 2025. It is now read-only.
File tree 5 files changed +19
-25
lines changed
5 files changed +19
-25
lines changed Original file line number Diff line number Diff line change @@ -41,12 +41,6 @@ protected function deleteFiles(): void
41
41
42
42
protected function copyEnv (): void
43
43
{
44
- $ filename = $ this ->envSourceFilename ();
45
-
46
- copy (__DIR__ . '/../fixtures/ ' . $ filename , base_path ('.env ' ));
47
- }
48
-
49
- protected function envSourceFilename (): string
50
- {
44
+ copy (__DIR__ . '/../fixtures/ ' . $ this ->fixture_source , base_path ('.env ' ));
51
45
}
52
46
}
Original file line number Diff line number Diff line change 4
4
5
5
trait Files
6
6
{
7
+ protected $ fixture_expected = 'expected ' ;
8
+
9
+ protected $ fixture_source = 'source ' ;
10
+
7
11
protected function source (): string
8
12
{
9
13
return $ this ->fixtures ('source ' );
10
14
}
11
15
12
- protected function expected (bool $ config = false ): string
16
+ protected function expected (): string
13
17
{
14
- $ filename = $ config ? 'expected-config ' : 'expected ' ;
15
-
16
- return $ this ->fixtures ($ filename );
18
+ return $ this ->fixtures ($ this ->fixture_expected );
17
19
}
18
20
19
21
protected function actual (): string
Original file line number Diff line number Diff line change 7
7
8
8
final class ConfigurableTest extends LaravelTestCase
9
9
{
10
+ protected $ fixture_expected = 'expected-config ' ;
11
+
12
+ protected $ fixture_source = 'source-config ' ;
13
+
10
14
public function testCommand ()
11
15
{
12
16
$ this ->artisan ('env:sync ' )->assertExitCode (0 )->run ();
13
17
14
18
$ this ->assertFileExists (base_path ('.env.example ' ));
15
- $ this ->assertFileEquals ($ this ->expected (true ), base_path ('.env.example ' ));
19
+ $ this ->assertFileEquals ($ this ->expected (), base_path ('.env.example ' ));
16
20
}
17
21
18
22
public function testCustomPath ()
19
23
{
20
24
$ this ->artisan ('env:sync ' , ['--path ' => base_path ()]);
21
25
22
26
$ this ->assertFileExists (base_path ('.env.example ' ));
23
- $ this ->assertFileEquals ($ this ->expected (true ), base_path ('.env.example ' ));
27
+ $ this ->assertFileEquals ($ this ->expected (), base_path ('.env.example ' ));
24
28
}
25
29
26
30
public function testCustomPathFailed ()
@@ -30,11 +34,6 @@ public function testCustomPathFailed()
30
34
$ this ->artisan ('env:sync ' , ['--path ' => base_path ('foo ' )])->run ();
31
35
}
32
36
33
- protected function envSourceFilename (): string
34
- {
35
- return 'source-config ' ;
36
- }
37
-
38
37
protected function getEnvironmentSetUp ($ app )
39
38
{
40
39
/** @var \Illuminate\Config\Repository $config */
Original file line number Diff line number Diff line change @@ -29,9 +29,4 @@ public function testCustomPathFailed()
29
29
30
30
$ this ->artisan ('env:sync ' , ['--path ' => base_path ('foo ' )])->run ();
31
31
}
32
-
33
- protected function envSourceFilename (): string
34
- {
35
- return 'source ' ;
36
- }
37
32
}
Original file line number Diff line number Diff line change 11
11
12
12
final class ConfigurableTest extends OtherTestCase
13
13
{
14
+ protected $ fixture_expected = 'expected-config ' ;
15
+
16
+ protected $ fixture_source = 'source-config ' ;
17
+
14
18
public function testContent ()
15
19
{
16
20
$ service = $ this ->service ();
17
21
18
22
$ service ->from ($ this ->source ());
19
23
20
- $ this ->assertStringEqualsFile ($ this ->expected (true ), $ service ->cleaned ());
24
+ $ this ->assertStringEqualsFile ($ this ->expected (), $ service ->cleaned ());
21
25
}
22
26
23
27
public function testStoring ()
@@ -30,7 +34,7 @@ public function testStoring()
30
34
$ service ->store ();
31
35
32
36
$ this ->assertFileExists ($ this ->actual ());
33
- $ this ->assertFileEquals ($ this ->expected (true ), $ this ->actual ());
37
+ $ this ->assertFileEquals ($ this ->expected (), $ this ->actual ());
34
38
}
35
39
36
40
protected function service (): Syncer
You can’t perform that action at this time.
0 commit comments