Skip to content

Commit 2be59da

Browse files
authored
Merge pull request #1203 from laravel/mes/add-secured-command
Add "secured" command
2 parents 8230cc8 + c001556 commit 2be59da

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

cli/valet.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,17 @@
210210
info('The ['.$url.'] site will now serve traffic over HTTP.');
211211
})->descriptions('Stop serving the given domain over HTTPS and remove the trusted TLS certificate');
212212

213+
/**
214+
* Get all the current secured sites.
215+
*/
216+
$app->command('secured', function () {
217+
$sites = collect(Site::secured())->map(function ($url) {
218+
return ['Site' => $url];
219+
});
220+
221+
table(['Site'], $sites->all());
222+
});
223+
213224
/**
214225
* Create an Nginx proxy config for the specified domain.
215226
*/

tests/SiteTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,21 @@ public function test_remove_proxy()
526526

527527
$this->assertEquals([], $site->proxies()->all());
528528
}
529+
530+
public function test_it_returns_secured_sites()
531+
{
532+
$files = Mockery::mock(Filesystem::class);
533+
$files->shouldReceive('scandir')
534+
->once()
535+
->andReturn(['helloworld.tld.crt']);
536+
537+
swap(Filesystem::class, $files);
538+
539+
$site = resolve(Site::class);
540+
$sites = $site->secured();
541+
542+
$this->assertSame(['helloworld.tld'], $sites);
543+
}
529544
}
530545

531546
class CommandLineFake extends CommandLine

0 commit comments

Comments
 (0)