Phue\Test\ScheduleTest::testSetCommand PHP Method

testSetCommand() public method

Test: Settings command
public testSetCommand ( )
    public function testSetCommand()
    {
        // Stub client's sendCommand method
        $this->mockClient->expects($this->once())->method('sendCommand')->with($this->isInstanceOf('\\Phue\\Command\\SetScheduleAttributes'))->will($this->returnValue($this->schedule));
        // Mock actionable command
        $mockCommand = $this->getMock('\\Phue\\Command\\ActionableInterface', array('getActionableParams'));
        $actionableParams = array('address' => '/api/endpoint', 'method' => 'POST', 'body' => 'Dummy');
        // Stub command's getActionableParams method
        $mockCommand->expects($this->any())->method('getActionableParams')->will($this->returnValue((object) $actionableParams));
        // Ensure setCommand returns self
        $this->assertEquals($this->schedule, $this->schedule->setCommand($mockCommand));
        // Ensure new command can be retrieved by getCommand
        $this->assertEquals($actionableParams, $this->schedule->getCommand());
    }