/** * Test: Send command * * @covers \Phue\Command\CreateGroup::__construct * @covers \Phue\Command\CreateGroup::send */ public function testSend() { $command = new CreateGroup('Dummy', [2, 3]); // Stub transport's sendRequest usage $this->mockTransport->expects($this->once())->method('sendRequest')->with($this->equalTo("/api/{$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); // Ensure we have a group id $this->assertEquals(5, $groupId); }