diff --git a/tests/PhueTest/BridgeTest.php b/tests/PhueTest/BridgeTest.php index a67685c..c25e042 100644 --- a/tests/PhueTest/BridgeTest.php +++ b/tests/PhueTest/BridgeTest.php @@ -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( diff --git a/tests/PhueTest/ClientTest.php b/tests/PhueTest/ClientTest.php index 6a4c40c..3297a91 100644 --- a/tests/PhueTest/ClientTest.php +++ b/tests/PhueTest/ClientTest.php @@ -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'); } /** @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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), diff --git a/tests/PhueTest/Command/CreateGroupTest.php b/tests/PhueTest/Command/CreateGroupTest.php index d64ba1e..546854b 100644 --- a/tests/PhueTest/Command/CreateGroupTest.php +++ b/tests/PhueTest/Command/CreateGroupTest.php @@ -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)); } /** @@ -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); diff --git a/tests/PhueTest/Command/CreateScheduleTest.php b/tests/PhueTest/Command/CreateScheduleTest.php index 5768d3f..295a565 100644 --- a/tests/PhueTest/Command/CreateScheduleTest.php +++ b/tests/PhueTest/Command/CreateScheduleTest.php @@ -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( @@ -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' + ]) + ); } /** @@ -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); diff --git a/tests/PhueTest/Command/CreateUserTest.php b/tests/PhueTest/Command/CreateUserTest.php index 28f8dee..aec9706 100644 --- a/tests/PhueTest/Command/CreateUserTest.php +++ b/tests/PhueTest/Command/CreateUserTest.php @@ -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)); } /** @@ -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), diff --git a/tests/PhueTest/Command/DeleteGroupTest.php b/tests/PhueTest/Command/DeleteGroupTest.php index e95a282..f084d6a 100644 --- a/tests/PhueTest/Command/DeleteGroupTest.php +++ b/tests/PhueTest/Command/DeleteGroupTest.php @@ -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)); } /** @@ -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); diff --git a/tests/PhueTest/Command/DeleteScheduleTest.php b/tests/PhueTest/Command/DeleteScheduleTest.php index 0c0fa26..59ac6f6 100644 --- a/tests/PhueTest/Command/DeleteScheduleTest.php +++ b/tests/PhueTest/Command/DeleteScheduleTest.php @@ -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)); } /** @@ -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); diff --git a/tests/PhueTest/Command/DeleteUserTest.php b/tests/PhueTest/Command/DeleteUserTest.php index b0a372d..8d64ac8 100644 --- a/tests/PhueTest/Command/DeleteUserTest.php +++ b/tests/PhueTest/Command/DeleteUserTest.php @@ -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)); } /** @@ -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); diff --git a/tests/PhueTest/Command/GetBridgeTest.php b/tests/PhueTest/Command/GetBridgeTest.php index e40968d..cd6b570 100644 --- a/tests/PhueTest/Command/GetBridgeTest.php +++ b/tests/PhueTest/Command/GetBridgeTest.php @@ -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)); } /** @@ -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); diff --git a/tests/PhueTest/Command/GetGroupByIdTest.php b/tests/PhueTest/Command/GetGroupByIdTest.php index c12792d..f7c48db 100644 --- a/tests/PhueTest/Command/GetGroupByIdTest.php +++ b/tests/PhueTest/Command/GetGroupByIdTest.php @@ -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 getTransport usage $this->mockClient->expects($this->any()) - ->method('getTransport') - ->will($this->returnValue($this->mockTransport)); + ->method('getTransport') + ->will($this->returnValue($this->mockTransport)); } /** @@ -57,9 +57,9 @@ public function testSend() { // Stub transport's sendRequest usage $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with("{$this->mockClient->getUsername()}/groups/5") - ->will($this->returnValue(new \stdClass)); + ->method('sendRequest') + ->with("{$this->mockClient->getUsername()}/groups/5") + ->will($this->returnValue(new \stdClass)); // Get group $group = (new GetGroupById(5))->send($this->mockClient); diff --git a/tests/PhueTest/Command/GetGroupsTest.php b/tests/PhueTest/Command/GetGroupsTest.php index 75eff98..98dbad4 100644 --- a/tests/PhueTest/Command/GetGroupsTest.php +++ b/tests/PhueTest/Command/GetGroupsTest.php @@ -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)); } /** @@ -58,9 +58,9 @@ public function testFoundNoGroups() { // Stub transport's sendRequest method $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with($this->equalTo($this->mockClient->getUsername())) - ->will($this->returnValue(new \stdClass)); + ->method('sendRequest') + ->with($this->equalTo($this->mockClient->getUsername())) + ->will($this->returnValue(new \stdClass)); // Send command and get response $response = $this->getGroups->send($this->mockClient); @@ -87,9 +87,9 @@ public function testFoundGroups() // Stub transport's sendRequest usage $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with($this->equalTo($this->mockClient->getUsername())) - ->will($this->returnValue($mockTransportResults)); + ->method('sendRequest') + ->with($this->equalTo($this->mockClient->getUsername())) + ->will($this->returnValue($mockTransportResults)); // Send command and get response $response = $this->getGroups->send($this->mockClient); diff --git a/tests/PhueTest/Command/GetLightByIdTest.php b/tests/PhueTest/Command/GetLightByIdTest.php index fa611b3..2f7040e 100644 --- a/tests/PhueTest/Command/GetLightByIdTest.php +++ b/tests/PhueTest/Command/GetLightByIdTest.php @@ -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 getTransport usage $this->mockClient->expects($this->any()) - ->method('getTransport') - ->will($this->returnValue($this->mockTransport)); + ->method('getTransport') + ->will($this->returnValue($this->mockTransport)); } /** @@ -57,9 +57,9 @@ public function testSend() { // Stub transport's sendRequest usage $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with("{$this->mockClient->getUsername()}/lights/10") - ->will($this->returnValue(new \stdClass)); + ->method('sendRequest') + ->with("{$this->mockClient->getUsername()}/lights/10") + ->will($this->returnValue(new \stdClass)); // Get light $light = (new GetLightById(10))->send($this->mockClient); diff --git a/tests/PhueTest/Command/GetLightsTest.php b/tests/PhueTest/Command/GetLightsTest.php index cb9c3c9..6d6cf38 100644 --- a/tests/PhueTest/Command/GetLightsTest.php +++ b/tests/PhueTest/Command/GetLightsTest.php @@ -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)); } /** @@ -58,9 +58,9 @@ public function testFoundNoLights() { // Stub transport's sendRequest method $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with($this->equalTo($this->mockClient->getUsername())) - ->will($this->returnValue(new \stdClass)); + ->method('sendRequest') + ->with($this->equalTo($this->mockClient->getUsername())) + ->will($this->returnValue(new \stdClass)); // Send command and get response $response = $this->getLights->send($this->mockClient); @@ -87,9 +87,9 @@ public function testFoundLights() // Stub transport's sendRequest usage $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with($this->equalTo($this->mockClient->getUsername())) - ->will($this->returnValue($mockTransportResults)); + ->method('sendRequest') + ->with($this->equalTo($this->mockClient->getUsername())) + ->will($this->returnValue($mockTransportResults)); // Send command and get response $response = $this->getLights->send($this->mockClient); diff --git a/tests/PhueTest/Command/GetNewLightsTest.php b/tests/PhueTest/Command/GetNewLightsTest.php index e53cdc5..4a450c1 100644 --- a/tests/PhueTest/Command/GetNewLightsTest.php +++ b/tests/PhueTest/Command/GetNewLightsTest.php @@ -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)); // Mock transport results $mockTransportResults = (object) [ @@ -57,9 +57,9 @@ public function setUp() // Stub transport's sendRequest usage $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with($this->equalTo("{$this->mockClient->getUsername()}/lights/new")) - ->will($this->returnValue($mockTransportResults)); + ->method('sendRequest') + ->with($this->equalTo("{$this->mockClient->getUsername()}/lights/new")) + ->will($this->returnValue($mockTransportResults)); } /** diff --git a/tests/PhueTest/Command/GetScheduleByIdTest.php b/tests/PhueTest/Command/GetScheduleByIdTest.php index f0bafd7..ebdd512 100644 --- a/tests/PhueTest/Command/GetScheduleByIdTest.php +++ b/tests/PhueTest/Command/GetScheduleByIdTest.php @@ -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 getTransport usage $this->mockClient->expects($this->any()) - ->method('getTransport') - ->will($this->returnValue($this->mockTransport)); + ->method('getTransport') + ->will($this->returnValue($this->mockTransport)); } /** @@ -57,9 +57,9 @@ public function testSend() { // Stub transport's sendRequest usage $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with("{$this->mockClient->getUsername()}/schedules/9") - ->will($this->returnValue(new \stdClass)); + ->method('sendRequest') + ->with("{$this->mockClient->getUsername()}/schedules/9") + ->will($this->returnValue(new \stdClass)); // Get schedule $schedule = (new GetScheduleById(9))->send($this->mockClient); diff --git a/tests/PhueTest/Command/GetSchedulesTest.php b/tests/PhueTest/Command/GetSchedulesTest.php index 92efb30..8cafcf3 100644 --- a/tests/PhueTest/Command/GetSchedulesTest.php +++ b/tests/PhueTest/Command/GetSchedulesTest.php @@ -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)); } /** @@ -58,9 +58,9 @@ public function testFoundNoSchedules() { // Stub transport's sendRequest method $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with($this->equalTo($this->mockClient->getUsername())) - ->will($this->returnValue(new \stdClass)); + ->method('sendRequest') + ->with($this->equalTo($this->mockClient->getUsername())) + ->will($this->returnValue(new \stdClass)); // Send command and get response $response = $this->getSchedules->send($this->mockClient); @@ -87,9 +87,9 @@ public function testFoundSchedules() // Stub transport's sendRequest usage $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with($this->equalTo($this->mockClient->getUsername())) - ->will($this->returnValue($mockTransportResults)); + ->method('sendRequest') + ->with($this->equalTo($this->mockClient->getUsername())) + ->will($this->returnValue($mockTransportResults)); // Send command and get response $response = $this->getSchedules->send($this->mockClient); diff --git a/tests/PhueTest/Command/GetUsersTest.php b/tests/PhueTest/Command/GetUsersTest.php index 178893a..098b081 100644 --- a/tests/PhueTest/Command/GetUsersTest.php +++ b/tests/PhueTest/Command/GetUsersTest.php @@ -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)); } /** @@ -58,9 +58,9 @@ public function testFoundNoUsers() { // Stub transport's sendRequest method $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with($this->equalTo("{$this->mockClient->getUsername()}/config")) - ->will($this->returnValue(new \stdClass)); + ->method('sendRequest') + ->with($this->equalTo("{$this->mockClient->getUsername()}/config")) + ->will($this->returnValue(new \stdClass)); // Send command and get response $response = $this->getUsers->send($this->mockClient); @@ -87,9 +87,9 @@ public function testFoundUsers() // 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->getUsers->send($this->mockClient); diff --git a/tests/PhueTest/Command/IsAuthorizedTest.php b/tests/PhueTest/Command/IsAuthorizedTest.php index 06e2b3e..f487aec 100644 --- a/tests/PhueTest/Command/IsAuthorizedTest.php +++ b/tests/PhueTest/Command/IsAuthorizedTest.php @@ -39,13 +39,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)); } /** @@ -57,8 +57,8 @@ public function testIsAuthorized() { // Stub transport's sendRequest method $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with($this->equalTo($this->mockClient->getUsername())); + ->method('sendRequest') + ->with($this->equalTo($this->mockClient->getUsername())); $this->assertTrue( (new IsAuthorized)->send($this->mockClient) @@ -74,13 +74,13 @@ public function testIsNotAuthorized() { // Stub transport's sendRequest $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with($this->equalTo($this->mockClient->getUsername())) - ->will( - $this->throwException( - $this->getMock('\Phue\Transport\Exception\UnauthorizedUserException') - ) - ); + ->method('sendRequest') + ->with($this->equalTo($this->mockClient->getUsername())) + ->will( + $this->throwException( + $this->getMock('\Phue\Transport\Exception\UnauthorizedUserException') + ) + ); $this->assertFalse( (new IsAuthorized)->send($this->mockClient) diff --git a/tests/PhueTest/Command/PingTest.php b/tests/PhueTest/Command/PingTest.php index 2ad618d..ad9179e 100644 --- a/tests/PhueTest/Command/PingTest.php +++ b/tests/PhueTest/Command/PingTest.php @@ -38,8 +38,8 @@ public function setUp() // Stub client getTransport usage $this->mockClient->expects($this->any()) - ->method('getTransport') - ->will($this->returnValue($this->mockTransport)); + ->method('getTransport') + ->will($this->returnValue($this->mockTransport)); } /** @@ -51,8 +51,8 @@ public function testSend() { // Stub transport's sendRequest usage $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with($this->equalTo('none/config')); + ->method('sendRequest') + ->with($this->equalTo('none/config')); (new Ping)->send($this->mockClient); } diff --git a/tests/PhueTest/Command/SetBridgeConfigTest.php b/tests/PhueTest/Command/SetBridgeConfigTest.php index f875049..8f20d80 100644 --- a/tests/PhueTest/Command/SetBridgeConfigTest.php +++ b/tests/PhueTest/Command/SetBridgeConfigTest.php @@ -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)); } /** @@ -57,14 +57,14 @@ public function testSend() { // Stub transport's sendRequest usage $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with( - $this->equalTo( - "{$this->mockClient->getUsername()}/config" - ), - $this->equalTo('PUT'), - $this->isInstanceOf('\stdClass') - ); + ->method('sendRequest') + ->with( + $this->equalTo( + "{$this->mockClient->getUsername()}/config" + ), + $this->equalTo('PUT'), + $this->isInstanceOf('\stdClass') + ); (new SetBridgeConfig(['name' => 'test']))->send($this->mockClient); } diff --git a/tests/PhueTest/Command/SetGroupAttributesTest.php b/tests/PhueTest/Command/SetGroupAttributesTest.php index 6e91fe8..fc470de 100644 --- a/tests/PhueTest/Command/SetGroupAttributesTest.php +++ b/tests/PhueTest/Command/SetGroupAttributesTest.php @@ -45,13 +45,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)); } /** @@ -90,13 +90,13 @@ protected function stubTransportSendRequestWithPayload(\stdClass $payload) { // Stub transport's sendRequest usage $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with( - $this->equalTo( - "{$this->mockClient->getUsername()}/groups/{$this->mockGroup->getId()}" - ), - $this->equalTo('PUT'), - $payload - ); + ->method('sendRequest') + ->with( + $this->equalTo( + "{$this->mockClient->getUsername()}/groups/{$this->mockGroup->getId()}" + ), + $this->equalTo('PUT'), + $payload + ); } } diff --git a/tests/PhueTest/Command/SetGroupStateTest.php b/tests/PhueTest/Command/SetGroupStateTest.php index 019b093..8daf57a 100644 --- a/tests/PhueTest/Command/SetGroupStateTest.php +++ b/tests/PhueTest/Command/SetGroupStateTest.php @@ -45,13 +45,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)); } /** @@ -74,7 +74,7 @@ public function testSend() // Change color temp and set state $setGroupStateCmd->colorTemp(300) - ->send($this->mockClient); + ->send($this->mockClient); } /** @@ -112,13 +112,13 @@ protected function stubTransportSendRequestWithPayload(\stdClass $payload) { // Stub transport's sendRequest usage $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with( - $this->equalTo( - "{$this->mockClient->getUsername()}/groups/{$this->mockGroup->getId()}/action" - ), - $this->equalTo('PUT'), - $payload - ); + ->method('sendRequest') + ->with( + $this->equalTo( + "{$this->mockClient->getUsername()}/groups/{$this->mockGroup->getId()}/action" + ), + $this->equalTo('PUT'), + $payload + ); } } diff --git a/tests/PhueTest/Command/SetLightNameTest.php b/tests/PhueTest/Command/SetLightNameTest.php index 5bb3cf4..89d21f5 100644 --- a/tests/PhueTest/Command/SetLightNameTest.php +++ b/tests/PhueTest/Command/SetLightNameTest.php @@ -46,13 +46,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)); } /** @@ -65,14 +65,14 @@ public function testSend() { // Stub transport's sendRequest usage $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with( - $this->equalTo( - "{$this->mockClient->getUsername()}/lights/{$this->mockLight->getId()}" - ), - $this->equalTo('PUT'), - $this->isInstanceOf('\stdClass') - ); + ->method('sendRequest') + ->with( + $this->equalTo( + "{$this->mockClient->getUsername()}/lights/{$this->mockLight->getId()}" + ), + $this->equalTo('PUT'), + $this->isInstanceOf('\stdClass') + ); (new SetLightName($this->mockLight, 'Dummy name'))->send($this->mockClient); } diff --git a/tests/PhueTest/Command/SetLightStateTest.php b/tests/PhueTest/Command/SetLightStateTest.php index b8723a6..790f74b 100644 --- a/tests/PhueTest/Command/SetLightStateTest.php +++ b/tests/PhueTest/Command/SetLightStateTest.php @@ -45,13 +45,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)); } /** @@ -516,14 +516,14 @@ protected function stubTransportSendRequestWithPayload(\stdClass $payload) { // Stub transport's sendRequest usage $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with( - $this->equalTo( - "{$this->mockClient->getUsername()}/lights/{$this->mockLight->getId()}/state" - ), - $this->equalTo('PUT'), - $payload - ); + ->method('sendRequest') + ->with( + $this->equalTo( + "{$this->mockClient->getUsername()}/lights/{$this->mockLight->getId()}/state" + ), + $this->equalTo('PUT'), + $payload + ); } /** diff --git a/tests/PhueTest/Command/SetScheduleAttributesTest.php b/tests/PhueTest/Command/SetScheduleAttributesTest.php index f58518c..7d89fbc 100644 --- a/tests/PhueTest/Command/SetScheduleAttributesTest.php +++ b/tests/PhueTest/Command/SetScheduleAttributesTest.php @@ -45,13 +45,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( diff --git a/tests/PhueTest/Command/StartLightScanTest.php b/tests/PhueTest/Command/StartLightScanTest.php index 8c6da04..43e4afd 100644 --- a/tests/PhueTest/Command/StartLightScanTest.php +++ b/tests/PhueTest/Command/StartLightScanTest.php @@ -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)); } /** @@ -56,12 +56,12 @@ public function testSend() { // Stub transport's sendRequest method $this->mockTransport->expects($this->once()) - ->method('sendRequest') - ->with( - $this->equalTo($this->mockClient->getUsername() . '/lights'), - $this->equalTo('POST') - ) - ->will($this->returnValue('success!')); + ->method('sendRequest') + ->with( + $this->equalTo($this->mockClient->getUsername() . '/lights'), + $this->equalTo('POST') + ) + ->will($this->returnValue('success!')); $this->assertEquals( (new StartLightScan)->send($this->mockClient), diff --git a/tests/PhueTest/GroupTest.php b/tests/PhueTest/GroupTest.php index b53353d..e343c44 100644 --- a/tests/PhueTest/GroupTest.php +++ b/tests/PhueTest/GroupTest.php @@ -87,9 +87,9 @@ public function testSetName() { // Stub client's sendCommand method $this->mockClient->expects($this->once()) - ->method('sendCommand') - ->with($this->isInstanceOf('\Phue\Command\SetGroupAttributes')) - ->will($this->returnValue($this->group)); + ->method('sendCommand') + ->with($this->isInstanceOf('\Phue\Command\SetGroupAttributes')) + ->will($this->returnValue($this->group)); // Ensure setName returns self $this->assertEquals( @@ -127,9 +127,9 @@ public function testSetLights() { // Stub client's sendCommand method $this->mockClient->expects($this->once()) - ->method('sendCommand') - ->with($this->isInstanceOf('\Phue\Command\SetGroupAttributes')) - ->will($this->returnValue($this->group)); + ->method('sendCommand') + ->with($this->isInstanceOf('\Phue\Command\SetGroupAttributes')) + ->will($this->returnValue($this->group)); // Ensure setLights return self $this->assertEquals( @@ -365,8 +365,8 @@ public function testGetColormode() public function testDelete() { $this->mockClient->expects($this->once()) - ->method('sendCommand') - ->with($this->isInstanceOf('\Phue\Command\DeleteGroup')); + ->method('sendCommand') + ->with($this->isInstanceOf('\Phue\Command\DeleteGroup')); $this->group->delete(); } @@ -390,7 +390,7 @@ public function testToString() protected function stubMockClientSendSetGroupStateCommand() { $this->mockClient->expects($this->once()) - ->method('sendCommand') - ->with($this->isInstanceOf('\Phue\Command\SetGroupState')); + ->method('sendCommand') + ->with($this->isInstanceOf('\Phue\Command\SetGroupState')); } } diff --git a/tests/PhueTest/LightTest.php b/tests/PhueTest/LightTest.php index 5969a9a..ae12840 100644 --- a/tests/PhueTest/LightTest.php +++ b/tests/PhueTest/LightTest.php @@ -90,9 +90,9 @@ public function testSetName() { // Stub client's sendCommand method $this->mockClient->expects($this->once()) - ->method('sendCommand') - ->with($this->isInstanceOf('\Phue\Command\SetLightName')) - ->will($this->returnValue($this->light)); + ->method('sendCommand') + ->with($this->isInstanceOf('\Phue\Command\SetLightName')) + ->will($this->returnValue($this->light)); // Ensure setName returns self $this->assertEquals( @@ -407,7 +407,7 @@ public function testToString() protected function stubMockClientSendSetLightStateCommand() { $this->mockClient->expects($this->once()) - ->method('sendCommand') - ->with($this->isInstanceOf('\Phue\Command\SetLightState')); + ->method('sendCommand') + ->with($this->isInstanceOf('\Phue\Command\SetLightState')); } } diff --git a/tests/PhueTest/Transport/HttpTest.php b/tests/PhueTest/Transport/HttpTest.php index 4422c92..8352429 100644 --- a/tests/PhueTest/Transport/HttpTest.php +++ b/tests/PhueTest/Transport/HttpTest.php @@ -247,17 +247,17 @@ protected function stubMockAdapterResponseMethods($response, $httpStatusCode, $c { // Stub send method on transport adapter $this->mockAdapter->expects($this->once()) - ->method('send') - ->will($this->returnValue(json_encode($response))); + ->method('send') + ->will($this->returnValue(json_encode($response))); // Stub getHttpStatusCode on transport adapter $this->mockAdapter->expects($this->once()) - ->method('getHttpStatusCode') - ->will($this->returnValue($httpStatusCode)); + ->method('getHttpStatusCode') + ->will($this->returnValue($httpStatusCode)); // Stub getContentType on transport adapter $this->mockAdapter->expects($this->once()) - ->method('getContentType') - ->will($this->returnValue($contentType)); + ->method('getContentType') + ->will($this->returnValue($contentType)); } } diff --git a/tests/PhueTest/UserTest.php b/tests/PhueTest/UserTest.php index da5cc6c..fad268e 100644 --- a/tests/PhueTest/UserTest.php +++ b/tests/PhueTest/UserTest.php @@ -104,8 +104,8 @@ public function testGetLastUseDate() public function testDelete() { $this->mockClient->expects($this->once()) - ->method('sendCommand') - ->with($this->isInstanceOf('\Phue\Command\DeleteUser')); + ->method('sendCommand') + ->with($this->isInstanceOf('\Phue\Command\DeleteUser')); $this->user->delete(); }