Phue\Command\CreateUser::send PHP Method

send() public method

Send command
public send ( Client $client ) : stdClass
$client Phue\Client Phue Client
return stdClass Authentication response
    public function send(Client $client)
    {
        // Get response
        $response = $client->getTransport()->sendRequest('/api', TransportInterface::METHOD_POST, $this->buildRequestData($client));
        return $response;
    }

Usage Example

Beispiel #1
0
 /**
  * Test: Send create user command
  *
  * @covers \Phue\Command\CreateUser::send
  * @covers \Phue\Command\CreateUser::buildRequestData
  */
 public function testSend()
 {
     // Set up device type to pass to create user command
     $deviceType = 'phpunit';
     // Stub transport's sendRequest method
     $this->mockTransport->expects($this->once())->method('sendRequest')->with($this->equalTo('/api'), $this->equalTo('POST'), $this->anything())->will($this->returnValue('success!'));
     $x = new CreateUser('phpunit');
     $this->assertEquals('success!', $x->send($this->mockClient));
 }