-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from gbradley/main
Changed getSiteLink to use protocol based on sslRequired variable
- Loading branch information
Showing
3 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
/.vagrant | ||
.phpunit.result.cache | ||
.env | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
use App\Services\Forge\ForgeService; | ||
use App\Services\Forge\ForgeSetting; | ||
use Laravel\Forge\Forge; | ||
use Laravel\Forge\Resources\Site; | ||
|
||
test('it gets the site link using the environment URL when explicity provided', function () { | ||
|
||
$setting = Mockery::mock(ForgeSetting::class); | ||
$setting->environmentUrl = 'https://foo.bar'; | ||
$setting->timeoutSeconds = 0; | ||
|
||
$service = new ForgeService($setting, new Forge); | ||
|
||
expect($service->getSiteLink())->toBe('https://foo.bar'); | ||
}); | ||
|
||
test('it gets the site link using HTTPS when SSL is required', function () { | ||
|
||
$setting = Mockery::mock(ForgeSetting::class); | ||
$setting->environmentUrl = null; | ||
$setting->sslRequired = true; | ||
$setting->timeoutSeconds = 0; | ||
|
||
$service = new ForgeService($setting, new Forge); | ||
|
||
$site = mock(Site::class); | ||
$site->name = 'foo.bar'; | ||
$service->setSite($site); | ||
|
||
expect($service->getSiteLink())->toBe('https://foo.bar'); | ||
}); | ||
|
||
test('it gets the site link using HTTP when SSL is not required', function () { | ||
|
||
$setting = Mockery::mock(ForgeSetting::class); | ||
$setting->environmentUrl = null; | ||
$setting->sslRequired = false; | ||
$setting->timeoutSeconds = 0; | ||
|
||
$service = new ForgeService($setting, new Forge); | ||
|
||
$site = mock(Site::class); | ||
$site->name = 'foo.bar'; | ||
$service->setSite($site); | ||
|
||
expect($service->getSiteLink())->toBe('http://foo.bar'); | ||
}); |