alert() public method

Set alert parameter
public alert ( string $mode = self::ALERT_LONG_SELECT ) : self
$mode string Alert mode
return self This object
 /**
  * Test: Get schedulable params
  *
  * @covers \Phue\Command\SetLightState::getSchedulableParams
  */
 public function testGetSchedulableParams()
 {
     // Build command
     $setLightStateCmd = new SetLightState($this->mockLight);
     // Change alert
     $setLightStateCmd->alert('select');
     // Ensure schedulable params are expected
     $this->assertEquals(['address' => "/api/{$this->mockClient->getUsername()}/lights/{$this->mockLight->getId()}/state", 'method' => 'PUT', 'body' => (object) ['alert' => 'select']], $setLightStateCmd->getSchedulableParams($this->mockClient));
 }
Example #2
0
 /**
  * Test: Get actionable params
  *
  * @covers \Phue\Command\SetLightState::getActionableParams
  */
 public function testGetActionableParams()
 {
     // Build command
     $setLightStateCmd = new SetLightState($this->mockLight);
     // Change alert
     $setLightStateCmd->alert('select');
     // Ensure actionable params are expected
     $this->assertEquals(array('address' => "/lights/{$this->mockLight->getId()}/state", 'method' => 'PUT', 'body' => (object) array('alert' => 'select')), $setLightStateCmd->getActionableParams($this->mockClient));
 }
Example #3
0
File: Light.php Project: sqmk/phue
 /**
  * Set light alert
  *
  * @param string $mode
  *            Alert mode
  *
  * @return self This object
  */
 public function setAlert($mode = SetLightState::ALERT_LONG_SELECT)
 {
     $x = new SetLightState($this);
     $y = $x->alert($mode);
     $this->client->sendCommand($y);
     $this->attributes->state->alert = $mode;
     return $this;
 }