This repository has been archived by the owner on Apr 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
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 #144 from niels-nijens/tests
Improved tests and testability of SSHConnectionAdapter::getCurrentUsername
- Loading branch information
Showing
4 changed files
with
50 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace Accompli\Test\EventDispatcher\Event; | ||
|
||
use Accompli\EventDispatcher\Event\HostEvent; | ||
use PHPUnit_Framework_TestCase; | ||
|
||
/** | ||
* HostEventTest. | ||
* | ||
* @author Niels Nijens <nijens.niels@gmail.com> | ||
*/ | ||
class HostEventTest extends PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* Tests if constructing a new HostEvent sets the properties. | ||
*/ | ||
public function testConstruct() | ||
{ | ||
$hostMock = $this->getMockBuilder('Accompli\Deployment\Host') | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
|
||
$event = new HostEvent($hostMock); | ||
|
||
$this->assertAttributeSame($hostMock, 'host', $event); | ||
} | ||
|
||
/** | ||
* Tests if HostEvent::getHost returns the same value as during construction of HostEvent. | ||
*/ | ||
public function testGetHost() | ||
{ | ||
$hostMock = $this->getMockBuilder('Accompli\Deployment\Host') | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
|
||
$event = new HostEvent($hostMock); | ||
|
||
$this->assertSame($hostMock, $event->getHost()); | ||
} | ||
} |