-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
341 additions
and
23 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
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
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,23 @@ | ||
Feature: Machine tokens command | ||
In order to manage my devices | ||
As a user | ||
I need to be able to view and delete my machine tokens. | ||
|
||
Background: I am logged in | ||
Given I am authenticated | ||
|
||
@vcr machine-tokens_list | ||
Scenario: List the machine tokens | ||
When I run "terminus machine-token:list" | ||
Then I should get: | ||
""" | ||
[[machine_token_id]] | ||
""" | ||
|
||
@vcr machine-tokens_delete | ||
Scenario: Delete machine token | ||
When I run "terminus machine-token:delete [[machine_token_id]]" | ||
Then I should get: | ||
""" | ||
Deleted [[machine_token_device]]! | ||
""" |
51 changes: 51 additions & 0 deletions
51
tests/new_unit_tests/Commands/MachineToken/MachineTokenCommandTest.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,51 @@ | ||
<?php | ||
/** | ||
* @file | ||
* Contains Pantheon\Terminus\UnitTests\Commands\Auth\MachineTokenCommandTest | ||
*/ | ||
|
||
|
||
namespace Pantheon\Terminus\UnitTests\Commands\Auth; | ||
|
||
|
||
use Pantheon\Terminus\Session\Session; | ||
use Psr\Log\NullLogger; | ||
use Terminus\Collections\MachineTokens; | ||
use Terminus\Models\User; | ||
|
||
abstract class MachineTokenCommandTest extends \PHPUnit_Framework_TestCase { | ||
protected $session; | ||
protected $machine_tokens; | ||
protected $user; | ||
protected $logger; | ||
protected $command; | ||
|
||
/** | ||
* Sets up the fixture, for example, open a network connection. | ||
* This method is called before a test is executed. | ||
*/ | ||
protected function setUp() | ||
{ | ||
$this->machine_tokens = $this->getMockBuilder(MachineTokens::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
|
||
$this->user = $this->getMockBuilder(User::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$this->user->machine_tokens = $this->machine_tokens; | ||
|
||
$this->session = $this->getMockBuilder(Session::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
|
||
$this->session->method('getUser') | ||
->willReturn($this->user); | ||
|
||
$this->logger = $this->getMockBuilder(NullLogger::class) | ||
->setMethods(array('log')) | ||
->getMock(); | ||
|
||
|
||
} | ||
} |
Oops, something went wrong.