Skip to content

Commit fae9365

Browse files
danielebarbarogithub-actions[bot]
authored andcommitted
Fix coding style issues with Pint 🤖
1 parent 60a94d5 commit fae9365

9 files changed

+172
-174
lines changed

‎tests/Unit/Commands/GeneratePackageCommandTest.php‎

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<?php
22

3-
use PlinCode\LaravelCleanArchitecture\Commands\GeneratePackageCommand;
43
use Illuminate\Filesystem\Filesystem;
54
use Illuminate\Support\Facades\File;
5+
use PlinCode\LaravelCleanArchitecture\Commands\GeneratePackageCommand;
66

77
describe('GeneratePackageCommand', function () {
88
beforeEach(function () {
9-
$this->filesystem = new Filesystem();
10-
$this->command = new GeneratePackageCommand($this->filesystem);
11-
$this->tempPath = sys_get_temp_dir() . '/test-package-' . uniqid();
12-
9+
$this->filesystem = new Filesystem;
10+
$this->command = new GeneratePackageCommand($this->filesystem);
11+
$this->tempPath = sys_get_temp_dir() . '/test-package-' . uniqid();
12+
1313
// Mock the output to avoid writeln errors
1414
$mockOutput = mock('Symfony\Component\Console\Output\OutputInterface');
1515
$mockOutput->shouldReceive('writeln')->andReturn();
1616
$mockOutput->shouldReceive('write')->andReturn();
17-
18-
$reflection = new ReflectionClass($this->command);
17+
18+
$reflection = new ReflectionClass($this->command);
1919
$outputProperty = $reflection->getProperty('output');
2020
$outputProperty->setAccessible(true);
2121
$outputProperty->setValue($this->command, $mockOutput);
@@ -34,7 +34,7 @@
3434

3535
it('has required arguments', function () {
3636
$definition = $this->command->getDefinition();
37-
37+
3838
expect($definition->hasArgument('name'))->toBeTrue();
3939
expect($definition->hasArgument('vendor'))->toBeTrue();
4040
expect($definition->getArgument('name')->getDescription())->toBe('The name of the package');
@@ -43,7 +43,7 @@
4343

4444
it('has correct options', function () {
4545
$definition = $this->command->getDefinition();
46-
46+
4747
expect($definition->hasOption('path'))->toBeTrue();
4848
expect($definition->hasOption('force'))->toBeTrue();
4949
expect($definition->getOption('path')->getDescription())->toBe('Custom path for the package');
@@ -52,13 +52,13 @@
5252

5353
it('can create package structure', function () {
5454
$reflection = new ReflectionClass($this->command);
55-
$method = $reflection->getMethod('createPackageStructure');
55+
$method = $reflection->getMethod('createPackageStructure');
5656
$method->setAccessible(true);
5757

5858
$packageName = 'test-package';
59-
$studlyName = 'TestPackage';
60-
$namespace = 'TestVendor\\TestPackage';
61-
$vendor = 'test-vendor';
59+
$studlyName = 'TestPackage';
60+
$namespace = 'TestVendor\\TestPackage';
61+
$vendor = 'test-vendor';
6262

6363
// Mock the filesystem to avoid actual file creation
6464
$mockFilesystem = mock(Filesystem::class);
@@ -76,21 +76,21 @@
7676

7777
it('can create package composer.json', function () {
7878
$reflection = new ReflectionClass($this->command);
79-
$method = $reflection->getMethod('createPackageComposer');
79+
$method = $reflection->getMethod('createPackageComposer');
8080
$method->setAccessible(true);
8181

8282
$packageName = 'test-package';
83-
$studlyName = 'TestPackage';
84-
$namespace = 'TestVendor\\TestPackage';
85-
$vendor = 'test-vendor';
83+
$studlyName = 'TestPackage';
84+
$namespace = 'TestVendor\\TestPackage';
85+
$vendor = 'test-vendor';
8686

8787
// Create temp directory
8888
$this->filesystem->makeDirectory($this->tempPath, 0755, true);
8989

9090
$method->invoke($this->command, $this->tempPath, $packageName, $studlyName, $namespace, $vendor);
9191

9292
expect(file_exists($this->tempPath . '/composer.json'))->toBeTrue();
93-
93+
9494
$composerContent = json_decode(file_get_contents($this->tempPath . '/composer.json'), true);
9595
expect($composerContent['name'])->toBe('test-vendor/test-package');
9696
expect($composerContent['description'])->toBe('Laravel package for TestPackage');
@@ -99,15 +99,15 @@
9999

100100
it('can create service provider', function () {
101101
$reflection = new ReflectionClass($this->command);
102-
$method = $reflection->getMethod('createPackageServiceProvider');
102+
$method = $reflection->getMethod('createPackageServiceProvider');
103103
$method->setAccessible(true);
104104

105105
$studlyName = 'TestPackage';
106-
$namespace = 'TestVendor\\TestPackage';
106+
$namespace = 'TestVendor\\TestPackage';
107107

108108
// Create a mock stub content
109109
$stubContent = '<?php namespace {{Namespace}}; class {{StudlyName}}ServiceProvider {}';
110-
110+
111111
// Mock filesystem to return stub content
112112
$mockFilesystem = mock(Filesystem::class);
113113
$mockFilesystem->shouldReceive('exists')->andReturn(true);
@@ -122,11 +122,11 @@
122122

123123
it('can create package model', function () {
124124
$reflection = new ReflectionClass($this->command);
125-
$method = $reflection->getMethod('createPackageModel');
125+
$method = $reflection->getMethod('createPackageModel');
126126
$method->setAccessible(true);
127127

128128
$studlyName = 'TestPackage';
129-
$namespace = 'TestVendor\\TestPackage';
129+
$namespace = 'TestVendor\\TestPackage';
130130

131131
// Mock filesystem and stub
132132
$mockFilesystem = mock(Filesystem::class);
@@ -142,11 +142,11 @@
142142

143143
it('can create package service', function () {
144144
$reflection = new ReflectionClass($this->command);
145-
$method = $reflection->getMethod('createPackageService');
145+
$method = $reflection->getMethod('createPackageService');
146146
$method->setAccessible(true);
147147

148148
$studlyName = 'TestPackage';
149-
$namespace = 'TestVendor\\TestPackage';
149+
$namespace = 'TestVendor\\TestPackage';
150150

151151
// Mock filesystem and stub
152152
$mockFilesystem = mock(Filesystem::class);
@@ -162,12 +162,12 @@
162162

163163
it('can create package readme', function () {
164164
$reflection = new ReflectionClass($this->command);
165-
$method = $reflection->getMethod('createPackageReadme');
165+
$method = $reflection->getMethod('createPackageReadme');
166166
$method->setAccessible(true);
167167

168168
$packageName = 'test-package';
169-
$studlyName = 'TestPackage';
170-
$vendor = 'test-vendor';
169+
$studlyName = 'TestPackage';
170+
$vendor = 'test-vendor';
171171

172172
// Mock filesystem and stub
173173
$mockFilesystem = mock(Filesystem::class);
@@ -183,7 +183,7 @@
183183

184184
it('throws exception when stub file not found', function () {
185185
$reflection = new ReflectionClass($this->command);
186-
$method = $reflection->getMethod('getStub');
186+
$method = $reflection->getMethod('getStub');
187187
$method->setAccessible(true);
188188

189189
// Mock filesystem to return false for exists
@@ -199,7 +199,7 @@
199199

200200
it('can get stub content when file exists', function () {
201201
$reflection = new ReflectionClass($this->command);
202-
$method = $reflection->getMethod('getStub');
202+
$method = $reflection->getMethod('getStub');
203203
$method->setAccessible(true);
204204

205205
$stubContent = '<?php // Test stub content';
@@ -214,4 +214,4 @@
214214
$result = $method->invoke($this->command, 'test-stub');
215215
expect($result)->toBe($stubContent);
216216
});
217-
});
217+
});

‎tests/Unit/Commands/InstallCommandTest.php‎

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
<?php
22

33
use Illuminate\Filesystem\Filesystem;
4-
use Illuminate\Support\Facades\File;
54
use PlinCode\LaravelCleanArchitecture\Commands\InstallCleanArchitectureCommand;
65

76
describe('InstallCleanArchitectureCommand', function () {
87
beforeEach(function () {
9-
$this->filesystem = new Filesystem();
10-
$this->command = new InstallCleanArchitectureCommand($this->filesystem);
11-
8+
$this->filesystem = new Filesystem;
9+
$this->command = new InstallCleanArchitectureCommand($this->filesystem);
10+
1211
// Mock the output to avoid writeln errors
1312
$mockOutput = mock('Symfony\Component\Console\Output\OutputInterface');
1413
$mockOutput->shouldReceive('writeln')->andReturn();
1514
$mockOutput->shouldReceive('write')->andReturn();
16-
17-
$reflection = new ReflectionClass($this->command);
15+
16+
$reflection = new ReflectionClass($this->command);
1817
$outputProperty = $reflection->getProperty('output');
1918
$outputProperty->setAccessible(true);
2019
$outputProperty->setValue($this->command, $mockOutput);
@@ -33,7 +32,7 @@
3332

3433
it('handles missing stub files gracefully', function () {
3534
$reflection = new ReflectionClass($this->command);
36-
$method = $reflection->getMethod('getStub');
35+
$method = $reflection->getMethod('getStub');
3736
$method->setAccessible(true);
3837

3938
// Mock filesystem to return false for exists
@@ -49,7 +48,7 @@
4948

5049
it('can get stub content when file exists', function () {
5150
$reflection = new ReflectionClass($this->command);
52-
$method = $reflection->getMethod('getStub');
51+
$method = $reflection->getMethod('getStub');
5352
$method->setAccessible(true);
5453

5554
$stubContent = '<?php // Test stub content';
@@ -67,7 +66,7 @@
6766

6867
it('can create directory structure', function () {
6968
$reflection = new ReflectionClass($this->command);
70-
$method = $reflection->getMethod('createDirectoryStructure');
69+
$method = $reflection->getMethod('createDirectoryStructure');
7170
$method->setAccessible(true);
7271

7372
// Mock filesystem
@@ -84,7 +83,7 @@
8483

8584
it('can generate base classes', function () {
8685
$reflection = new ReflectionClass($this->command);
87-
$method = $reflection->getMethod('createBaseClasses');
86+
$method = $reflection->getMethod('createBaseClasses');
8887
$method->setAccessible(true);
8988

9089
// Mock filesystem and stub
@@ -103,7 +102,7 @@
103102

104103
it('handles composer.json updates', function () {
105104
$reflection = new ReflectionClass($this->command);
106-
$method = $reflection->getMethod('updateComposerAutoload');
105+
$method = $reflection->getMethod('updateComposerAutoload');
107106
$method->setAccessible(true);
108107

109108
// Mock filesystem
@@ -120,7 +119,7 @@
120119

121120
it('can create configuration file', function () {
122121
$reflection = new ReflectionClass($this->command);
123-
$method = $reflection->getMethod('createConfigFile');
122+
$method = $reflection->getMethod('createConfigFile');
124123
$method->setAccessible(true);
125124

126125
// Mock filesystem and stub
@@ -139,7 +138,7 @@
139138

140139
it('can create readme file', function () {
141140
$reflection = new ReflectionClass($this->command);
142-
$method = $reflection->getMethod('createReadme');
141+
$method = $reflection->getMethod('createReadme');
143142
$method->setAccessible(true);
144143

145144
// Mock filesystem and stub
@@ -156,7 +155,7 @@
156155

157156
it('can create base model', function () {
158157
$reflection = new ReflectionClass($this->command);
159-
$method = $reflection->getMethod('createBaseModel');
158+
$method = $reflection->getMethod('createBaseModel');
160159
$method->setAccessible(true);
161160

162161
// Mock filesystem and stub
@@ -175,7 +174,7 @@
175174

176175
it('can create exception classes', function () {
177176
$reflection = new ReflectionClass($this->command);
178-
$method = $reflection->getMethod('createExceptionClasses');
177+
$method = $reflection->getMethod('createExceptionClasses');
179178
$method->setAccessible(true);
180179

181180
// Mock filesystem and stub
@@ -189,4 +188,4 @@
189188
$result = $method->invoke($this->command);
190189
expect($result)->toBeNull();
191190
});
192-
});
191+
});

‎tests/Unit/Commands/MakeActionCommandTest.php‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
describe('MakeActionCommand', function () {
77
beforeEach(function () {
88
$this->filesystem = new Filesystem;
9-
$this->command = new MakeActionCommand($this->filesystem);
9+
$this->command = new MakeActionCommand($this->filesystem);
1010
});
1111

1212
it('has correct command signature and description', function () {
@@ -27,12 +27,12 @@
2727

2828
it('can replace placeholders correctly', function () {
2929
$reflection = new ReflectionClass($this->command);
30-
$method = $reflection->getMethod('replacePlaceholders');
30+
$method = $reflection->getMethod('replacePlaceholders');
3131
$method->setAccessible(true);
32-
32+
3333
$content = '{{ActionName}} in {{DomainName}} for {{PluralDomainName}}';
34-
$result = $method->invoke($this->command, $content, 'CreateUser', 'User');
35-
34+
$result = $method->invoke($this->command, $content, 'CreateUser', 'User');
35+
3636
expect($result)
3737
->toContain('CreateUserAction')
3838
->toContain('User')
@@ -50,12 +50,12 @@
5050

5151
it('handles getStub method', function () {
5252
$reflection = new ReflectionClass($this->command);
53-
$method = $reflection->getMethod('getStub');
53+
$method = $reflection->getMethod('getStub');
5454
$method->setAccessible(true);
55-
55+
5656
// Test with existing stub
5757
$result = $method->invoke($this->command, 'action');
5858
expect($result)->toBeString();
5959
expect($result)->toContain('<?php');
6060
});
61-
});
61+
});

‎tests/Unit/Commands/MakeControllerCommandTest.php‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
describe('MakeControllerCommand', function () {
77
beforeEach(function () {
88
$this->filesystem = new Filesystem;
9-
$this->command = new MakeControllerCommand($this->filesystem);
9+
$this->command = new MakeControllerCommand($this->filesystem);
1010
});
1111

1212
it('has correct command signature and description', function () {
@@ -28,12 +28,12 @@
2828

2929
it('can replace placeholders correctly', function () {
3030
$reflection = new ReflectionClass($this->command);
31-
$method = $reflection->getMethod('replacePlaceholders');
31+
$method = $reflection->getMethod('replacePlaceholders');
3232
$method->setAccessible(true);
33-
33+
3434
$content = 'class {{ControllerName}} for {{DomainName}} and {{PluralDomainName}} with {{domainVariable}}';
35-
$result = $method->invoke($this->command, $content, 'User');
36-
35+
$result = $method->invoke($this->command, $content, 'User');
36+
3737
expect($result)
3838
->toContain('class UserController')
3939
->toContain('User')
@@ -45,9 +45,9 @@
4545

4646
it('handles getStub method for API controller', function () {
4747
$reflection = new ReflectionClass($this->command);
48-
$method = $reflection->getMethod('getStub');
48+
$method = $reflection->getMethod('getStub');
4949
$method->setAccessible(true);
50-
50+
5151
// Test with existing stub
5252
$result = $method->invoke($this->command, 'controller');
5353
expect($result)->toBeString();
@@ -56,12 +56,12 @@
5656

5757
it('handles getStub method for Web controller', function () {
5858
$reflection = new ReflectionClass($this->command);
59-
$method = $reflection->getMethod('getStub');
59+
$method = $reflection->getMethod('getStub');
6060
$method->setAccessible(true);
61-
61+
6262
// Test with existing stub
6363
$result = $method->invoke($this->command, 'web-controller');
6464
expect($result)->toBeString();
6565
expect($result)->toContain('<?php');
6666
});
67-
});
67+
});

0 commit comments

Comments
 (0)