|
2 | 2 |
|
3 | 3 | declare(strict_types=1); |
4 | 4 |
|
5 | | -use Laravel\Boost\Install\CodeEnvironementsDetector; |
6 | 5 | use Laravel\Boost\Install\CodeEnvironment\CodeEnvironment; |
| 6 | +use Laravel\Boost\Install\CodeEnvironmentsDetector; |
7 | 7 | use Laravel\Boost\Install\Enums\Platform; |
8 | 8 |
|
9 | 9 | beforeEach(function () { |
10 | 10 | $this->container = new \Illuminate\Container\Container(); |
11 | | - $this->detector = new CodeEnvironementsDetector($this->container); |
| 11 | + $this->detector = new CodeEnvironmentsDetector($this->container); |
12 | 12 | }); |
13 | 13 |
|
14 | 14 | afterEach(function () { |
15 | 15 | Mockery::close(); |
16 | 16 | }); |
17 | 17 |
|
18 | | -test('discoverSystemInstalledCodeEnvironements returns detected programs', function () { |
| 18 | +test('discoverSystemInstalledCodeEnvironments returns detected programs', function () { |
19 | 19 | // Create mock programs |
20 | 20 | $program1 = Mockery::mock(CodeEnvironment::class); |
21 | 21 | $program1->shouldReceive('detectOnSystem')->with(Mockery::type(Platform::class))->andReturn(true); |
|
44 | 44 | $container->bind(\Laravel\Boost\Install\CodeEnvironment\Zed::class, fn () => $otherProgram); |
45 | 45 | $container->bind(\Laravel\Boost\Install\CodeEnvironment\Copilot::class, fn () => $otherProgram); |
46 | 46 |
|
47 | | - $detector = new CodeEnvironementsDetector($container); |
48 | | - $detected = $detector->discoverSystemInstalledCodeEnvironements(); |
| 47 | + $detector = new CodeEnvironmentsDetector($container); |
| 48 | + $detected = $detector->discoverSystemInstalledCodeEnvironments(); |
49 | 49 |
|
50 | 50 | expect($detected)->toBe(['phpstorm', 'cursor']); |
51 | 51 | }); |
52 | 52 |
|
53 | | -test('discoverSystemInstalledCodeEnvironements returns empty array when no programs detected', function () { |
| 53 | +test('discoverSystemInstalledCodeEnvironments returns empty array when no programs detected', function () { |
54 | 54 | $program1 = Mockery::mock(CodeEnvironment::class); |
55 | 55 | $program1->shouldReceive('detectOnSystem')->with(Mockery::type(Platform::class))->andReturn(false); |
56 | 56 | $program1->shouldReceive('name')->andReturn('phpstorm'); |
|
70 | 70 | $container->bind(\Laravel\Boost\Install\CodeEnvironment\Zed::class, fn () => $otherProgram); |
71 | 71 | $container->bind(\Laravel\Boost\Install\CodeEnvironment\Copilot::class, fn () => $otherProgram); |
72 | 72 |
|
73 | | - $detector = new CodeEnvironementsDetector($container); |
74 | | - $detected = $detector->discoverSystemInstalledCodeEnvironements(); |
| 73 | + $detector = new CodeEnvironmentsDetector($container); |
| 74 | + $detected = $detector->discoverSystemInstalledCodeEnvironments(); |
75 | 75 |
|
76 | 76 | expect($detected)->toBeEmpty(); |
77 | 77 | }); |
78 | 78 |
|
79 | | -test('discoverProjectInstalledCodeEnvironements detects programs in project', function () { |
| 79 | +test('discoverProjectInstalledCodeEnvironments detects programs in project', function () { |
80 | 80 | $basePath = '/path/to/project'; |
81 | 81 |
|
82 | 82 | $program1 = Mockery::mock(CodeEnvironment::class); |
|
97 | 97 | $container->bind(\Laravel\Boost\Install\CodeEnvironment\PhpStorm::class, fn () => $program2); |
98 | 98 | $container->bind(\Laravel\Boost\Install\CodeEnvironment\ClaudeCode::class, fn () => $program3); |
99 | 99 |
|
100 | | - $detector = new CodeEnvironementsDetector($container); |
101 | | - $detected = $detector->discoverProjectInstalledCodeEnvironements($basePath); |
| 100 | + $detector = new CodeEnvironmentsDetector($container); |
| 101 | + $detected = $detector->discoverProjectInstalledCodeEnvironments($basePath); |
102 | 102 |
|
103 | 103 | expect($detected)->toBe(['vscode', 'claudecode']); |
104 | 104 | }); |
105 | 105 |
|
106 | | -test('discoverProjectInstalledCodeEnvironements returns empty array when no programs detected in project', function () { |
| 106 | +test('discoverProjectInstalledCodeEnvironments returns empty array when no programs detected in project', function () { |
107 | 107 | $basePath = '/path/to/project'; |
108 | 108 |
|
109 | 109 | $program1 = Mockery::mock(CodeEnvironment::class); |
|
114 | 114 | $container = new \Illuminate\Container\Container(); |
115 | 115 | $container->bind(\Laravel\Boost\Install\CodeEnvironment\VSCode::class, fn () => $program1); |
116 | 116 |
|
117 | | - $detector = new CodeEnvironementsDetector($container); |
118 | | - $detected = $detector->discoverProjectInstalledCodeEnvironements($basePath); |
| 117 | + $detector = new CodeEnvironmentsDetector($container); |
| 118 | + $detected = $detector->discoverProjectInstalledCodeEnvironments($basePath); |
119 | 119 |
|
120 | 120 | expect($detected)->toBeEmpty(); |
121 | 121 | }); |
122 | 122 |
|
123 | | -test('discoverProjectInstalledCodeEnvironements detects applications by directory', function () { |
| 123 | +test('discoverProjectInstalledCodeEnvironments detects applications by directory', function () { |
124 | 124 | $tempDir = sys_get_temp_dir().'/boost_test_'.uniqid(); |
125 | 125 | mkdir($tempDir); |
126 | 126 | mkdir($tempDir.'/.vscode'); |
127 | 127 |
|
128 | | - $detected = $this->detector->discoverProjectInstalledCodeEnvironements($tempDir); |
| 128 | + $detected = $this->detector->discoverProjectInstalledCodeEnvironments($tempDir); |
129 | 129 |
|
130 | 130 | expect($detected)->toContain('vscode'); |
131 | 131 |
|
|
134 | 134 | rmdir($tempDir); |
135 | 135 | }); |
136 | 136 |
|
137 | | -test('discoverProjectInstalledCodeEnvironements detects applications by file', function () { |
| 137 | +test('discoverProjectInstalledCodeEnvironments detects applications by file', function () { |
138 | 138 | $tempDir = sys_get_temp_dir().'/boost_test_'.uniqid(); |
139 | 139 | mkdir($tempDir); |
140 | 140 | file_put_contents($tempDir.'/.windsurfrules.md', 'test'); |
141 | 141 |
|
142 | | - $detected = $this->detector->discoverProjectInstalledCodeEnvironements($tempDir); |
| 142 | + $detected = $this->detector->discoverProjectInstalledCodeEnvironments($tempDir); |
143 | 143 |
|
144 | 144 | expect($detected)->toContain('windsurf'); |
145 | 145 |
|
|
148 | 148 | rmdir($tempDir); |
149 | 149 | }); |
150 | 150 |
|
151 | | -test('discoverProjectInstalledCodeEnvironements detects applications with mixed type', function () { |
| 151 | +test('discoverProjectInstalledCodeEnvironments detects applications with mixed type', function () { |
152 | 152 | $tempDir = sys_get_temp_dir().'/boost_test_'.uniqid(); |
153 | 153 | mkdir($tempDir); |
154 | 154 | file_put_contents($tempDir.'/CLAUDE.md', 'test'); |
155 | 155 |
|
156 | | - $detected = $this->detector->discoverProjectInstalledCodeEnvironements($tempDir); |
| 156 | + $detected = $this->detector->discoverProjectInstalledCodeEnvironments($tempDir); |
157 | 157 |
|
158 | 158 | expect($detected)->toContain('claudecode'); |
159 | 159 |
|
|
162 | 162 | rmdir($tempDir); |
163 | 163 | }); |
164 | 164 |
|
165 | | -test('discoverProjectInstalledCodeEnvironements detects copilot with nested file path', function () { |
| 165 | +test('discoverProjectInstalledCodeEnvironments detects copilot with nested file path', function () { |
166 | 166 | $tempDir = sys_get_temp_dir().'/boost_test_'.uniqid(); |
167 | 167 | mkdir($tempDir); |
168 | 168 | mkdir($tempDir.'/.github'); |
169 | 169 | file_put_contents($tempDir.'/.github/copilot-instructions.md', 'test'); |
170 | 170 |
|
171 | | - $detected = $this->detector->discoverProjectInstalledCodeEnvironements($tempDir); |
| 171 | + $detected = $this->detector->discoverProjectInstalledCodeEnvironments($tempDir); |
172 | 172 |
|
173 | 173 | expect($detected)->toContain('copilot'); |
174 | 174 |
|
|
178 | 178 | rmdir($tempDir); |
179 | 179 | }); |
180 | 180 |
|
181 | | -test('discoverProjectInstalledCodeEnvironements detects claude code with directory', function () { |
| 181 | +test('discoverProjectInstalledCodeEnvironments detects claude code with directory', function () { |
182 | 182 | $tempDir = sys_get_temp_dir().'/boost_test_'.uniqid(); |
183 | 183 | mkdir($tempDir); |
184 | 184 | mkdir($tempDir.'/.claude'); |
185 | 185 |
|
186 | | - $detected = $this->detector->discoverProjectInstalledCodeEnvironements($tempDir); |
| 186 | + $detected = $this->detector->discoverProjectInstalledCodeEnvironments($tempDir); |
187 | 187 |
|
188 | 188 | expect($detected)->toContain('claudecode'); |
189 | 189 |
|
|
192 | 192 | rmdir($tempDir); |
193 | 193 | }); |
194 | 194 |
|
195 | | -test('discoverProjectInstalledCodeEnvironements detects phpstorm with idea directory', function () { |
| 195 | +test('discoverProjectInstalledCodeEnvironments detects phpstorm with idea directory', function () { |
196 | 196 | $tempDir = sys_get_temp_dir().'/boost_test_'.uniqid(); |
197 | 197 | mkdir($tempDir); |
198 | 198 | mkdir($tempDir.'/.idea'); |
199 | 199 |
|
200 | | - $detected = $this->detector->discoverProjectInstalledCodeEnvironements($tempDir); |
| 200 | + $detected = $this->detector->discoverProjectInstalledCodeEnvironments($tempDir); |
201 | 201 |
|
202 | 202 | expect($detected)->toContain('phpstorm'); |
203 | 203 |
|
|
206 | 206 | rmdir($tempDir); |
207 | 207 | }); |
208 | 208 |
|
209 | | -test('discoverProjectInstalledCodeEnvironements detects phpstorm with junie directory', function () { |
| 209 | +test('discoverProjectInstalledCodeEnvironments detects phpstorm with junie directory', function () { |
210 | 210 | $tempDir = sys_get_temp_dir().'/boost_test_'.uniqid(); |
211 | 211 | mkdir($tempDir); |
212 | 212 | mkdir($tempDir.'/.junie'); |
213 | 213 |
|
214 | | - $detected = $this->detector->discoverProjectInstalledCodeEnvironements($tempDir); |
| 214 | + $detected = $this->detector->discoverProjectInstalledCodeEnvironments($tempDir); |
215 | 215 |
|
216 | 216 | expect($detected)->toContain('phpstorm'); |
217 | 217 |
|
|
220 | 220 | rmdir($tempDir); |
221 | 221 | }); |
222 | 222 |
|
223 | | -test('discoverProjectInstalledCodeEnvironements detects cursor with cursor directory', function () { |
| 223 | +test('discoverProjectInstalledCodeEnvironments detects cursor with cursor directory', function () { |
224 | 224 | $tempDir = sys_get_temp_dir().'/boost_test_'.uniqid(); |
225 | 225 | mkdir($tempDir); |
226 | 226 | mkdir($tempDir.'/.cursor'); |
227 | 227 |
|
228 | | - $detected = $this->detector->discoverProjectInstalledCodeEnvironements($tempDir); |
| 228 | + $detected = $this->detector->discoverProjectInstalledCodeEnvironments($tempDir); |
229 | 229 |
|
230 | 230 | expect($detected)->toContain('cursor'); |
231 | 231 |
|
|
234 | 234 | rmdir($tempDir); |
235 | 235 | }); |
236 | 236 |
|
237 | | -test('discoverProjectInstalledCodeEnvironements handles multiple detections', function () { |
| 237 | +test('discoverProjectInstalledCodeEnvironments handles multiple detections', function () { |
238 | 238 | $tempDir = sys_get_temp_dir().'/boost_test_'.uniqid(); |
239 | 239 | mkdir($tempDir); |
240 | 240 | mkdir($tempDir.'/.vscode'); |
241 | 241 | mkdir($tempDir.'/.cursor'); |
242 | 242 | file_put_contents($tempDir.'/CLAUDE.md', 'test'); |
243 | 243 |
|
244 | | - $detected = $this->detector->discoverProjectInstalledCodeEnvironements($tempDir); |
| 244 | + $detected = $this->detector->discoverProjectInstalledCodeEnvironments($tempDir); |
245 | 245 |
|
246 | 246 | expect($detected)->toContain('vscode'); |
247 | 247 | expect($detected)->toContain('cursor'); |
|
0 commit comments