public function send(Client $client) { // Get response $attributes = $client->getTransport()->sendRequest("/api/{$client->getUsername()}/lights/{$this->lightId}"); return new Light($this->lightId, $attributes, $client); }
/** * Test: Send get light by id command * * @covers \Phue\Command\GetLightById::__construct * @covers \Phue\Command\GetLightById::send */ public function testSend() { // Stub transport's sendRequest usage $this->mockTransport->expects($this->once())->method('sendRequest')->with("/api/{$this->mockClient->getUsername()}/lights/10")->will($this->returnValue(new \stdClass())); // Get light $x = new GetLightById(10); $light = $x->send($this->mockClient); // Ensure type is correct $this->assertInstanceOf('\\Phue\\Light', $light); }