-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added upstream:updates:status command (#1654)
- Loading branch information
1 parent
731bcac
commit 34547e8
Showing
9 changed files
with
212 additions
and
31 deletions.
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
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,28 @@ | ||
<?php | ||
|
||
namespace Pantheon\Terminus\Commands\Upstream\Updates; | ||
|
||
/** | ||
* Class StatusCommand | ||
* @package Pantheon\Terminus\Commands\Upstream\Updates | ||
*/ | ||
class StatusCommand extends UpdatesCommand | ||
{ | ||
/** | ||
* Displays a whether there are updates available from the upstream for a site's environment. | ||
* | ||
* @authorize | ||
* | ||
* @command upstream:updates:status | ||
* | ||
* @param string $site_env Site & environment in the format `site-name.env` | ||
* @return string | ||
* | ||
* @usage <site>.<env> Displays the status of updates available from the upstream for <site>'s <env> environment. | ||
*/ | ||
public function status($site_env) | ||
{ | ||
list(, $env) = $this->getSiteEnv($site_env); | ||
return $env->getUpstreamStatus()->getStatus(); | ||
} | ||
} |
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
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,19 @@ | ||
Feature: Check an environment's upstream update status | ||
In order to easily maintain my site | ||
As a user | ||
I need to be able to check my environments' upstream update status. | ||
|
||
Background: I am authenticated and I have a site named [[test_site_name]] using Git mode | ||
Given I am authenticated | ||
And a site named "[[test_site_name]]" | ||
And the connection mode of "[[test_site_name]]" is "git" | ||
|
||
@vcr upstream-updates.yml | ||
Scenario: Check for upstream update status when it's current | ||
When I run "terminus upstream:updates:status [[test_site_name]].dev" | ||
Then I should get: "current" | ||
|
||
@vcr upstream-update-list.yml | ||
Scenario: Check for upstream updates status when it's outdated | ||
When I run "terminus upstream:updates:status [[test_site_name]].dev" | ||
Then I should get: "outdated" |
40 changes: 40 additions & 0 deletions
40
tests/unit_tests/Commands/Upstream/Updates/StatusCommandTest.php
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,40 @@ | ||
<?php | ||
|
||
namespace Pantheon\Terminus\UnitTests\Commands\Upstream\Updates; | ||
|
||
use Pantheon\Terminus\Commands\Upstream\Updates\StatusCommand; | ||
|
||
/** | ||
* Class StatusCommandTest | ||
* Testing class for Pantheon\Terminus\Commands\Upstream\Updates\StatusCommand | ||
* @package Pantheon\Terminus\UnitTests\Commands\Upstream\Updates | ||
*/ | ||
class StatusCommandTest extends UpdatesCommandTest | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
$this->command = new StatusCommand($this->getConfig()); | ||
$this->command->setSites($this->sites); | ||
} | ||
|
||
/** | ||
* Tests the StatusCommand::status($site_env) function | ||
*/ | ||
public function testStatus() | ||
{ | ||
$status = 'some status'; | ||
|
||
$this->upstream_status->expects($this->once()) | ||
->method('getStatus') | ||
->with() | ||
->willReturn($status); | ||
|
||
$out = $this->command->status('site.env'); | ||
$this->assertEquals($status, $out); | ||
} | ||
} |
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