fix whitespace.

This commit is contained in:
meadsteve 2013-11-25 21:19:48 +00:00
parent 477fd58641
commit 03a81a3283
2 changed files with 225 additions and 201 deletions

View file

@ -8,6 +8,7 @@
*/
namespace PHPCI\Plugin\Tests;
use PHPCI\Plugin\Email as EmailPlugin;
@ -58,10 +59,12 @@ class EmailTest extends \PHPUnit_Framework_TestCase
$this->mockCiBuilder = $this->getMock(
'\PHPCI\Builder',
array('getSystemConfig',
array(
'getSystemConfig',
'getBuildProjectTitle',
'getBuild',
'log'),
'log'
),
array(),
"mockBuilder",
false
@ -72,11 +75,15 @@ class EmailTest extends \PHPUnit_Framework_TestCase
$this->mockCiBuilder->expects($this->any())
->method('getSystemConfig')
->with('phpci')
->will($this->returnValue(array(
->will(
$this->returnValue(
array(
'email_settings' => array(
'from_address' => "test-from-address@example.com"
)
)));
)
)
);
$this->mockCiBuilder->expects($this->any())
->method('getBuildProjectTitle')
->will($this->returnValue('Test-Project'));
@ -122,9 +129,11 @@ class EmailTest extends \PHPUnit_Framework_TestCase
*/
public function testExecute_BuildsBasicEmails()
{
$this->loadEmailPluginWithOptions(array(
$this->loadEmailPluginWithOptions(
array(
'addresses' => array('test-receiver@example.com')
));
)
);
/** @var \Swift_Message $actualMail */
$actualMail = null;
@ -227,14 +236,17 @@ class EmailTest extends \PHPUnit_Framework_TestCase
* @param string $expectedSubject
* @param \Swift_Message $actualMail
*/
protected function assertSystemMail($expectedToAddress,
protected function assertSystemMail(
$expectedToAddress,
$expectedFromAddress,
$expectedBody,
$expectedSubject,
$actualMail)
{
$actualMail
) {
if (!($actualMail instanceof \Swift_Message)) {
$type = is_object($actualMail) ? get_class($actualMail) : gettype($actualMail);
$type = is_object($actualMail) ? get_class($actualMail) : gettype(
$actualMail
);
throw new \Exception("Expected Swift_Message got " . $type);
}
$this->assertEquals(

View file

@ -8,6 +8,7 @@
*/
namespace PHPCI\Plugin\Tests;
use PHPCI\Plugin\PHPUnit;
/**
@ -36,7 +37,7 @@ class PHPUnitTest extends \PHPUnit_Framework_TestCase
{
$this->mockCiBuilder = $this->getMock(
'\PHPCI\Builder',
array(),
array('findBinary'),
array(),
"mockBuilder",
false
@ -62,7 +63,8 @@ class PHPUnitTest extends \PHPUnit_Framework_TestCase
/**
* @param \PHPUnit_Framework_MockObject_Matcher_Invocation $expectation
*/
protected function expectFindBinaryToBeCalled($expectation) {
protected function expectFindBinaryToBeCalled($expectation)
{
$this->mockCiBuilder->expects($expectation)
->method("findBinary")
->will($this->returnValue("phpunit"));
@ -92,13 +94,16 @@ class PHPUnitTest extends \PHPUnit_Framework_TestCase
* @covers PHPUnit::execute
* @covers PHPUnit::runDir
*/
public function testExecute_CallsExecuteCommandOnceWhenGivenStringDirectory()
public function testExecute_CallsExecuteCommandOnceWhenGivenStringDirectory(
)
{
chdir('/');
$this->loadPhpUnitWithOptions(array(
$this->loadPhpUnitWithOptions(
array(
'directory' => "Fake/Test/Path"
));
)
);
$this->expectFindBinaryToBeCalled($this->once());
$this->expectExectuteCommandToBeCalled($this->once());
@ -114,9 +119,11 @@ class PHPUnitTest extends \PHPUnit_Framework_TestCase
{
chdir('/');
$this->loadPhpUnitWithOptions(array(
$this->loadPhpUnitWithOptions(
array(
'config' => "Fake/Test/config.xml"
));
)
);
$this->expectFindBinaryToBeCalled($this->once());
$this->expectExectuteCommandToBeCalled($this->once());
@ -128,13 +135,16 @@ class PHPUnitTest extends \PHPUnit_Framework_TestCase
* @covers PHPUnit::execute
* @covers PHPUnit::runDir
*/
public function testExecute_CallsExecuteCommandManyTimesWhenGivenArrayDirectory()
public function testExecute_CallsExecuteCommandManyTimesWhenGivenArrayDirectory(
)
{
chdir('/');
$this->loadPhpUnitWithOptions(array(
$this->loadPhpUnitWithOptions(
array(
'directory' => array(0, 1)
));
)
);
$this->mockCiBuilder->expects($this->at(0))->method("executeCommand");
$this->mockCiBuilder->expects($this->at(1))->method("executeCommand");
@ -150,9 +160,11 @@ class PHPUnitTest extends \PHPUnit_Framework_TestCase
{
chdir('/');
$this->loadPhpUnitWithOptions(array(
$this->loadPhpUnitWithOptions(
array(
'config' => array(0, 1)
));
)
);
$this->mockCiBuilder->expects($this->at(0))->method("executeCommand");
$this->mockCiBuilder->expects($this->at(1))->method("executeCommand");