Skip to content

Commit

Permalink
GitHub #9 - Change indentation on chaining.
Browse files Browse the repository at this point in the history
  • Loading branch information
sqmk committed Apr 3, 2013
1 parent 29e0b4d commit 090cfca
Show file tree
Hide file tree
Showing 30 changed files with 291 additions and 293 deletions.
6 changes: 3 additions & 3 deletions tests/PhueTest/BridgeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ public function testSetName()
{
// Expect client's sendCommand usage
$this->mockClient->expects($this->once())
->method('sendCommand')
->with($this->isInstanceOf('\Phue\Command\SetBridgeConfig'))
->will($this->returnValue($this->bridge));
->method('sendCommand')
->with($this->isInstanceOf('\Phue\Command\SetBridgeConfig'))
->will($this->returnValue($this->bridge));

// Ensure setName returns self
$this->assertEquals(
Expand Down
28 changes: 14 additions & 14 deletions tests/PhueTest/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
*/
public function setUp()
{
$this->client = new Client('127.0.0.1');
$this->client = new Client('127.0.0.1');
}

/**
Expand Down Expand Up @@ -72,8 +72,8 @@ public function testGetBridge()

// Stub transports sendRequest method
$mockTransport->expects($this->once())
->method('sendRequest')
->will($this->returnValue(new \stdClass));
->method('sendRequest')
->will($this->returnValue(new \stdClass));

// Set transport
$this->client->setTransport($mockTransport);
Expand Down Expand Up @@ -109,8 +109,8 @@ public function testGetUsers()

// Stub transports sendRequest method
$mockTransport->expects($this->once())
->method('sendRequest')
->will($this->returnValue($mockResults));
->method('sendRequest')
->will($this->returnValue($mockResults));

// Set transport
$this->client->setTransport($mockTransport);
Expand Down Expand Up @@ -151,8 +151,8 @@ public function testGetLights()

// Stub transports sendRequest method
$mockTransport->expects($this->once())
->method('sendRequest')
->will($this->returnValue($mockResults));
->method('sendRequest')
->will($this->returnValue($mockResults));

// Set transport
$this->client->setTransport($mockTransport);
Expand Down Expand Up @@ -193,8 +193,8 @@ public function testGetGroups()

// Stub transports sendRequest method
$mockTransport->expects($this->once())
->method('sendRequest')
->will($this->returnValue($mockResults));
->method('sendRequest')
->will($this->returnValue($mockResults));

// Set transport
$this->client->setTransport($mockTransport);
Expand Down Expand Up @@ -236,8 +236,8 @@ public function testGetSchedules()

// Stub transports sendRequest method
$mockTransport->expects($this->once())
->method('sendRequest')
->will($this->returnValue($mockResults));
->method('sendRequest')
->will($this->returnValue($mockResults));

// Set transport
$this->client->setTransport($mockTransport);
Expand Down Expand Up @@ -302,9 +302,9 @@ public function testSendCommand()

// Stub command's send method
$mockCommand->expects($this->once())
->method('send')
->with($this->equalTo($this->client))
->will($this->returnValue('sample response'));
->method('send')
->with($this->equalTo($this->client))
->will($this->returnValue('sample response'));

$this->assertEquals(
$this->client->sendCommand($mockCommand),
Expand Down
32 changes: 16 additions & 16 deletions tests/PhueTest/Command/CreateGroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public function setUp()

// Stub client's getUsername method
$this->mockClient->expects($this->any())
->method('getUsername')
->will($this->returnValue('abcdefabcdef01234567890123456789'));
->method('getUsername')
->will($this->returnValue('abcdefabcdef01234567890123456789'));

// Stub client's getTransport method
$this->mockClient->expects($this->any())
->method('getTransport')
->will($this->returnValue($this->mockTransport));
->method('getTransport')
->will($this->returnValue($this->mockTransport));
}

/**
Expand Down Expand Up @@ -101,18 +101,18 @@ public function testSend()

// Stub transport's sendRequest usage
$this->mockTransport->expects($this->once())
->method('sendRequest')
->with(
$this->equalTo("{$this->mockClient->getUsername()}/groups"),
$this->equalTo(TransportInterface::METHOD_POST),
$this->equalTo(
(object) [
'name' => 'Dummy',
'lights' => [2, 3]
]
)
)
->will($this->returnValue((object)['id' => '/path/5']));
->method('sendRequest')
->with(
$this->equalTo("{$this->mockClient->getUsername()}/groups"),
$this->equalTo(TransportInterface::METHOD_POST),
$this->equalTo(
(object) [
'name' => 'Dummy',
'lights' => [2, 3]
]
)
)
->will($this->returnValue((object)['id' => '/path/5']));

// Send command and get response
$groupId = $command->send($this->mockClient);
Expand Down
62 changes: 30 additions & 32 deletions tests/PhueTest/Command/CreateScheduleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ public function setUp()

// Stub client's getUsername method
$this->mockClient->expects($this->any())
->method('getUsername')
->will($this->returnValue('abcdefabcdef01234567890123456789'));
->method('getUsername')
->will($this->returnValue('abcdefabcdef01234567890123456789'));

// Stub client's getTransport method
$this->mockClient->expects($this->any())
->method('getTransport')
->will($this->returnValue($this->mockTransport));
->method('getTransport')
->will($this->returnValue($this->mockTransport));

// Mock schedulable command
$this->mockCommand = $this->getMock(
Expand All @@ -57,16 +57,14 @@ public function setUp()

// Stub command's getSchedulableParams method
$this->mockCommand->expects($this->any())
->method('getSchedulableParams')
->will(
$this->returnValue(
[
'address' => '/api/endpoint',
'method' => 'POST',
'body' => 'Dummy'
]
)
);
->method('getSchedulableParams')
->will(
$this->returnValue([
'address' => '/api/endpoint',
'method' => 'POST',
'body' => 'Dummy'
])
);
}

/**
Expand Down Expand Up @@ -164,24 +162,24 @@ public function testSend()

// Stub transport's sendRequest usage
$this->mockTransport->expects($this->once())
->method('sendRequest')
->with(
$this->equalTo("{$this->mockClient->getUsername()}/schedules"),
$this->equalTo(TransportInterface::METHOD_POST),
$this->equalTo(
(object) [
'name' => 'Dummy!',
'description' => 'Description!',
'time' => '2012-12-30T10:11:12',
'command' => [
'method' => TransportInterface::METHOD_POST,
'address' => "/api/endpoint",
'body' => "Dummy"
]
]
)
)
->will($this->returnValue(4));
->method('sendRequest')
->with(
$this->equalTo("{$this->mockClient->getUsername()}/schedules"),
$this->equalTo(TransportInterface::METHOD_POST),
$this->equalTo(
(object) [
'name' => 'Dummy!',
'description' => 'Description!',
'time' => '2012-12-30T10:11:12',
'command' => [
'method' => TransportInterface::METHOD_POST,
'address' => "/api/endpoint",
'body' => "Dummy"
]
]
)
)
->will($this->returnValue(4));

// Send command and get response
$scheduleId = $command->send($this->mockClient);
Expand Down
22 changes: 11 additions & 11 deletions tests/PhueTest/Command/CreateUserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public function setUp()

// Stub client's getUsername method
$this->mockClient->expects($this->any())
->method('getUsername')
->will($this->returnValue('abcdefabcdef01234567890123456789'));
->method('getUsername')
->will($this->returnValue('abcdefabcdef01234567890123456789'));

// Stub client's getTransport method
$this->mockClient->expects($this->any())
->method('getTransport')
->will($this->returnValue($this->mockTransport));
->method('getTransport')
->will($this->returnValue($this->mockTransport));
}

/**
Expand Down Expand Up @@ -86,13 +86,13 @@ public function testSend()

// Stub transport's sendRequest method
$this->mockTransport->expects($this->once())
->method('sendRequest')
->with(
$this->equalTo(''),
$this->equalTo('POST'),
$this->anything()
)
->will($this->returnValue('success!'));
->method('sendRequest')
->with(
$this->equalTo(''),
$this->equalTo('POST'),
$this->anything()
)
->will($this->returnValue('success!'));

$this->assertEquals(
(new CreateUser('testuser0123', 'phpunit'))->send($this->mockClient),
Expand Down
18 changes: 9 additions & 9 deletions tests/PhueTest/Command/DeleteGroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public function setUp()

// Stub client's getUsername method
$this->mockClient->expects($this->any())
->method('getUsername')
->will($this->returnValue('abcdefabcdef01234567890123456789'));
->method('getUsername')
->will($this->returnValue('abcdefabcdef01234567890123456789'));

// Stub client's getTransport method
$this->mockClient->expects($this->any())
->method('getTransport')
->will($this->returnValue($this->mockTransport));
->method('getTransport')
->will($this->returnValue($this->mockTransport));
}

/**
Expand All @@ -59,11 +59,11 @@ public function testSend()

// Stub transport's sendRequest usage
$this->mockTransport->expects($this->once())
->method('sendRequest')
->with(
$this->equalTo("{$this->mockClient->getUsername()}/groups/5"),
$this->equalTo(TransportInterface::METHOD_DELETE)
);
->method('sendRequest')
->with(
$this->equalTo("{$this->mockClient->getUsername()}/groups/5"),
$this->equalTo(TransportInterface::METHOD_DELETE)
);

// Send command
$command->send($this->mockClient);
Expand Down
18 changes: 9 additions & 9 deletions tests/PhueTest/Command/DeleteScheduleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public function setUp()

// Stub client's getUsername method
$this->mockClient->expects($this->any())
->method('getUsername')
->will($this->returnValue('abcdefabcdef01234567890123456789'));
->method('getUsername')
->will($this->returnValue('abcdefabcdef01234567890123456789'));

// Stub client's getTransport method
$this->mockClient->expects($this->any())
->method('getTransport')
->will($this->returnValue($this->mockTransport));
->method('getTransport')
->will($this->returnValue($this->mockTransport));
}

/**
Expand All @@ -59,11 +59,11 @@ public function testSend()

// Stub transport's sendRequest usage
$this->mockTransport->expects($this->once())
->method('sendRequest')
->with(
$this->equalTo("{$this->mockClient->getUsername()}/schedules/4"),
$this->equalTo(TransportInterface::METHOD_DELETE)
);
->method('sendRequest')
->with(
$this->equalTo("{$this->mockClient->getUsername()}/schedules/4"),
$this->equalTo(TransportInterface::METHOD_DELETE)
);

// Send command
$command->send($this->mockClient);
Expand Down
18 changes: 9 additions & 9 deletions tests/PhueTest/Command/DeleteUserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public function setUp()

// Stub client's getUsername method
$this->mockClient->expects($this->any())
->method('getUsername')
->will($this->returnValue('abcdefabcdef01234567890123456789'));
->method('getUsername')
->will($this->returnValue('abcdefabcdef01234567890123456789'));

// Stub client's getTransport method
$this->mockClient->expects($this->any())
->method('getTransport')
->will($this->returnValue($this->mockTransport));
->method('getTransport')
->will($this->returnValue($this->mockTransport));
}

/**
Expand All @@ -59,11 +59,11 @@ public function testSend()

// Stub transport's sendRequest usage
$this->mockTransport->expects($this->once())
->method('sendRequest')
->with(
$this->equalTo("{$this->mockClient->getUsername()}/config/whitelist/atestusername"),
$this->equalTo(TransportInterface::METHOD_DELETE)
);
->method('sendRequest')
->with(
$this->equalTo("{$this->mockClient->getUsername()}/config/whitelist/atestusername"),
$this->equalTo(TransportInterface::METHOD_DELETE)
);

// Send command
$command->send($this->mockClient);
Expand Down
14 changes: 7 additions & 7 deletions tests/PhueTest/Command/GetBridgeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ public function setUp()

// Stub client's getUsername method
$this->mockClient->expects($this->any())
->method('getUsername')
->will($this->returnValue('abcdefabcdef01234567890123456789'));
->method('getUsername')
->will($this->returnValue('abcdefabcdef01234567890123456789'));

// Stub client's getTransport method
$this->mockClient->expects($this->any())
->method('getTransport')
->will($this->returnValue($this->mockTransport));
->method('getTransport')
->will($this->returnValue($this->mockTransport));
}

/**
Expand All @@ -61,9 +61,9 @@ public function testGetBridge()

// Stub transport's sendRequest usage
$this->mockTransport->expects($this->once())
->method('sendRequest')
->with($this->equalTo("{$this->mockClient->getUsername()}/config"))
->will($this->returnValue($mockTransportResults));
->method('sendRequest')
->with($this->equalTo("{$this->mockClient->getUsername()}/config"))
->will($this->returnValue($mockTransportResults));

// Send command and get response
$response = $this->getBridge->send($this->mockClient);
Expand Down
Loading

0 comments on commit 090cfca

Please sign in to comment.